Skip to content

sandbox: Add snapshot list and metadata#71

Draft
scotttrinh wants to merge 5 commits intosandbox/better-error-hierarchyfrom
sandbox/snapshot-parity
Draft

sandbox: Add snapshot list and metadata#71
scotttrinh wants to merge 5 commits intosandbox/better-error-hierarchyfrom
sandbox/snapshot-parity

Conversation

@scotttrinh
Copy link
Collaborator

No description provided.

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.
@scotttrinh scotttrinh requested a review from Copilot March 25, 2026 10:25
@vercel
Copy link

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vercel-py Ready Ready Preview Mar 25, 2026 10:49am

Request Review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 internal list_snapshots API call and snapshot pagination primitives.
  • Add snapshot created_at metadata and make expires_at optional throughout the model + API surface.
  • Add expiration support to Sandbox.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.
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.

2 participants