Repository navigation
fix: include column and row context in bulk load errors - #1827
arthurschreiber merged 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1827 +/- ##
==========================================
+ Coverage 83.88% 83.90% +0.02%
==========================================
Files 96 96
Lines 4728 4735 +7
Branches 888 889 +1
==========================================
+ Hits 3966 3973 +7
Misses 509 509
Partials 253 253 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
arthurschreiber
left a comment
There was a problem hiding this comment.
Thanks, this follows the existing InputError convention nicely. The main suggestion is to add the row index, as the TVP path already does, since the column name alone doesn't help much on large loads. A null row still fails with a context-free error, and one integration test lost its cause check. The rest are small test and style points.
Generated by Claude Code
cheenamalhotra
left a comment
There was a problem hiding this comment.
A few things worth addressing:
-
Breaking change for error matching. Bulk load validation errors now have a different message (
Column 'x' could not be validated at row index Ninstead of e.g.Invalid date.), and serialization errors gainat row index N. Code matching onerr.messagewill break. Since release notes come from the squash commit, consider adding a footer so it's flagged:BREAKING CHANGE: Bulk load validation and serialization errors are now `InputError`s with messages like "Column 'x' could not be validated at row index N". The original error is in `err.cause`. Rows that are not arrays or objects now throw instead of loading as NULLs.@arthurschreiber — would you treat this as breaking, or just call it out in the notes?
-
Rows that aren't objects now fail. A string or number row used to load silently as all NULLs. Good fix, but it's a behavior change. Please add a test with a primitive row (e.g.
'abc',42). -
Sensitive value claim.
writeDecimal(src/data-types/decimal-common.ts) throwsValue ${value} is out of range..., which ends up incause. Either drop the value from that message or adjust the claim in the description. -
Description is out of date. It doesn't mention the row index or the new row check. Please update the examples and the Compatibility section.
arthurschreiber
left a comment
There was a problem hiding this comment.
Thanks for addressing the earlier round. Two things block merging now:
- The branch conflicts with
masterintest/unit/bulk-load-test.ts. - Once that conflict is resolved, a unit test added in #1817 fails because the "could not be serialized" message now has the row index suffix (details inline).
The description is also out of date. It still shows the messages without at row index N, and it doesn't mention the new row check or the change to the serialization message. Could you update it along with the rebase?
The remaining inline comments are about the row guard, the "without exposing the value" test, and the single try block.
Generated by Claude Code
c40450b to
6eb4b39
Compare
|
🎉 This PR is included in version 20.3.10 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Bulk-load errors did not identify which column or row contained an invalid value. With many columns and rows, a generic validation error such as
Invalid date.made the failing input difficult to locate.Changes
InputErrorthat identifies the column and zero-based row index. Preserve the original validator error ascause.InputErroridentifying the zero-based row index.For example, a validation error is now reported as:
A serialization error is reported as:
Compatibility
Invalid date.) toColumn '<name>' could not be validated at row index N.at row index N; code matching the previous exact message may need updating.err.cause.InputErrorextendsTypeError, soinstanceof TypeErrorchecks continue to work. Validator failures that were previously other error classes, such asSyntaxError, are now surfaced as anInputErrorwith that original error ascause.NULLvalues.cause, and its message may contain the value.Tests
TypeErrorvalidator failures, and invalid primitive rows.Breaking change note
Bulk-load validation and row-value serialization errors now have different top-level messages and are wrapped in
InputError; consumers matching exact error messages may need to update. The original error is available inerr.cause. Rows that are not arrays or objects now throw instead of being loaded asNULLrows.