Skip to content

feat(pic): support the remaining instance options - #318

Merged
marc0olo merged 2 commits into
mainfrom
feat/instance-options
Oct 2, 2026
Merged

marc0olo merged 2 commits into
mainfrom
feat/instance-options

Conversation

@marc0olo

@marc0olo marc0olo commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Closes #78
Closes #303

Adds the instance options of the Rust library that PicJS lacked:

  • ICP features bitcoin, dogecoin and canisterMigration, and bitcoindAddrs/dogecoindAddrs to connect regtest nodes.
  • initialTime (a Date or milliseconds, like setTime).
  • autoProgress, which creates the instance live. It shares a server field with the initial time, so combining the two throws. makeLive on such an instance now starts the HTTP gateway instead of failing with "Inconsistent state".
  • mainnetNnsSubnetId and logLevel (critical, error, warn, info, debug, trace). These are slog's level names, which the Rust library sends too; the server rejects warning.

bitcoindAddrs and dogecoindAddrs together are rejected: PocketIC 16 panics creating such an instance (AlreadyReg in its metrics registry), even if one list is empty, and PicJS would wait until the request times out. The Rust library doesn't guard against this.

New guide "Working with Bitcoin" (Bitcoin and Dogecoin, answering #78), plus the new features, initialTime and mainnetNnsSubnetId in the NNS guide, and logLevel and autoProgress in running-tests.

Verified: the new tests cover every option against the server (131 tests). The Bitcoin and Dogecoin guide was run end to end with regtest bitcoind 31.1 and dogecoind 1.14.9 in Docker: the canisters sync the mined blocks within seconds, with tick from the current time and with autoProgress. Starting at PocketIC's default time, they never sync, which is why the guide sets initialTime: new Date(). The CI tests don't run a node.

🤖 Generated with Claude Code

Adds the bitcoin, dogecoin and canisterMigration ICP features, bitcoindAddrs
and dogecoindAddrs, initialTime, autoProgress, mainnetNnsSubnetId and logLevel.

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.

Copilot review overview

🟢 Approval recommended

The options are consistently typed, encoded, tested against the server, and documented without identified correctness issues.

Review effort: Balanced
Findings: None

What changed in this PR

Adds the remaining PocketIC instance options and documents Bitcoin/Dogecoin regtest integration.

Changes:

  • Adds time, live-mode, logging, subnet, adapter, and ICP feature options.
  • Supports starting an HTTP gateway for instances created with auto-progress.
  • Adds integration tests and updated guides.
File Description
packages/​pic/​tests/​src/​instance-options.spec.ts Tests the new instance options.
packages/​pic/​src/​pocket-ic.ts Handles gateways for auto-progress instances.
packages/​pic/​src/​pocket-ic-types.ts Defines the new public options and features.
packages/​pic/​src/​pocket-ic-client-types.ts Encodes options for the PocketIC server.
docs/​src/​content/​docs/​guides/​working-with-the-nns.mdx Documents new NNS-related options.
docs/​src/​content/​docs/​guides/​working-with-bitcoin.mdx Adds Bitcoin and Dogecoin guidance.
docs/​src/​content/​docs/​guides/​running-tests.mdx Documents logging and auto-progress.
docs/​src/​content/​docs/​guides/​more-examples.mdx Adjusts sidebar ordering.
docs/​src/​content/​docs/​guides/​canister-snapshots.mdx Adjusts sidebar ordering.
docs/​src/​content/​docs/​guides/​canister-declarations.mdx Adjusts sidebar ordering.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@marc0olo
marc0olo marked this pull request as ready for review October 2, 2026 14:03
@marc0olo
marc0olo requested a review from a team as a code owner October 2, 2026 14:03
@marc0olo
marc0olo added this pull request to the merge queue Oct 2, 2026
Merged via the queue into main with commit e3804f1 Oct 2, 2026
16 checks passed
@marc0olo
marc0olo deleted the feat/instance-options branch October 2, 2026 15:01
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.

Support the remaining instance options How to test against btc subnet and canisters

3 participants