Uh oh!
There was an error while loading. Please reload this page.
fix(push): fail closed on labels.csv read errors in label + sequence preflight - #222
Conversation
…preflight Two more mirror-checks swallowed a non-EOF csv.Reader.Read error with `continue`, same class as #221: - readLabelColumnValues (CheckLabelDiversity / ReadLabelValues): a mid-read failure returned a PARTIAL class set with Found=true — under-counting classes could false-reject good data or pass a bad file. Now returns an error; the diversity GATE fails closed, while the value PREVIEW (ReadLabelValues) degrades to Found=false. - CheckSequenceRows: a mid-read failure skipped the unread tail, so null/missing sequence ids there never surfaced locally. Now fails closed. CrossCheckLabels and the tabular schema scan already abort on the same error; this brings the whole package to uniform fail-closed behavior. The trigger is I/O, not malformed CSV (LazyQuotes + FieldsPerRecord=-1 tolerate every bad shape). Each scan is split into a reader-based core (labelColumnValuesFrom / sequenceScanFrom) so the branch is exercised with an injected failing reader; parsing is unchanged and the value parity harness validates the relocation. Addresses the two follow-up Bugbot findings on #219. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
saadqbal
commented
Jul 10, 2026
Added the root-cause fix on top of the fail-closed change: |
What
Two more preflight mirror-checks swallowed a non-EOF
csv.Reader.Readerror withcontinue— the same fail-open class as #221. Follow-up Bugbot findings on the promote PR #219.readLabelColumnValues(backsCheckLabelDiversity+ReadLabelValues): a mid-read failure returned a partial class set withFound=true. An under-counted column could false-reject good data or let a bad file pass. Now returns an error → the diversity gate fails closed; the value preview (ReadLabelValues) degrades toFound=false.CheckSequenceRows: a mid-read failure skipped the unread tail, so null/missingsequence_ids there never surfaced locally. Now fails closed.CrossCheckLabelsand the tabular schema scan already abort on the same error — this makes the wholeinternal/pushpackage uniform.Trigger (same correction as #221)
Not malformed CSV content:
openCSVReadersetsLazyQuotes+FieldsPerRecord=-1, so every bad shape parses like pandas. The branch is only reachable via a genuine I/O read error.Test
Each scan is split into a reader-based core (
labelColumnValuesFrom/sequenceScanFrom) so the branch is exercised with an injected fail-after-header reader (reusingfailAfterReaderfrom #221). Parsing is byte-for-byte unchanged; the value parity harness passes, proving the relocation is faithful.Scope
Bugbot drive-bys on #219; roll up under release ticket #220 (no separate kanban item). Targets
develop→ joins the v0.8.0 payload with #221.🤖 Generated with Claude Code
Note
Low Risk
Localized preflight error-handling only; happy-path parsing is unchanged and parity harness coverage is noted in the PR.
Overview
Label and sequence CSV preflight no longer treat a mid-file
csv.ReaderI/O error as a skippable row. That path used tocontinueand could return a partial class set or pass a scan whose tail never ran—matching the fail-open bug fixed in #221 for text/CrossCheckLabels.readLabelColumnValuesnow returns an error on mid-read failure;CheckLabelDiversitypropagates it and fails closed.ReadLabelValuesstill ignores that error and reportsFound=falseso previews do not show wrong counts. The scan logic moves intolabelColumnValuesFromon an injected reader for tests.CheckSequenceRowsdoes the same for sequence ids viasequenceScanFrom: read errors surface as wrapped failures instead of hiding null/missing ids in unread rows.New unit tests use the existing
failAfterReaderhelper to assert both paths abort with the underlying error and do not mix read failures with domain null-id errors.Reviewed by Cursor Bugbot for commit fc97b90. Bugbot is set up for automated code reviews on this repo. Configure here.