Skip to content

Validate snapshot retention count - #200

Open
scotttrinh wants to merge 1 commit into
mainfrom
fix/snapshot-retention-count
Open

Validate snapshot retention count#200
scotttrinh wants to merge 1 commit into
mainfrom
fix/snapshot-retention-count

Conversation

@scotttrinh

@scotttrinh scotttrinh commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

SnapshotRetention.count is documented as accepting values from 1 through 100, even though the Sandbox API only supports integers from 1 through 10. Because the model does not currently validate this field, unsupported values can be accepted and serialized into API requests.

This change corrects the documented range and adds Pydantic field constraints so counts outside 1 through 10 are rejected during model construction. It also adds focused boundary coverage for the minimum and maximum valid values and the adjacent invalid values.

Closes #199

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
vercel-py Ready Ready Preview Jul 29, 2026 6:08pm

Request Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Aligns SnapshotRetention.count validation with the Sandbox API’s supported range (1–10) so invalid retention counts are rejected early (during model construction) instead of being serialized into requests.

Changes:

  • Update SnapshotRetention documentation to reflect the correct supported range (1–10).
  • Add Pydantic field constraints to enforce count ∈ [1, 10].
  • Add boundary-focused tests covering valid (1, 10) and invalid (0, 11) values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/vercel-sandbox/vercel/sandbox/_internal/models.py Tightens SnapshotRetention.count with Field(ge=1, le=10) and updates the documented range.
src/vercel-sandbox/tests/test_sandbox_snapshot.py Adds boundary tests ensuring out-of-range counts raise during model construction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Validate snapshot retention count

2 participants