sandbox: Add snapshot list and metadata#71
Draft
scotttrinh wants to merge 5 commits intosandbox/better-error-hierarchyfrom
Draft
sandbox: Add snapshot list and metadata#71scotttrinh wants to merge 5 commits intosandbox/better-error-hierarchyfrom
scotttrinh wants to merge 5 commits intosandbox/better-error-hierarchyfrom
Conversation
Implement Task 1 from PY-166 by exposing snapshot creation timestamps, allowing omitted expiresAt values, and forwarding optional expiration values through sync and async sandbox snapshot creation. Add integration coverage for omitted request bodies, explicit expiration payloads including zero, public created_at access, and stopped sandbox state updates.
Add low-level snapshot listing support and typed sync/async page objects for snapshot pagination. Wire Snapshot.list() and AsyncSnapshot.list() through the shared pagination helpers and pin the behavior with integration coverage for filters, page traversal, and terminal-page handling.
Extend the snapshot example to cover expiration controls, listing, page and item iteration, and cleanup in both sync and async flows. Add example-backed tests for the new snapshot behavior, simplify list integration assertions to public fields, and tighten typing in the sandbox request and error helpers.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds snapshot listing support to the public vercel.sandbox API (sync + async), expands snapshot metadata surfaced to callers, and updates examples/tests to validate pagination and expiration behaviors.
Changes:
- Implement
Snapshot.list()/AsyncSnapshot.list()backed by a new internallist_snapshotsAPI call and snapshot pagination primitives. - Add snapshot
created_atmetadata and makeexpires_atoptional throughout the model + API surface. - Add
expirationsupport toSandbox.snapshot()/AsyncSandbox.snapshot()and update examples + tests accordingly.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_examples.py | Adds an example-level regression test using fakes to validate listing iteration + expiration handling. |
| tests/integration/test_sandbox_sync_async.py | Adds integration tests for snapshot listing pagination + snapshot creation request-body behavior and metadata fields. |
| src/vercel/sandbox/snapshot.py | Introduces snapshot listing APIs and exposes created_at; updates expires_at typing to optional. |
| src/vercel/sandbox/sandbox.py | Adds expiration parameter to snapshot creation and reuses shared timestamp normalization. |
| src/vercel/sandbox/page.py | Adds SnapshotPage, AsyncSnapshotPage, and AsyncSnapshotPager pagination helpers. |
| src/vercel/sandbox/models.py | Re-exports SnapshotsResponse. |
| src/vercel/sandbox/init.py | Exposes the new snapshot page types from the public package. |
| src/vercel/_internal/sandbox/pagination.py | Adds snapshot pagination params/info and centralizes normalize_list_timestamp. |
| src/vercel/_internal/sandbox/models.py | Makes Snapshot.expires_at optional and adds SnapshotsResponse. |
| src/vercel/_internal/sandbox/errors.py | Narrows APIError.data typing from Any to object. |
| src/vercel/_internal/sandbox/core.py | Adds list_snapshots, adds expiration to create_snapshot, and tightens request JSON/query typing. |
| examples/sandbox_11_snapshots.py | Updates snapshot example to demonstrate expiration, listing, and deletion of multiple snapshots. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This is forced by the server, so mirror that as a client invariant as well.
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.
No description provided.