Skip to content

[Sad Catapella B4][Scientific identity] Lenient experiment-design reader silently selects last duplicate column #83

Closed

Description

@guijacquemet

Baseline and classification

Sad Catapella Batch 4, commit d7a538e56d41ac1093ba79adcad397c21b3dfd32. Confirmed behavior, deliberately covered by an existing test, but it conflicts with the requested no-silent-fallback/no-ambiguous-identity standard; this requires a backward-compatibility decision rather than being labeled an accidental regression.

Evidence

  • read_experiment_design() lines 516–548 constructs a csv.DictReader and checks that required columns are merely present, not unique; duplicate columns are collapsed into the dictionary, and the last value wins.
  • Existing test explicitly accepts a duplicated repeat_group column with rep1 in one column and other in the other, and asserts that the lenient reader silently selects other. The strict read_confirmed_design correctly refuses it, but the preprocessing notebook/CLI use the lenient reader to edit and re-publish design state.
  • Contract §12 allows spreadsheet-friendly boolean spellings/whitespace, but it does not establish a safe scientific policy for two conflicting repeat_group columns.

Impact

A spreadsheet export carrying duplicate identity/pairing columns can silently switch biological-repeat grouping and control interpretation before the user confirms, even though the file remains parseable and a subsequent saved strict design looks valid. No pixel corruption is asserted; this is scientific experimental-design identity corruption.

Fix/acceptance

Keep deliberately lenient whitespace/boolean/CRLF/BOM handling, but reject duplicate identity-bearing and control columns at header parsing with DesignFormatError naming each duplicate; preferably reject any duplicate header. Add conflicting and equal duplicate-column fixtures and ensure no output is rewritten on refusal. Update the existing test that currently codifies the unsafe last-value-wins behavior. A compatibility migration must be explicit, never silently choose a column.

No Numba role.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions