Skip to content

fix(deploy): record production's canister ids, and never create on mainnet - #15

Merged
b3hr4d merged 1 commit into
mainfrom
claude/project-thread-fp9vgu
Oct 27, 2026
Merged

b3hr4d merged 1 commit into
mainfrom
claude/project-thread-fp9vgu

Conversation

@b3hr4d

@b3hr4d b3hr4d commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

What

icp deploy -e production upgrades B3Note's mainnet canisters only on the machine that first deployed them. .gitignore left out all of .icp/, where icp-cli records each environment's canister ids, so from any other clone the same command finds no ids and creates new canisters. So does -e ic, icp-cli's built-in mainnet environment, which has none of B3Note's ids anywhere.

A new frontend is a new origin, so Internet Identity gives every user a new principal, and note.b3pay.net still points at the old canister.

Changes

  • .icp/data/mappings/production.ids.json: backend xeka7-ryaaa-aaaal-qb57a-cai, frontend 4lidq-zqaaa-aaaap-abkbq-cai. Written by icp canister link (icp-cli 1.6.0), so it is exactly what icp-cli writes.
  • .gitignore: ignore only .icp/cache/ (local network state), as icp-cli's docs advise and b3pay-hub does.
  • --no-create in the README's "Deploying to mainnet", icp.yaml's header comment and pnpm deploy:production, so a missing id stops the deploy instead of creating a canister. The README says why not to use -e ic.
  • frontend/tests/production.test.ts: the recorded ids must equal the ones origins.ts signs in for and calls.
  • Left as is: scripts/migrate-mainnet.sh still links both ids with --force before it reinstalls; with the file committed, that rewrites the same ids.

Evidence

  • Fact: on 2026-10-27, icp deploy frontend -e ic on main bc3d6b5 printed "Creating canisters: [frontend] ✘ failed to create canister: Insufficient cycles. Requested: 2000000000000 cycles, available balance: 1_481_753_760_859 cycles". With more than 2 T cycles on the deploying identity, it would have created a new frontend.
  • Fact (icp-cli 1.6.0, run on this branch): icp environment list prints ic, production and local. icp deploy --help lists --no-create: "If any canisters do not exist, error instead of creating them". icp canister link writes .icp/data/mappings/<env>.ids.json.
  • Fact (icp-cli's docs at v1.6.0): docs/concepts/project-model.md says to gitignore .icp/cache/ and to consider tracking .icp/data/, and docs/migration/from-dfx.md says .icp/data/ "should be committed to version control".
  • Fact (checked 2026-10-27): the live frontend's ic_env cookie lists PUBLIC_CANISTER_ID:backend=xeka7-ryaaa-aaaal-qb57a-cai and PUBLIC_CANISTER_ID:frontend=4lidq-zqaaa-aaaap-abkbq-cai, the ids recorded here.
  • Fact: in a scratch repo, git pull of this kind of change into a clone that already had the (until now ignored) file succeeded and left the committed copy in place.
  • pnpm format:check, pnpm typecheck and pnpm test (61 tests) pass. Four faults each failed the new test and were reverted: a wrong frontend id, a renamed canister, the file missing, and a different backend id in origins.ts.
  • Not run: any deploy. Nothing here touches mainnet.

Generated by Claude Code

…innet

`.gitignore` left out all of `.icp/`, so the mainnet canister ids lived only
on the machine that deployed. From any other clone, `icp deploy -e production`
finds no ids and creates new canisters. So does `-e ic`, icp-cli's built-in
mainnet environment, which is what happened on 2026-10-27: it stopped only
because the cycles balance was below the 2 T a creation asks for. A new
frontend is a new origin, which gives every user a new principal.

- Commit `.icp/data/mappings/production.ids.json`, written by
  `icp canister link` (icp-cli 1.6.0), and ignore only `.icp/cache/`, as
  icp-cli's docs advise and b3pay-hub does.
- Deploy with `--no-create` in the README, `icp.yaml`'s header and
  `pnpm deploy:production`, so a missing id stops the deploy, and say why
  not to use `-e ic`.
- `tests/production.test.ts` checks the recorded ids against `origins.ts`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017cSwEz3Q2o3DpuJ8qSQzY5
@b3hr4d b3hr4d self-assigned this Oct 27, 2026
@b3hr4d
b3hr4d merged commit 6312502 into main Oct 27, 2026
2 checks passed
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.

2 participants