Skip to content

chore(ci): migrate the local test network from dfx and snsdemo to icp-cli - #8123

Merged
yhabib merged 23 commits into
mainfrom
governance-dfx-icp-cli-migration-bb2c0e
Nov 5, 2026
Merged

yhabib merged 23 commits into
mainfrom
governance-dfx-icp-cli-migration-bb2c0e

Conversation

@yhabib

@yhabib yhabib commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

snsdemo is shutting down, see dfinity/snsdemo#628. It runs on dfx, which is deprecated and cannot run IC commits newer than 2026-10-01, so the snapshot that CI and local development depend on will stop updating. This moves the local test network to icp-cli, the same way as dfinity/governance-app#498. The release scripts keep dfx, because dfx-orbit needs it.

The icp-cli network launcher starts PocketIC with the NNS, the SNS, Internet Identity, the ICP ledger, the SNS aggregator and an nns-dapp. It has no SNS project and no ck tokens, so the end-to-end tests that need them are skipped for now.

Changes

  • Added icp.yaml, scripts/install-icp-cli and scripts/icp-network-start, which starts the network, makes the icp identity a controller of the nns-dapp and the aggregator through the PocketIC REST API, stakes a large NNS neuron, deploys a mock ICP Swap price feed and installs the given wasms.
  • Replaced the start_dfx_snapshot and checkout_snsdemo actions and the snsdemo update workflow with a start_icp_network action, and ported the build jobs, the test scripts and the Dockerfile from dfx to icp.
  • Added scripts/canister-id, so config.sh reads the canister IDs from the icp-cli mappings and dfx.json with jq instead of dfx.
  • Rewrote the e2e login for the new Internet Identity, staked 200 ICP for the dummy proposals, made the page objects wait for the next view after a back navigation, and skipped the five tests that need an SNS, ckBTC or a test token.
  • Fixed the SNS aggregator to serve an empty latest list with zero SNSs, and the frontend to accept an empty project list, to load the staking rewards without SNS projects, and to map the IC0542 error code.
  • Updated HACKING.md, BUILD.md and the e2e README.

…-cli

The snsdemo repository is shutting down, because dfx is deprecated and
cannot run new IC commits. The local network now runs on icp-cli, which
starts PocketIC with the NNS, the SNS, Internet Identity, the ICP ledger,
the SNS aggregator and an nns-dapp. A script adds the icp identity as a
controller of the nns-dapp and the aggregator, so CI can install the
build under test.

The release scripts keep dfx, because dfx-orbit needs it.
The local NNS has one neuron of 1 ICP, so a test neuron decides every
proposal at once. The start script now stakes a large neuron for the
anonymous principal. The reject cost is 25 ICP, so the dummy proposals
helper stakes 200 ICP. PocketIC answers canister_status with IC0542.
The page objects wait for the next view after a back navigation.
goBack did not await the removal of the view, so the next navigation
clicked back twice. The deep JSON test now also matches the script URL
with a query string, which the Vite dev server adds.
@yhabib
yhabib requested a review from a team as a code owner October 26, 2026 23:50
@zeropath-ai

zeropath-ai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to 7f63125.

Security Overview
Detected Code Changes

The diff is too large to display a summary of code changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved build and test blockers, along with SNS loading failure handling, prevent approval.

4 open issues
What changed in this PR

Migrates local development and CI from deprecated dfx/snsdemo snapshots to an icp-cli-managed PocketIC network, while retaining dfx for releases.

Changes:

  • Adds network startup, controller setup, CLI installation, and canister-ID resolution tools.
  • Migrates CI and test helpers, updates login and navigation handling, and temporarily skips tests requiring unavailable fixtures.
  • Supports empty SNS aggregator results and IC0542 errors, with updated documentation and changelogs.
