Cotton code

UPGRADE PROOF

The owner's phone at an upgrade, on invented data. The core at an old sha, the build on the phone, fills a copy against a local personal object under wrangler dev. Then the core at HEAD opens that same copy and syncs it.

cd apps/business && pnpm -s exec tsx scripts/__tests__/upgrade-proof.ts # every case cd apps/business && pnpm -s exec tsx scripts/__tests__/upgrade-proof.ts words@head # HEAD plays the old side too

Adding a case in five lines

  1. To prove an existing app at another build, add { "app": "words", "sha": "<sha>" } to cases.json. That is the whole change.
  2. To add a new app, write upgrade_old_side_writes_a_<app>_copy_* in upgrade_writer.rs. Use only what every phone build since 24 Nov has: the app's own methods, personal.connect, seal.mintKey and seal.useKey, mint, rejected::park. Write the manifest.
  3. Write its HEAD side in upgrade_proof.rs: open, compare copy_state with the manifest, connect, seal.useKey, pass, compare again.
  4. Name both in WRITERS in upgrade-proof.ts, and add any object-side counts.
  5. Try it with <app>@head first, then add the old shas to cases.json.