Validate snapshot retention count - #200
Open
scotttrinh wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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
SnapshotRetentiondocumentation 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.
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.
SnapshotRetention.countis 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