Skip to content

RV-F12: T&E row errors point to wrong source record numbers (survivor-list position) #189

Open

Description

@amar-python

What happened

External repo review at commit c7bebd1 reproduced: rows failing client-side casting are removed before DB insertion; DB errors then use the survivor-list position as the row number. Reproduced: invalid number in data row 1 and invalid foreign key in data row 2 both reported as row 1.

Code path: api/services/te_loader.py L273–290.

Why this matters

The error report tells the user "row 1 failed FK validation" when it was actually row 2. For a reviewer looking at a 10,000-row file, this makes the error report unusable — the row numbers in the error message don't match the row numbers in the source CSV.

Interacts with M4 review screen (#142 shipped) which displays row-level errors — review currently shows the wrong row for FK/CHECK failures.

Proposed

  1. Retain original CSV row number alongside each candidate throughout validation and batching.
  2. DB-error path reports the stored original row number, not the survivor-list position.
  3. Reproduction test: CSV with row 1 invalid number and row 2 invalid FK; error report must show "row 2 failed FK", not "row 1".

Done when

  • Reproduction test passes.
  • Review screen shows correct row numbers for both client-side casting failures and DB-side constraint failures.
  • Regression test: pre-existing error cases still show correct row numbers.

Reference

Tracker row G55. Repo review finding RV-F12. Interacts with M4 review screen (#108, #142, #143 already shipped). Should land before clients review real T&E uploads.

Activity

  1. added this to the ART extension milestone on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions