Repository navigation
fix(workspace-source): read apply and plan bodies past 10 MiB, refuse oversized ones locally - #10541
Conversation
… oversized ones locally
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
All reported issues were addressed across 21 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryWorkspace source apply and plan requests now bypass the 10 MiB proxy buffer and use their 58 MB body cap.
Both earlier, unnumbered findings are addressed: large bodies are bounded before parsing, and oversized
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
A workspace source apply or status over 10 MiB got a bare 413.
POST /api/v2/workspaces/{id}/sourceand/source/plandeclared a 58 MB body cap (WORKSPACE_SOURCE_REQUEST_MAX_BYTES), butapps/sim/proxy.tsmatched them. Next therefore buffered the body at its 10 MiB proxy limit, and the route clamped its cap to match. A rows file of a few thousand rows (well undermaxRowsBytes, 16 MB) is resent on every apply. So after one large table, every later apply, including one that only edits a workflow, answered "Request body is too large".bypassesProxy, so their own 58 MB cap is the one in force. The blob staging routes stay proxied, by design. The proxy only sets CORS headers on/api, so the two routes lose nothing for their callers: the CLI and same-origin requests.--topromotion or a status. Over the cap, it refuses withSOURCE_TOO_LARGE(exit 7) and names the bytes each folder carries and the--onlysplit to use. Status now also counts the whole body when it decides whether it can send every workflow folder whole. It falls back to sending unchanged folders by their base, as it already does past the workflow budget.workspaces source checkskipped a table whose declaration does not read. The table codec's own findings were dropped (if (!decl) continue), so an option listed twice or an unsupported currency code passed check clean, and that table's rows file went unchecked. Check now reports each declaration finding at its file and line.declaredKeyswas implemented twice (sim-cli and@sim/workspace-code/promote). It now lives once in@sim/workspace-code/kinds/registry. It takes an optionalpathsargument, so promotion still counts the blob paths.Not changed
Tests
Each of these failed on the pre-fix code, with that guard reverted, and passes now:
proxy.test.ts: Next's own matcher leaves/sourceand/source/planunbuffered and still runs for/source/blobs*.--dryand--yes): a body over the cap exits 7 before any request or blob staging, naming bytes by folder and the--onlysplit.Risks
defineV2JsonRoutegainsreserveBody, a hold that is released however the request ends.Type of Change
Testing
proxy.test.ts, source and plan route tests, sim-cli suite (1335), workspace-code suite (164),test:scriptsbun run lint,bun run type-check(apps/sim, sim-cli, workspace-code),bun run check:audits(only a local knip miss on the gitignored, unbuiltapps/docs/.content),bun run generate(no drift)Checklist
test-auditauthoring gate)