fix(spreadsheet): reject out-of-union operation at the writer (audit P1-2 / row_delta recurrence guard)#506
Merged
Conversation
…P1-2 / row_delta recurrence guard) storeSpreadsheetEvent derived operationType as firstOp?.type || 'unknown' and inserted via eventData:any — so any op missing a .type wrote operation:'unknown', a value NOT in spreadsheetEvents.operation, which fails convex deploy schema validation and aborts ALL prod deploys (the row_delta P0 class). New single-source-of-truth SPREADSHEET_OPERATION_TYPES + isSpreadsheetOperationType; the writer now REJECTS any operation not in the schema union instead of silently inserting a deploy-breaker. Self-contained guard test (4/4) locks the set + rejects 'unknown'/undefined/etc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Demo: walkthrough of the surfaces this PR changed is available as a workflow artifact ( |
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.
Closes the seam that the P0 (#505) only papered over
#505 made the stray
row_deltadoc valid so prod could deploy again. This stops the class from recurring.storeSpreadsheetEventderivedoperationType = firstOp?.type || "unknown"and inserted viaeventData: any."unknown"is not inspreadsheetEvents.operation— so any op missing a.typewould write a document that failsconvex deployschema validation and aborts every prod deploy (the exact failure mode of the 6h outage).Fix
convex/tools/spreadsheetOperationTypes.ts(SPREADSHEET_OPERATION_TYPES+isSpreadsheetOperationType).|| "unknown"fallback)."unknown"/undefined/etc. are rejected. No_generated/codegen dependency.Why reject, not clamp
Legit callers pass Zod-validated ops, so the reject only fires on a genuine upstream bug — surfacing it loudly instead of poisoning prod. Make the failure mode impossible, not hidden.
Follow-ups (audit, separate)
convex deploy --dry-runschema-vs-data gate (catch the next drift on a PR, not in prod).v.unionfrom the shared const for a structural single source of truth.🤖 Generated with Claude Code