File Description
scripts/​update-snsdemo Removes obsolete snapshot update tooling.
scripts/​setup Installs the pinned icp-cli version.
scripts/​nns-dapp/​upgrade-downgrade-test Uses the icp-cli network lifecycle.
scripts/​nns-dapp/​test-config Uses the new canister-ID resolver.
scripts/​nns-dapp/​test-account.test Migrates account tests to icp-cli.
scripts/​nns-dapp/​migration-test.canister Migrates installation and upgrade helpers.
scripts/​nns-dapp/​migration-test Updates the documented CLI prerequisite.
scripts/​install-icp-cli Adds platform-specific CLI installation.
scripts/​icp-network-start Starts and prepares the local network.
scripts/​icp-canister-add-controller Grants local control through PocketIC.
scripts/​dfx-wasm-metadata-add.test Queries metadata using icp-cli.
scripts/​dfx-snapshot-start Removes snapshot startup tooling.
scripts/​dfx-snapshot-install Removes snapshot installation tooling.
scripts/​dfx-nns-deploy-custom Removes legacy network deployment tooling.
scripts/​dfx-canister-url Uses the new ID resolver.
scripts/​dfx-canister-check-wasm-hash Reads deployed hashes through icp-cli.
scripts/​canister-id Resolves IDs from repository configuration.
scripts/​backend/​get_upgrade_instructions Queries upgrade statistics with icp-cli.
rs/​sns_aggregator/​src/​state.rs Initializes an empty latest-SNS list.
icp.yaml Defines the managed local network.
HACKING.md Documents the new development setup.
frontend/​src/​tests/​utils/​e2e.test-utils.ts Updates login and canister lookup helpers.
frontend/​src/​tests/​utils/​e2e.nns-proposals.test-utils.ts Increases dummy-proposal staking funds.
frontend/​src/​tests/​page-objects/​playwright.page-object.ts Implements visibility checks.
frontend/​src/​tests/​page-objects/​App.page-object.ts Waits for views after back navigation.
frontend/​src/​tests/​lib/​canisters/​ic-management.errors.spec.ts Tests IC0542 error mapping.
frontend/​src/​tests/​lib/​api/​sns-aggregator.api.spec.ts Distinguishes empty responses from failures.
frontend/​src/​tests/​e2e/​sns-participation.spec.ts Skips tests requiring an SNS swap.
frontend/​src/​tests/​e2e/​sns-governance.spec.ts Skips tests requiring an SNS project.
frontend/​src/​tests/​e2e/​README.md Documents the new test environment.
frontend/​src/​tests/​e2e/​proposals.spec.ts Increases proposal-test funding.
frontend/​src/​tests/​e2e/​proposal-payload-deep-json.spec.ts Updates funding and script interception.
frontend/​src/​tests/​e2e/​neurons.spec.ts Increases voting-test funding.
frontend/​src/​tests/​e2e/​neuron-details.spec.ts Makes APY normalization conditional.
frontend/​src/​tests/​e2e/​import-token.spec.ts Migrates lookups and skips missing-token tests.
frontend/​src/​tests/​e2e/​import-token-anonymous-validation.spec.ts Migrates lookups and skips missing-token validation.
frontend/​src/​tests/​e2e/​ckbtc.spec.ts Skips tests requiring ckBTC infrastructure.
frontend/​src/​tests/​e2e/​canisters.spec.ts Updates the local linked-canister ID.
frontend/​src/​lib/​canisters/​ic-management/​ic-management.errors.ts Recognizes IC0542 permission errors.
frontend/​src/​lib/​api/​sns-aggregator.api.ts Allows successful empty aggregator responses.
Dockerfile Removes dfx installation from build stages.
dfx.json Updates local canister IDs.
config.sh Replaces dfx-based ID lookups.
config.json Pins icp-cli and disables local ck tokens.
CHANGELOG-Sns_Aggregator.md Records empty-list serving behavior.
CHANGELOG-Nns-Dapp-unreleased.md Records migration and frontend changes.
BUILD.md Updates local build and deployment instructions.
.gitignore Ignores icp-cli network state.
.github/​workflows/​update-snsdemo.yml Removes snapshot update automation.
.github/​workflows/​deploy-to-app.yaml Removes snsdemo deployment dependencies.
.github/​workflows/​checks.yml Removes dfx setup from checks.
.github/​workflows/​build.yml Migrates network-dependent CI jobs.
.github/​actions/​test-e2e/​action.yml Runs browser tests against icp-cli.
.github/​actions/​start_icp_network/​action.yaml Adds reusable network setup.
.github/​actions/​start_dfx_snapshot/​action.yaml Removes snapshot setup action.
.github/​actions/​checkout_snsdemo/​action.yaml Removes snsdemo checkout action.
.github/​actions/​build_nns_dapp/​action.yaml Removes snsdemo and dfx build setup.

Review effort: Balanced

Comment thread .github/workflows/build.yml Resolved
Comment thread Dockerfile Resolved
…oad the rewards without SNS

The upgrade jobs use migration-test and estimate-upgrade-cycles, which
still called dfx. The Docker configurator stages run config.sh, which
needs scripts/canister-id. The aggregator API accepts an empty project
list only when the first page loaded. The staking rewards waited for SNS
neurons that never load on a network without SNS projects.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Default local installation arguments can retain an invalid price-feed URL, and empty SNS lists leave actionable proposals loading indefinitely.

2 open issues
4 resolved since last review

Review effort: Balanced

Comment thread scripts/icp-network-start Resolved
The start script also recreates the default install arguments after
the mocks are deployed, so they hold the URL of the price feed mock.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The cross-cutting network migration needs human review backed by successful bootstrap, upgrade, and browser-test validation.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Add regression tests for latest-list initialization and preservation

rs/​sns_aggregator/​src/​state.rs:295

