Archiving an environment deletes its golden

Merged
SA
1mo ago
+19-1

environment.archive only stamped archivedAt, so the golden behind a promoted environment (a stopped persistent sandbox whose snapshot never expires, ~4 GB at $0.08/GB-month) stayed on Vercel forever. The release already deletes the golden it replaces (#7548); archive now deletes the environment's golden the same way, via deleteSandbox with orphan snapshots, when the environment is fork-backed. Image-backed environments have no golden and are untouched.

Context and the measured numbers are on SUPER-2461. Before this, our sandbox project held 10 goldens of which 9 were dead plus 6 orphan snapshots from before the orphan-cleanup flag; those 54 GB were swept by hand today.

Verified: trpc typecheck clean. The prod check after deploy: promote a throwaway box, archive the environment, confirm the env-… sandbox is gone from Sandbox.list.

https://claude.ai/code/session_01RL946q6aRucLVJs659sW24


Summary by cubic

Archiving an environment now deletes its golden so its storage stops billing, matching how the release already deletes the golden it replaces. Previously archive only stamped archivedAt; a golden is a stopped persistent sandbox whose never-expiring snapshot (~4 GB at $0.08/GB-month) would bill forever. Archiving deletes it via deleteSandbox with orphan snapshots, but only when the environment is fork-backed — image-backed environments have no golden and are untouched.

  • Adds a note to docs/cloud-sandbox-considerations.md recording the fixed lifetime behavior and the measured pre-fix storage (10 goldens of which 9 were dead plus 6 orphan snapshots, 54 GB) from SUPER-2461.

Summary by CodeRabbit

  • Bug Fixes

    • Archiving a forked environment now deletes its sandbox. Image-backed environments remain unaffected.
  • Documentation

    • Updated guidance to clarify that archiving an environment deletes its golden, document orphaned storage measurements and the pending per-environment storage display, and note that automatic rebuilding will be required if goldens gain an expiry.