Repository navigation
Return 413 for storage quota and expose per-doc storage - #32
Draft
robertjamesprior wants to merge 1 commit into
Draft
robertjamesprior wants to merge 1 commit into
robertjamesprior wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
what this changes
Two things that cost real time when the account filled up, both on the API side.
storage is 413, not 403.
quotaExceeded(kind: "storage")returned403 quota_exceeded, which reads as a permissions problem: the first thing a caller does is check the key and retry, and neither can help. It is now413 storage_quota_exceededcarrying the bytes in use, the cap, the headroom left, and the one thing that reliably reclaims space, because there is no version-delete API and history is what fills the quota. The count caps stay 403, which is correct for them.the listing carries
storage_bytes.GET /api/v1/docs?scope=ownednow returns, per document, the current html plus every retained snapshot: the same bytes that count against the quota. Before this, the published skill told agents to fetch each document and add up versions by hand, so the cleanup pass was guesswork.The agent-facing skill (
lib/skill-content.ts, regenerated intoskills/just-html/SKILL.md) is updated to match: the limits table, the recovery section, and the sentence that said the listing has no storage-size field.testing
npx vitest run— 26 files, 212 tests pass, including 4 new ones inlib/docs/quota.test.tscovering the 413 shape, the headroom floor at zero, and the two caps that stay 403.npx tsc --noEmitclean.npm run gen:skillregenerated the published skill;npm run gen:specproduced no diff, so the openapi spec does not enumerate these error codes.not in this PR, and why
The rest of the list needs UI work or an app-level decision, so it belongs in its own changes:
POST /api/v1/docsignores a requested slug, so keying documents by org id only works as a lookup after the fact