Build a canister and keep its first record
Quickstart keeps a player’s score through an upgrade. Follow the score from its typed endpoint to private memory, then see how the PocketIC test verifies the upgrade.
A score belongs to one module
Quickstart is a small actor with four methods. Anyone can call get and count. The controller guard gates put and remove. In src/lib.rs, each endpoint calls the scores service through the actor root. The module owns a Map<u64, u32> in scores/memory/v1.rs, and root/memory/v1.rs attaches that exact version. Other code uses the service methods to work with scores. This keeps storage decisions inside their owner when you add other features.
The build guide produces quickstart.wasm alongside its Wire interface and build manifest. Use the prepared Wasm for install and upgrade. Its companion Wire schema tells the generated client how to encode requests and decode replies.
Check the record on both sides of the upgrade
The PocketIC lifecycle test verifies the manifest, installs with Wire-encoded arguments and starts with zero scores. It calls put(7, 99), reads back 99 and checks that removing missing player 8 returns false. Then it upgrades with wasm_memory_persistence = keep using the same prepared Wasm. It checks that the count is still one and player 7 still has 99. A final removal and read show the module can still write and return an absent value after the upgrade.
This fixture isolates the same-artifact lifecycle. For a release that changes a memory type, add a separate fixture seeded by the old build and assert what the conversion preserves in the new build.