Repository navigation
fix(upload): ISO-only date inference; an all-failed upload is an error (#123) - #124
Merged
Merged
Conversation
#123) - Root cause: the browser inferred timestamptz for anything new Date() parses (e.g. "27 Oct 26"); the API accepts only ISO, so every row failed. inferCell now infers date/timestamptz only for real ISO values. - When every row fails, the upload is an error: the transaction is rolled back (no table, no registry row, an overwrite is undone). - Partial failures: warning toast, and the Migrated files list and Preview show "N of M rows failed". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019YPoXzBSj89ZHgw7nfTmbB
Owner
Author
|
Product owner decision, 27 Oct 2026: keeping row errors on the server is moved to ART M3 (#107, scope comment added there). It isn't part of this PR. Generated by Claude Code |
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.
Fixes #123. Relates to BR-34. Built on the product owner's go-ahead on 27 Oct 2026.
Root cause
Transactions (3).csvhas dates like "27 Oct 26" in Date and Processed On.inferCellmarked a value astimestamptzwhenevernew Date()could parse it, so it senttimestamptzfor both columns.cast_valueaccepts only ISO dates, so it rejected the Date value in every row: 171 of 171 failed.What changes
csv-preview.ts)dateandtimestamptzare inferred only for ISO values the API accepts. Impossible dates such as 2026-02-30 are no longer inferred as dates. "27 Oct 26" now imports as text.dynamic_loader.py)status: "error"with the first problem in the message, for exampleNone of the 171 rows could be imported, so nothing was saved. First problem: row 1, column "date": …, and the row errors. Nothing is saved: the new table and the registry row are rolled back, and an overwrite leaves the previous upload in place.Correction to the issue text
#123 says nothing on the page reported the failures. The upload's own job card did show "0 of 171 rows imported · 171 failed", and its error report could be downloaded from Import history. But it came with a success toast, and the Migrated files list showed nothing. Both are fixed here.
Decision for the product owner
Keeping row errors on the server isn't in this PR. The row errors are kept in the browser's Import history, where the error report can be downloaded, but not in the database. Storing them server-side needs a migration and somewhere to show them. Recommendation: leave it until a user needs it from another browser. #123's "Done when" doesn't depend on it.
Checks
Local CI replica: 311 passed, 0 failed, 0 skipped (it was 308). Evals 26/26.
New tests in
tests/test_failed_uploads.py:Frontend: vitest 131 passed (it was 126). The tests cover "27 Oct 26" staying text, ISO timestamps still inferred, impossible dates not inferred, the partial-failure warning, and
failedRowsNote.Mutation checks:
conn.rollback()The last result is expected: the connection pool already rolls back an uncommitted transaction. The explicit rollback is kept as a guard and to state the intent.
Also:
tscexit 0, production build OK,make lintexit 0.Done when
Transactions (3).csvon the dev machine and attaches a screenshot to Upload with every row rejected is shown as migrated (171 of 171 rows failed, no warning) #123 showing 171 rows imported.Generated by Claude Code