Store: Inside a Heap Migration Open the saved V1 root Business revision two is running on schema one. The test sets a flag in the root to make the first conversion trap after it has processed the children. Then it asks the canister to install code that needs schema two. This build carries the exact V1 contract as an accepted source. The saved Catalog matches that source, so the candidate can open the old root with its V1 type. The V2 card tells us what it will publish after restore. Convert each owner's cell The root converter builds its V2 fields from V1. It adds a field set to nine hundred and moves the vector into the new cell. The backing buffer stays at the same address. For its first child, the root takes the attachment at key seven and passes the ticket to the leaf's converter. The leaf adds seven hundred in its own record and moves its owning reference to the same byte buffer. The root attaches the returned leaf at key seven. The branch converts its own fields and adds eight hundred. It delegates its leaf to the same leaf converter, then attaches that result. When the root attaches the branch again, every converted path leads back to the same actor. Return to the prior app With the children attached, the root converter checks the flag it carried from V1 and traps. The IC rolls back the upgrade. Business revision two resumes on schema one, with the same payload and addresses as before the attempt. The test enters through the old code and appends nine more integers. The new values become part of the V1 state. The test clears the failure flag and tries the V2 upgrade again. Finish the upgrade and write through it The converters finish this time. Restore renews the leaf alias and saves a new App bound to the V2 tree. Then it writes the V2 fingerprint. When the upgrade succeeds, the IC makes the new code and state visible together. Both payload buffers kept their addresses through conversion. The runner reads schema two. Business reads one again because this build uses the original business code. The old payloads are intact, and the root and leaf have their new fields. Another append takes the root vector to four hundred and twelve items.