feat(vercel-sandbox,sandbox): introduce keepLast parameters for SDK/CLI#193
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- sandbox.test.ts: wrap the new clear-keepLastSnapshots test in try/finally so the persistent sandbox is deleted on success and failure, matching the surrounding tests. - validators.ts: make keepLastSnapshots.deleteEvicted optional to match the input types and the SDK getter. - sandbox.ts: align getter type with the validator. - config.ts: only render delete-evicted-snapshots=... in formatKeepLastSnapshots when the field is set, matching the success message behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace the single `sandbox config keep-last-snapshots` command (which used flags for expiration and delete-evicted behavior) with three subcommands: - `keep-last-snapshots <name> <count>` — count, 0 clears the policy - `keep-last-snapshots-for <name> <duration|none>` — expiration - `delete-evicted-snapshots <name> <true|false>` — eviction behavior The two new subcommands fetch the existing policy and merge to preserve unrelated fields. They error if no policy is set yet.
QuiiBz
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-apply #164, which was closed.
CLI
sandbox createaccepts retention policy flags. By default, evicted snapshots are deleted immediately; pass--delete-evicted-snapshots falseto let them fall back to the sandbox's default expiration instead.The
sandbox configcommand exposes one subcommand per retention field. The two modifier subcommands (keep-last-snapshots-for,delete-evicted-snapshots) require an existing policy.sandbox config listincludes a new "Keep last snapshots" row:SDK
Sandbox.createandSandbox.updateaccept a new optionalkeepLastSnapshotsfield.On
Sandbox.update, passnullto remove the policy: