Skip to content

fix(review): T&E review shows why the database rejected a row (#190) - #203

Merged
amar-python merged 2 commits into
mainfrom
claude/issue-190-te-review-errors
Nov 9, 2026
Merged

amar-python merged 2 commits into
mainfrom
claude/issue-190-te-review-errors

Conversation

@amar-python

Copy link
Copy Markdown
Owner

Fixes #190.

Summary

T&E uploads stored column_types = [], so review treated every value as text. It returned errors: [] 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_upload stores 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 in uploads.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)

Test plan

  • New tests/test_review.py::test_te_review_shows_the_database_reason_a_row_was_rejected: uploads an organisations CSV with a bad org_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.py pass against a local PostgreSQL 16 dev deploy. The dynamic-mode review tests still pass.
  • Free tier (unit or regression or security or snapshot) passes.
  • vitest 147/147, with a new assertion in review-table.test.tsx for the (database) reason.
  • CI integration job

Generated by Claude Code

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

Copy link
Copy Markdown
Owner Author

CI failure on 3382641: tests/test_api_coverage.py::TeUploadPipeline::test_response_shape_matches_contract still asserted types == [] for T&E uploads, which this PR intentionally changes. Not a flake. Fixed in the next commit by asserting one type per column, and the M4 test-case doc line about the old limit is updated. The other failing local runs (parity/environments) only need the staging/test/prod databases, which CI deploys.


Generated by Claude Code

@amar-python
amar-python marked this pull request as ready for review November 9, 2026 04:12
@amar-python
amar-python merged commit 7c2d645 into main Nov 9, 2026
3 checks passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RV-F13: T&E review displays invalid rows without validation errors (empty type list)

2 participants