Please add a regression test for creating the empty latest-list asset, including a check that calling setup with an existing nonempty latest list leaves it unchanged. The current state tests only exercise serialization, and the aggregator integration job in .github/workflows/build.yml is disabled, so neither the new zero-SNS initialization behavior nor its post-upgrade preservation behavior is currently verified.

2 resolved since last review

Review effort: Balanced

@yhabib

yhabib commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Not necessary. The asset insert calls the IC system API (time and certified data), so a native unit test traps. The e2e tests cover the empty list on the local network.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The network and authentication migration needs human integration validation, particularly with five end-to-end tests disabled and unresolved setup and deployment-summary issues.

2 open issues

Review effort: Balanced

Comment thread .github/workflows/deploy-to-app.yaml Resolved
Comment thread scripts/setup Resolved
icp canister link --force fails when the mappings file does not exist
yet, which broke every CI job that starts the network.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The network migration requires human validation, and interrupted neuron initialization still has an unresolved recovery defect.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread scripts/icp-network-start Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The PocketIC launcher migration requires integration validation of startup/restart behavior, controller impersonation, upgrade/downgrade tests, and Internet Identity e2e flows that could not be exercised in the review environment.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@artkorotkikh-dfinity artkorotkikh-dfinity left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • scripts/nns-dapp/upgrade-downgrade-test:39–48: This now reuses an existing development network, reinstalls nns-dapp, then stops the whole network and discards its state. Refuse pre-existing networks by default, require an explicit destructive opt-in, or run the test on a network it owns.

  • Optional — scripts/icp-network-start:52: If nns-dapp-local already exists while anonymous is selected, startup tries to create it again and fails. Reuse the existing identity before creating it.

The upgrade-downgrade test refuses a running local network, unless
the caller passes --reuse_network. CI passes the flag, because the
network action starts the network first. The test stops the network
only when it started it.

The network start script reuses the nns-dapp-local identity when it
exists and the default identity is anonymous.
Copilot AI balanced review requested due to automatic review settings November 3, 2026 16:10
@yhabib

yhabib commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Done. The test refuses a running network unless you pass --reuse_network, and it stops only the network it started. The start script reuses the identity.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The runtime, PocketIC bootstrap, and Internet Identity migration requires live startup, upgrade/downgrade, and retained E2E validation because static review cannot establish compatibility across these integration boundaries.

No open issues 🎉

Review effort: Balanced

…nance-dfx-icp-cli-migration-bb2c0e

# Conflicts:
#	config.json
Copilot AI balanced review requested due to automatic review settings November 3, 2026 20:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Reusing an already-running network on a fresh icp-cli home leaves the newly created nns-dapp-local identity unfunded, causing mock creation to fail with insufficient cycles.

1 open issue

Review effort: Balanced

Comment thread scripts/icp-network-start Resolved
icp-cli gives cycles to the identities that exist when the network
starts. An identity created later has none, so the start script could
not create the mock canisters on a network that ran already. The script
now transfers cycles from the anonymous identity when the balance of
the current identity is low.
Copilot AI balanced review requested due to automatic review settings November 3, 2026 20:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because setup behavior on initialization and upgrade lacks regression coverage for empty SNS state and preservation of existing latest assets, while the aggregator integration job is disabled.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

…i-migration-bb2c0e

# Conflicts:
#	.config/spellcheck.dic
Copilot AI balanced review requested due to automatic review settings November 4, 2026 07:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new initialization behavior lacks regression tests for an SNS-free state and preservation of an existing nonempty latest list after an upgrade, while the aggregator_test workflow job is disabled.

1 open issue

Review effort: Balanced

Comment thread rs/sns_aggregator/src/state.rs Resolved
Two unit tests check `State::setup`. One checks that a network without an
SNS gets an empty latest list. One checks that an upgrade keeps a list that
exists. The canister time and the certification call panic outside a
canister, so unit tests get a fixed time and skip the certification.
Copilot AI balanced review requested due to automatic review settings November 4, 2026 08:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The coupled launcher, PocketIC controller, staking, and Internet Identity migration requires live-network and fresh-network CI validation that source-only review cannot provide.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I didn't read most of this carefully, but I asked Claude to check this out, and it seems alright.

I'm assuming that the disabled tests will be re-enabled in the not too distant future, particularly, since they have TODOs.

This is a pretty large PR. I think a couple of PRs could have been split out:

  1. fixes to ./frontend
  2. fixes to sns_aggregator

I guess those would have been pretty small though, so splitting those out would not really make this much smaller. To be clear, I'm not asking you to split those out now. Just saying, maybe consider this in future PRs.

@yhabib
yhabib added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 99192a0 Nov 5, 2026
34 checks passed
@yhabib
yhabib deleted the governance-dfx-icp-cli-migration-bb2c0e branch November 5, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants