Skip to content

Return 413 for storage quota and expose per-doc storage - #32

Draft
robertjamesprior wants to merge 1 commit into
mainfrom
hypeship/storage-quota-clarity
Draft

robertjamesprior wants to merge 1 commit into
mainfrom
hypeship/storage-quota-clarity

Conversation

@robertjamesprior

Copy link
Copy Markdown

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") returned 403 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 now 413 storage_quota_exceeded carrying 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=owned now 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 into skills/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 in lib/docs/quota.test.ts covering the 413 shape, the headroom floor at zero, and the two caps that stay 403.
  • npx tsc --noEmit clean.
  • npm run gen:skill regenerated the published skill; npm run gen:spec produced 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:

  • a private document's plain URL returns a 404 page rather than a "this is private" notice, and the dashboard's copy-link does not include the view token
  • the viewer loads about 650 KB of javascript for a 15 KB document; a no-js print path and a raw route that works for a private doc with a token would fix it
  • POST /api/v1/docs ignores a requested slug, so keying documents by org id only works as a lookup after the fact
  • retained history cannot be dropped in place; the only route is publishing the current html as a new document

@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
justhtml Ready Ready Preview Nov 9, 2026 8:58am UTC

This branch was successfully deployed

1 active deployment
Preview — faa5f4d9 Deployed Nov 9, 2026 by vercel[bot]
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.

1 participant