Skip to content

feat(sandbox): make reset the image-upgrade path - #211

Merged
quickbeard merged 1 commit into
mainfrom
feat/sandbox-image-upgrade
Aug 13, 2026
Merged

quickbeard merged 1 commit into
mainfrom
feat/sandbox-image-upgrade

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Phase 4b, item 2 — closes the gap found in the macOS in-app e2e: vz reset deliberately re-cloned the pristine disk without ever re-resolving the manifest, so publishing a new image reached nobody without Delete + re-Add.

Design

Each sandbox records the asset it was provisioned from (image.json in its data dir — url/sha256/bytes, unreadable ⇒ treated as unknown ⇒ re-provision, the safe direction). Then per backend:

  • vz: reset re-resolves the manifest. Marker match → the fast path is unchanged (re-clone the pristine disk, no network beyond the manifest fetch). Mismatch → full re-provision (stage → unpack → verify → fresh clone) and marker update. create skips the unpack when current.
  • WSL: create/prepare on a registered distro with a stale marker terminates, unregisters, and re-imports from the current rootfs — an import cannot overlay an existing distribution. (reset was already discard+prepare and picked up new images.)
  • bwrap: reset already re-provisioned by construction (the rootfs is the guest state); create now skips the unpack when the rootfs is intact and the marker current.

Net effect: Reset in the UI is now also "Update" — pristine sandbox on whatever image the manifest currently points at — with no new UI, IPC, or state plumbing. A visible "update available" indicator can come later on top of the same markers.

Tests

  • Marker round-trip + garbage-tolerance in image.test.ts
  • vz: create → reset (same image: no new download, disk re-cloned) → manifest flip → reset (re-provisions to the new disk), asserted via a download counter on the test server
  • WSL: stale marker forces exactly one extra import, counted by the fake wsl.exe
  • Suite 79 pass / 2 skip; live vz e2e regression green (health / path api / broker all OK)

CHANGELOG entry added. Fork-only files, no DIVERGENCES change.

🤖 Generated with Claude Code

Each sandbox records the image it was provisioned from (image.json
beside its data). vz reset now re-resolves the manifest: marker match
keeps the fast pristine-disk re-clone, mismatch re-provisions from the
current image — previously the only upgrade was delete + re-create,
since reset deliberately never re-resolved. WSL create rebuilds a
registered distro whose marker is stale (an import cannot overlay an
existing distribution), and bwrap create skips the unpack when the
rootfs is intact and current.

Verified: vz e2e still green (health/path/broker OK); new tests cover
the marker round-trip, vz reset-as-upgrade with a download counter, and
the WSL stale-marker rebuild via an import counter in the fake wsl.exe.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@quickbeard
quickbeard force-pushed the feat/sandbox-image-upgrade branch from 6091e8d to ad7a827 Compare August 13, 2026 04:08
@quickbeard
quickbeard merged commit d5d9b79 into main Aug 13, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the feat/sandbox-image-upgrade branch August 13, 2026 04:10
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.

1 participant