Repository navigation
fix(review): T&E review shows why the database rejected a row (#190) - #203
Merged
Merged
Conversation
T&E uploads stored an empty column-type list, so review fell back to text and returned errors: [] for rows a CHECK/FK/UNIQUE rejected. - te_loader returns the target's mapped column types, so review revalidates T&E values against them (unmapped types stay text). - review attaches the stored upload-time database reason as a "(database)" error on unedited T&E rows. - review table shows any error not tied to a column beside the row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011T6Wqi8yaiaYWUVH8C4QAY
The contract test still expected types: [] for T&E uploads. Update it, and the M4 test-case note that described the old "reviewed as text" limit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011T6Wqi8yaiaYWUVH8C4QAY
Owner
Author
|
CI failure on 3382641: Generated by Claude Code |
amar-python
marked this pull request as ready for review
November 9, 2026 04:12
amar-python
pushed a commit
that referenced
this pull request
Nov 9, 2026
#203 added test_te_review_shows_the_database_reason_a_row_was_rejected after this branch's catalogue was generated, so the new catalogue check failed once the two met. Regenerated with scripts/test_catalogue.py. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011T6Wqi8yaiaYWUVH8C4QAY
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 #190.
Summary
T&E uploads stored
column_types = [], so review treated every value as text. It returnederrors: []for rows the database rejected on a CHECK, FK or UNIQUE constraint.api/services/te_loader.py: returns the target table's mapped column types instead of[].record_uploadstores them, so review now type-checks T&E values against the target. Types the API can't check itself (uuid, enums, arrays) still review as text.api/services/review.py: for T&E uploads, the database's upload-time reason (stored inuploads.row_errors) is added to the row's errors as{"column": "(database)", ...}. It is dropped once the row has a cell edit, because the original rejection no longer describes the edited row.csv-table-hub-main/src/components/review-table.tsx: one line, so any error not tied to a column is shown beside the row. Before, only(beyond header)was shown, so the row said "Invalid" with no reason.Known limits (not fixed here)
main, per-row database errors give the row's position in the list of rows that passed the type check, not its CSV row (RV-F12: T&E row errors point to wrong source record numbers (survivor-list position) #189, fixed in fix: address 15 open issues — security, data integrity, tests, CI #202). If an earlier row fails the type check, the reason can land on the wrong row until fix: address 15 open issues — security, data integrity, tests, CI #202 merges. This PR doesn't touch that loop, so it shouldn't conflict with fix: address 15 open issues — security, data integrity, tests, CI #202.MAX_ROW_ERRORS_REPORTED, so rows past the cap show no database reason.Test plan
tests/test_review.py::test_te_review_shows_the_database_reason_a_row_was_rejected: uploads anorganisationsCSV with a badorg_type. Review returns the CHECK reason, and an edit clears it. Failed before the fix (errors: []).test_review.py,test_review_cases.py,test_te_loader_integration.py,test_preserved_uploads.py,test_failed_uploads.pypass against a local PostgreSQL 16 dev deploy. The dynamic-mode review tests still pass.unit or regression or security or snapshot) passes.review-table.test.tsxfor the(database)reason.Generated by Claude Code