You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
takeCanisterSnapshot (with replaceSnapshot and uninstallCode), loadCanisterSnapshot, listCanisterSnapshots and deleteCanisterSnapshot, which call the management canister.
downloadCanisterSnapshot and uploadCanisterSnapshot, which use the PocketIC server's canister_snapshot_download/canister_snapshot_upload endpoints. snapshotDir is a path on the machine running the server, as in the Rust library.
sender defaults to the anonymous principal, as in canisterStatus. It must be a controller of the canister, except that listing and downloading are also allowed for principals that the canister's snapshotVisibility permits.
The test canister gains set_value/get_value. The tests check that state is restored, that a snapshot round-trips from one canister to another through download and upload, and that snapshotVisibility viewers can list and download but not delete.
Adds a canister snapshots guide. I checked by hand that snapshots round-trip between icp-cli 1.5.0 and PocketIC 16 in both directions: an icp canister snapshot download from a local network uploads and loads through PicJS, and a downloadCanisterSnapshot output uploads through icp canister snapshot upload.
Adds takeCanisterSnapshot, loadCanisterSnapshot, listCanisterSnapshots
and deleteCanisterSnapshot, and downloadCanisterSnapshot and
uploadCanisterSnapshot to transfer a snapshot through a directory on the
machine running the PocketIC server, as in the Rust library.
Adds canister snapshot management and download/upload support to PocketIC.
Changes:
Adds snapshot lifecycle APIs and types.
Implements Candid handling and transfer endpoints.
Extends the test canister and integration tests.
Blocking finding: The committed test_canister.wasm.gz lacks the new set_value and get_value methods, so snapshot tests will fail. Rebuild and commit the artifact.
The new replaceSnapshot branch for uploads is not exercised by the snapshot suite: the only upload call omits it, while replacement is tested only for takeCanisterSnapshot. Add an upload-replacement case that passes an existing snapshot ID and verifies the old snapshot is replaced, so the distinct REST encoding and server behavior are covered.
Correct snapshot documentation to exclude canister settings
packages/pic/src/pocket-ic.ts:748
Canister snapshots do not capture canister settings; loading one restores execution state while the target canister's settings remain in place. Describing settings as snapshot contents makes the public API documentation misleading and also conflicts with the guide's concrete contents list. Please limit this description to code and execution state/memory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #299
Adds canister snapshot support:
takeCanisterSnapshot(withreplaceSnapshotanduninstallCode),loadCanisterSnapshot,listCanisterSnapshotsanddeleteCanisterSnapshot, which call the management canister.downloadCanisterSnapshotanduploadCanisterSnapshot, which use the PocketIC server'scanister_snapshot_download/canister_snapshot_uploadendpoints.snapshotDiris a path on the machine running the server, as in the Rust library.senderdefaults to the anonymous principal, as incanisterStatus. It must be a controller of the canister, except that listing and downloading are also allowed for principals that the canister'ssnapshotVisibilitypermits.The test canister gains
set_value/get_value. The tests check that state is restored, that a snapshot round-trips from one canister to another through download and upload, and thatsnapshotVisibilityviewers can list and download but not delete.Adds a canister snapshots guide. I checked by hand that snapshots round-trip between icp-cli 1.5.0 and PocketIC 16 in both directions: an
icp canister snapshot downloadfrom a local network uploads and loads through PicJS, and adownloadCanisterSnapshotoutput uploads throughicp canister snapshot upload.🤖 Generated with Claude Code