feat(sdk): add name filter to snapshot list#1523
Conversation
Add an optional `name` filter to `Sandbox.listSnapshots()` / `Sandbox.list_snapshots()`, mirroring the infra snapshots list endpoint (e2b-dev/infra#3184). The filter accepts a snapshot name or ID, optionally tag-qualified (e.g. "my-snapshot", "my-team/my-snapshot" or "my-snapshot:v1"); unknown names return an empty list. Applied equivalently across the spec, JS SDK, and Python sync + async SDKs, with tests and a changeset. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 7b4420e The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
PR SummaryLow Risk Overview The Reviewed by Cursor Bugbot for commit 7b4420e. Bugbot is set up for automated code reviews on this repo. Configure here. |
Package ArtifactsBuilt from b6eb227. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.31.1-yokohama.0.tgzCLI ( npm install ./e2b-cli-2.13.1-yokohama.0.tgzPython SDK ( pip install ./e2b-2.30.0+yokohama-py3-none-any.whl |
Align Sandbox.listSnapshots() / Sandbox.list_snapshots() with Sandbox.list(): snapshot filters (sandboxId + the new name filter) now live inside a `query` object (JS) / SnapshotQuery (Python) instead of flat top-level params. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Snapshots can be filtered by source sandbox ID or by name, but not both at once. JS enforces this via a discriminated union on the query object; Python raises ValueError in SnapshotQuery when both are set. The instance list_snapshots() filters by its own sandbox id only (no name). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Moving the released `sandboxId` snapshot filter into a query object was a breaking change, so revert to flat top-level `sandboxId` / `name` options. Mutual exclusivity is kept via a runtime guard (JS throws, Python raises ValueError) instead of a query type, dropping the `never` union and the SnapshotQuery dataclass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1c65bc2. Configure here.
The backend combines the /snapshots `sandboxID` and `name` query params with AND, so drop the client-side mutual-exclusivity guard and let both filters be used together, mirroring the API (and the metadata+state combination in Sandbox.list). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Run `make codegen` so the generated JS schema and Python client match the spec. Move the `name` param description under `schema` (matching `sandboxID`) so it surfaces in the generated Python docstring. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ible `list_snapshots` is already released with `(limit, next_token)` positional params. Append the new `name` filter after them (instead of before) so a positional call like `list_snapshots(50)` still binds `limit`, avoiding a silent breaking change. Addresses PR review feedback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Adds an optional
namefilter toSandbox.listSnapshots()/Sandbox.list_snapshots(), mirroring the infra snapshots list endpoint (e2b-dev/infra#3184). The filter accepts a snapshot name or ID, optionally tag-qualified (e.g."my-snapshot","my-team/my-snapshot"or"my-snapshot:v1"); unknown names return an empty list. It's a flat top-level option alongside the existingsandboxIdfilter (non-breaking) and can be combined with it — the backend applies both with AND, matching themetadata+statebehavior ofSandbox.list(). Applied equivalently across the OpenAPI spec, generated clients, and the JS + Python sync/async SDKs, with tests and a changeset.Usage
🤖 Generated with Claude Code