Codex repair tested: verifying a fix after task ID 0007 becomes 7
The current Codex agent repairs leading-zero loss in a synthetic CSV importer. Includes six pre-fix failures, the actual patch, the same eight passing tests, CLI checks and the complete small project.
What to consider
Keep a reproducing input, then inspect the actual output after repair. The current Codex agent created and repaired a synthetic CSV importer whose integer conversion conflated IDs 0007 and 7. Six of eight frozen tests failed before repair. Preserving string IDs and rejecting empty IDs made all eight pass, and the same CSV imported through the CLI. This is one self-authored repair fixture, not a model ranking.
Fix the importer contract before changing code
The current Codex agent authored both this project and its defect. It demonstrates a reproducible repair rather than an unknown challenge taken from a real customer repository. The contract treats IDs as strings: 0007 and 7 may coexist, and AG-001 is valid. Surrounding whitespace may be trimmed while interior title spaces are preserved.
acceptance_cases.json fixes eight inputs and expected outcomes before the patch. The contract also rejects empty IDs and keeps real duplicate IDs as errors. A frozen-contract file records SHA-256 values for the tests and original source. The reproduction runner checks these values so the acceptance conditions cannot silently be relaxed after changing the program.
The old code merges two valid identifiers
The old version executes int(row["task_id"]) after reading each CSV row. It changes 0007 to integer 7, then reports a duplicate when it encounters the distinct string ID 7. The downloaded sample-tasks.csv contains only the two records below. Standard CSV quoting protects the comma in the first title; manual string splitting is unnecessary.
The actual before-version CLI exits nonzero with duplicate task_id: 7. Six function tests also fail, while two pass. The passing checks already reject real duplicate IDs and missing headers. These protections must continue to pass after the repair rather than being removed to accommodate the new samples.
task_id,title
0007,"Task, 中文"
7,Second taskReplace numeric conversion and add an empty-ID guard
The repair replaces integer conversion with string strip and explicitly rejects an empty ID. It leaves CSV reading, title handling and duplicate detection in place. Python documents that CSV fields are normally returned as strings. Here the project itself adds int conversion; the zero loss is not caused by missing quotes in the CSV input.
The following is the actual saved diff. It replaces one conversion line and adds two empty-ID guard lines. The rule follows this fixture’s ID contract. A different system that considers surrounding ID spaces meaningful needs different expected outcomes rather than copying strip without review.
- task_id = int(row['task_id'])
+ task_id = row['task_id'].strip()
+ if not task_id:
+ raise ValueError('task_id must not be empty')Run the unchanged tests and then the actual CLI
Running the unchanged suite after repair passes all eight tests with zero errors. The actual CLI reads the same CSV and emits distinct string IDs 0007 and 7, preserving the quoted Chinese title containing a comma. Downloadable records expose expected and actual values rather than only a completion message.
Command exit codes and test output are retained separately. For privacy, logs replace only the absolute fixture-directory prefix with relative paths; failure messages are unchanged. The runner recalculates frozen hashes and stops if tests change, rather than presenting a newly relaxed suite as a repeat of the original result.
| Check | Actual before result | Actual after result |
|---|---|---|
| Preserve leading zeros in 0007 | Fails: returns integer 7 | Passes: preserves a string |
| Import 0007 and 7 together | Fails: treated as duplicates | Passes: keeps both rows |
| Alphanumeric ID AG-001 | Fails: integer conversion error | Passes: preserves the ID |
| Empty-ID check | Fails: error message violates the contract | Passes: explicitly rejects an empty ID |
| Real duplicates and missing headers | Both checks pass | Both checks still pass |
Adapting this fixture to your own project
Extract the complete package and run the command below from coding-agent-acceptance. The runner first tests the retained defective before version, then the after version. Before-phase failures are expected; the runner fails if the repaired version does not pass. The CSV supports per-case comparison, while JSON retains the contract and actual observations.
This covers one self-authored defect, not a large repository or a comparison among models. A real project needs additional inputs reflecting its own format and its existing regression suite. After an agent supplies a patch, check that the actual input produces the required output. This package offers a repeatable method, not a promised success rate on other repairs.
python3 run_repair_checks.pyChecked sources
The following sources support the project descriptions and reported facts. The analysis is by the site editors; claims from these sources are not presented as results from our own tests.