feat(pic): add IC spec drift detection and update canister settings#255
feat(pic): add IC spec drift detection and update canister settings#255nikosxenakis merged 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds automated drift detection for the IC management canister Candid spec and updates pic canister-settings handling to align with the newly pinned upstream spec snapshot.
Changes:
- Add a pinned upstream spec copy at
spec/ic.didand a script to diff it against upstream (scripts/check-spec-drift.sh). - Add a GitHub Actions workflow to run the drift check on a schedule / dispatch / as a reusable workflow, and gate
create-release-pr.ymlon it. - Extend PIC canister settings support with
snapshotVisibilityandlogMemoryLimit, plus corresponding IDL wiring.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/ic.did | Adds pinned management canister Candid spec snapshot for drift comparisons. |
| scripts/check-spec-drift.sh | Fetches upstream ic.did and diffs against the pinned copy; emits CI warning on drift. |
| .github/workflows/check-spec-drift.yml | Runs drift check weekly, on-demand, and as a reusable workflow. |
| .github/workflows/create-release-pr.yml | Adds drift check as a prerequisite job for release PR creation. |
| packages/pic/src/management-canister.ts | Adds IDL/types for snapshot_visibility and log_memory_limit in canister settings. |
| packages/pic/src/util/candid.ts | Adds optSnapshotVisibilityToIDL converter and exports SnapshotVisibility IDL type. |
| packages/pic/src/pocket-ic.ts | Plumbs new canister settings fields through create/update settings calls. |
| packages/pic/src/pocket-ic-types.ts | Exposes SnapshotVisibility, snapshotVisibility, and logMemoryLimit in public types. |
| package.json | Bumps dev dependencies (@icp-sdk/bindgen, @types/node, vitest). |
| pnpm-lock.yaml | Lockfile updates reflecting the dependency bumps. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/pic/src/management-canister.ts:65
- The pinned spec (spec/ic.did) defines
definite_canister_settingswith additional fields (controller,snapshot_visibility,log_memory_limit) compared to theDefiniteCanisterSettingsIDL/type in this module. If the intent is to keepmanagement-canister.tsaligned with the pinned upstream spec, please update theDefiniteCanisterSettings(and any relatedcanister_statusresponse types) to include these fields (or explicitly document that this module intentionally models a subset).
const SnapshotVisibility = IDL.Variant({
controllers: IDL.Null,
public: IDL.Null,
allowed_viewers: IDL.Vec(IDL.Principal),
});
export type SnapshotVisibility =
| { controllers: null }
| { public: null }
| { allowed_viewers: Principal[] };
export interface CanisterSettings {
controllers: [] | [Principal[]];
compute_allocation: [] | [bigint];
memory_allocation: [] | [bigint];
freezing_threshold: [] | [bigint];
reserved_cycles_limit: [] | [bigint];
log_visibility: [] | [LogVisibility];
snapshot_visibility: [] | [SnapshotVisibility];
log_memory_limit: [] | [bigint];
wasm_memory_limit: [] | [bigint];
wasm_memory_threshold: [] | [bigint];
environment_variables: [] | [EnvironmentVariable[]];
}
export const CanisterSettings = IDL.Record({
controllers: IDL.Opt(IDL.Vec(IDL.Principal)),
compute_allocation: IDL.Opt(IDL.Nat),
memory_allocation: IDL.Opt(IDL.Nat),
freezing_threshold: IDL.Opt(IDL.Nat),
reserved_cycles_limit: IDL.Opt(IDL.Nat),
log_visibility: IDL.Opt(LogVisibility),
snapshot_visibility: IDL.Opt(SnapshotVisibility),
log_memory_limit: IDL.Opt(IDL.Nat),
wasm_memory_limit: IDL.Opt(IDL.Nat),
wasm_memory_threshold: IDL.Opt(IDL.Nat),
environment_variables: IDL.Opt(IDL.Vec(EnvironmentVariable)),
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR pins the upstream IC management canister Candid spec into the repo and adds automation to detect upstream spec drift, while also extending pic canister settings support to include snapshot visibility and log memory limits.
Changes:
- Added a pinned upstream management canister spec at
spec/ic.did. - Added CI + a script to check for upstream spec drift on a schedule, manually, and as part of the release PR workflow.
- Extended
piccanister settings encoding/types to supportsnapshotVisibilityandlogMemoryLimit.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
spec/ic.did |
Adds a pinned copy of the upstream management canister spec for drift comparisons. |
scripts/check-spec-drift.sh |
Fetches upstream ic.did, diffs against pinned copy, emits actionable output + CI warning. |
.github/workflows/check-spec-drift.yml |
Runs the drift check weekly, on dispatch, and as a reusable workflow. |
.github/workflows/create-release-pr.yml |
Makes spec drift check a prerequisite job for release PR creation. |
packages/pic/src/util/candid.ts |
Adds SnapshotVisibility (PIC↔IDL) conversion helpers. |
packages/pic/src/pocket-ic.ts |
Includes snapshot_visibility and log_memory_limit when creating/updating canisters. |
packages/pic/src/pocket-ic-types.ts |
Exposes SnapshotVisibility and new canister settings fields in public types/docs. |
packages/pic/src/management-canister.ts |
Updates management canister settings IDL/types to include new fields. |
package.json / pnpm-lock.yaml / bun.lock |
Bumps dev tooling dependencies (bindgen/types/vitest) and updates lockfiles accordingly. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR adds an automated mechanism to detect upstream drift in the IC management canister spec and updates PocketIC canister settings support to include newly added management-canister fields (notably snapshot visibility and log memory limit).
Changes:
- Add a pinned upstream management canister spec (
spec/ic.did) plus a CI/scripted drift check that compares againstdfinity/ic. - Extend PocketIC canister settings APIs and IDL encoding to support
snapshotVisibilityandlogMemoryLimit. - Bump dev tooling dependencies (bindgen, Node types, Vitest) and refresh lockfiles.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| spec/ic.did | Adds the pinned upstream management canister Candid spec used for drift detection. |
| scripts/check-spec-drift.sh | Script to fetch upstream ic.did and diff against the pinned spec, emitting actionable output/warnings. |
| .github/workflows/check-spec-drift.yml | New scheduled/manual/reusable workflow to run the drift check in CI. |
| .github/workflows/create-release-pr.yml | Runs spec drift check as a prerequisite job for release PR creation. |
| packages/pic/src/management-canister.ts | Updates canister settings IDL/types to include snapshot visibility and log memory limit. |
| packages/pic/src/util/candid.ts | Adds PIC↔IDL conversion helpers for snapshot visibility and re-exports the new IDL type. |
| packages/pic/src/pocket-ic-types.ts | Extends public PocketIC types to surface snapshotVisibility/logMemoryLimit as settings inputs and clarifies status is a subset. |
| packages/pic/src/pocket-ic.ts | Wires new settings fields through createCanister/updateCanisterSettings payload encoding. |
| packages/pic/tests/src/pocket-ic.spec.ts | Extends settings update test to exercise the new options (ensuring requests accept them). |
| package.json | Bumps devDependencies (@icp-sdk/bindgen, @types/node, vitest). |
| pnpm-lock.yaml | Lockfile refresh for updated devDependencies. |
| bun.lock | Lockfile refresh aligned with updated dependencies. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Vivienne Siffert <vivienne.siffert@dfinity.org>
Motivation
The IC management canister interface (
ic.did) evolves upstream indfinity/ic, butpic-jsmaintains hand-written IDL definitions inmanagement-canister.ts. When the spec changes, we only discover it manually.SDK-2624
Summary
spec/ic.didmanagement-canister.tsto match the latest upstream.scripts/check-spec-drift.shthat fetches the latest upstream spec and diffs it against the pinned copy, outputting actionable instructions on drift.github/workflows/check-spec-drift.ymlrunning weekly on Sundays, on manual dispatch, and as a prerequisite increate-release-pr.yml