Skip to content

feat(dfx-orbit,wallet): support --wasm-memory-persistence for external canister upgrades#642

Closed
aterga wants to merge 1 commit into
mainfrom
claude/wasm-memory-persistence-orbit-6ad9rg
Closed

feat(dfx-orbit,wallet): support --wasm-memory-persistence for external canister upgrades#642
aterga wants to merge 1 commit into
mainfrom
claude/wasm-memory-persistence-orbit-6ad9rg

Conversation

@aterga

@aterga aterga commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

The station API gained a wasm_memory_persistence upgrade option in #634, but the two clients that create ChangeExternalCanister requests — the dfx-orbit CLI and the wallet Install screen — did not expose it (#634 explicitly left this as a follow-up). This PR wires it through both, along with its sibling skip_pre_upgrade, which live in the same CanisterInstallMode::upgrade options record.

wasm_memory_persistence = keep is required for Motoko canisters that use Enhanced Orthogonal Persistence; without it the IC clears their main memory on upgrade. skip_pre_upgrade is useful for recovery upgrades where the existing pre_upgrade hook traps.

What changed

dfx-orbit CLI (tools/dfx-orbit)

  • request canister install --mode upgrade gains --wasm-memory-persistence <keep|replace> and --skip-pre-upgrade.
  • Both flags are only valid with --mode upgrade; combining them with install/reinstall is rejected with a clear error.
  • When neither flag is set the request is built as Upgrade(None), so it is byte-for-byte identical to a request created without the feature (backward compatible).
  • verify now compares the full upgrade options (not just the coarse install mode), and the change-operation display prints the persistence mode / skip flag when present.
  • README documents the new flags; the install integration-test struct literal is updated for the new fields.

Wallet Install screen (apps/wallet)

  • When the Upgrade mode is selected, the form shows a Wasm memory persistence select (Keep / Replace, clearable) and a Skip pre-upgrade hook checkbox, both wired into CanisterInstallMode.upgrade.
  • Options collapse back to { upgrade: [] } when unset, matching the CLI's Upgrade(None).
  • The mode select normalizes the upgrade variant so it stays selected once options are attached (Vuetify matches items by deep equality).
  • The candid variant is inlined in the generated bindings, so a small WasmMemoryPersistence type alias is added to types/station.types.ts (validated wherever it is assigned into a CanisterInstallMode).
  • Locale strings added for en / fr / pt.

Test plan

  • apps/wallet: vue-tsc --noEmit clean; vitest run466/466 tests pass (incl. new CanisterInstallForm cases covering show/hide, write-through, and collapse-on-clear); eslint + prettier clean.
  • tools/dfx-orbit: new unit tests for install-mode building/validation and install_modes_match; new integration test asserting the keep option round-trips through the station and that verify accepts it. rustfmt --check clean.
  • cargo build/test/clippy for the Rust crates were not run in the authoring environment — the sandbox's egress policy blocks a transitive git dependency (dfinity/response-verification). CI will exercise them.

Notes

  • Fully backward compatible: all new fields are optional and unset by default; existing requests and clients are unaffected.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TB34uukEX3a8qNTZi5HpH1


Generated by Claude Code

…l canister upgrades

Expose the wasm_memory_persistence upgrade option (added to the station API
in #634) on the two client surfaces that create ChangeExternalCanister
requests.

dfx-orbit CLI:
- `request canister install --mode upgrade` gains
  `--wasm-memory-persistence <keep|replace>` and `--skip-pre-upgrade`. Both
  are only valid with `--mode upgrade` and are rejected otherwise.
- When neither flag is set the request is built as Upgrade(None) so it matches
  requests created without the feature; `verify` now compares the full upgrade
  options and the change operation display shows them.
- Unit tests cover mode building/validation, plus an integration test that
  asserts the `keep` option round-trips through the station.

Wallet Install screen:
- The upgrade mode now shows a "Wasm memory persistence" select
  (keep/replace, clearable) and a "Skip pre-upgrade hook" checkbox, wired into
  the CanisterInstallMode.upgrade options.
- The options collapse back to `{ upgrade: [] }` when unset, matching the CLI,
  and the mode select stays selected once options are attached.
- Locale strings added for en/fr/pt; component and form tests added.

`keep` is required for Motoko canisters that use Enhanced Orthogonal
Persistence; without it the IC clears their main memory on upgrade.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TB34uukEX3a8qNTZi5HpH1
@aterga aterga closed this Jul 1, 2026
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