Uh oh!
There was an error while loading. Please reload this page.
fix(tables): coerce row values to column types on write instead of failing - #4761
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Unit tests cover coercion behavior; service test mocks include the new exports. Reviewed by Cursor Bugbot for commit 42dd8e2. Bugbot is set up for automated code reviews on this repo. Configure here. |
b737c39 to
fe6ea03CompareGreptile SummaryThis PR adds a coercion layer (
Confidence Score: 5/5Safe to merge — the coercion layer is additive and every write path is covered. The change is well-scoped: coercion is applied in-place before the existing validateRowAgainstSchema gate, so required-field enforcement and uniqueness checks are unchanged. Out-of-range epochs and invalid Date instances are correctly guarded via Number.isNaN(date.getTime()). The updateRowsByFilter split (pre-coerce patch, validate merged copy) is correctly handled, and the upsertRow reordering is logically sound. Test coverage for coercion is thorough. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Incoming row data] --> B[validateRowSize]
B -->|invalid| ERR1[Throw / return error]
B -->|valid| C[coerceRowToSchema]
C --> D[coerceRowValues — mutates data in-place]
D --> E{per column}
E -->|value already matches type| F[leave untouched]
E -->|coercible mismatch| G[apply coercion\ne.g. '1999' → 1999]
E -->|un-coercible + optional| H[set to null]
E -->|un-coercible + required| I[leave in-place for validator]
F & G & H & I --> J[validateRowAgainstSchema]
J -->|errors| ERR2[Throw / return error]
J -->|valid| K[unique constraint check]
K -->|violation| ERR3[Throw / return error]
K -->|ok| L[DB write]
Reviews (2): Last reviewed commit: "fix(tables): guard date coercion against..." | Re-trigger Greptile |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…rmalize Date to ISO
TheodoreSpeaks
commented
May 27, 2026
Addressed all three review findings in 4f72933:
Verified |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4f72933. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
TheodoreSpeaks
commented
May 27, 2026
Addressed the new finding in 42dd8e2:
The other three threads (bulk-update write, stale upsert |
TheodoreSpeaks
commented
May 27, 2026
@greptile review |

Summary
"unknown"for a numeric founding year) no longer fail the entire row write on a single off-type fieldcoerceRowToSchemaat the Tables write boundary — coerces each cell toward its column's declared type ("1999"→1999,12345→"12345","false"→false, epoch → ISO date), nulls un-coercible values on optional columns, and still fails loudly on required columnsvalidateRowAgainstSchemastays pure as the final gateType of Change
Testing
Added
coerceRowToSchemaunit coverage (8 cases). Fulllib/tablesuite passes (145 tests). Lint +check:api-validation:strictpass.Checklist