Repository navigation
Description
Problem
#6379 (for #6372) merged with three open points from its independent review:
CONTRIBUTING.md, "Fail-to-Pass Evidence", still says that an unchanged test is repaired only when it fails on the plain merge base and passes on the head. The code (_NOT_PASSEDinsrc/devops_cli/ci/fail_to_pass.py) and theci-fail-to-passspec accept "fails or errors".- A collection error of an unchanged test file can never count as repaired. The head replay reports one case for each test of the file and no case with the module-path id of the file, so
_repaired_and_refusedrefuses the file even when it errors on the plain merge base and all of its tests pass on the head. - The phase of an error (collection, setup, teardown) comes from the start of pytest's JUnit message text ("collection failure", "failed on setup with"). That text is internal to pytest (
_pytest/junitxml.py), and the unit tests use only hand-written XML, so a pytest change of the text would change the rule silently.
Expected
- The CONTRIBUTING sentence matches the code.
- A file-level collection error on the plain merge base counts as repaired when every head case of that file passes (test first), or the spec says that it never does.
- A test runs real pytest on a small test file with a collection error and a setup error and checks the phase that the parser reads, so a pytest change of the message text fails a test.
Alternatives check of 2026-11-19: none.
Tool: none found.
Reason: Searches found no maintained library that reads pytest's collection/setup/teardown phase: junitparser only parses JUnit XML outcomes and messages, pytest-json-report is stale, so the work stays in the project's own parser, one doc sentence and a real-pytest test.
Proposed design
Problem statement
Finish the fail-to-pass error rule of #6379; no block or dependency applies. CONTRIBUTING.md says that an unchanged test is repaired only when it fails on the plain merge base, but the code and the spec accept a failure or an error. A file-level collection error of an unchanged test file never counts as repaired, even when every head case of that file passes. The parser reads the phase of an error from pytest's message text, and no test runs real pytest to lock that text.
Acceptance criteria
Requirement: Documentation states the error rule
The 'Fail-to-Pass Evidence' section of CONTRIBUTING.md SHALL state that an unchanged test is repaired when it fails or errors on the plain merge base and that a file-level collection error is repaired when every head case of that file passes.
Scenario: The documentation check passes
- WHEN uv run devops ci --check --only docs runs on the branch.
- THEN The command exits 0 and the docs row reports no stale document.
Requirement: File-level collection error with passing head cases is repaired
_repaired_and_refused SHALL count a file-level collection error on the plain merge base as repaired when the head report holds at least one case for that file and every head case of the file passes.
Scenario: All head cases of the file pass
- WHEN The base report holds one error case with the module-path id of a test file and the head report holds a passing case for each test of that file.
- THEN _repaired_and_refused counts the file as repaired and does not refuse it.
Requirement: File-level collection error with a failing head case is refused
_repaired_and_refused SHALL refuse a file-level collection error when any head case of that file fails.
Scenario: One head case of the file fails
- WHEN The base report holds one error case with the module-path id of a test file and the head report holds a failing case for one test of that file.
- THEN _repaired_and_refused refuses the file.
Requirement: File-level collection error with no head case is refused
_repaired_and_refused SHALL refuse a file-level collection error when the head report holds no case for that file.
Scenario: The head report has no case for the file
- WHEN The base report holds one error case with the module-path id of a test file and the head report holds no case for that file.
- THEN _repaired_and_refused refuses the file.
Requirement: Phase reader follows real pytest
The fail-to-pass test suite SHALL include a test that runs real pytest on a module with a collection error and on a test with a setup error and asserts the phase that the parser reads from the JUnit XML.
Scenario: Real pytest collection and setup errors
- WHEN The test runs pytest in a subprocess on a temporary directory that holds a module whose import raises and a test whose fixture raises, then parses the JUnit XML.
- THEN The parser reads 'collection' for the module case and 'setup' for the fixture case.
Existing Tool Considered
The alternatives check of 2026-11-19 in the issue body records verdict none and names no tool. It found no maintained library that reads pytest's collection, setup or teardown phase. The change keeps the project's thin parser in src/devops_cli/ci/fail_to_pass.py. The written cost is one function edit, one CONTRIBUTING.md sentence and one real-pytest test, about 1,500 tokens to build and keep and under half a day of elapsed time, with no new dependency and no new build.
Key questions
- Does a file-level collection error of an unchanged test file on the plain merge base count as repaired?: Yes. The check counts it as repaired when the head report holds at least one case for the file and every head case of that file passes. It refuses the file when a head case fails or the head report holds no case for the file. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py:794, openspec/specs/ci-fail-to-pass/spec.md, CONTRIBUTING.md]
- Chosen: Accept the file-level collection error as repaired. The check already accepts a collection error for a changed test, and the head replay gives the evidence that the fix repairs the file.
- Rejected: State in the spec that a file-level collection error never counts as repaired. This makes the unchanged-test rule stricter than the changed-test rule and rejects a real repair.
- Where does the parser read the phase of an error?: From the start of pytest's JUnit message text: 'collection failure' for a collection error, 'failed on setup with' for a setup error and 'failed on teardown with' for a teardown error. [sources: src/devops_cli/ci/fail_to_pass.py, tests/ci/test_fail_to_pass.py]
- How does the test lock the phase text that pytest writes?: Run real pytest in a subprocess on a temporary module with an import error and a test with a failing fixture, then parse the JUnit XML and assert 'collection' and 'setup'. (best practice) [sources: tests/ci/test_fail_to_pass.py, src/devops_cli/ci/fail_to_pass.py]
- Chosen: Run real pytest and parse its JUnit XML. It exercises the pinned pytest version and fails when pytest changes the message text.
- Rejected: Use hand-written JUnit XML. It cannot detect a change in the message text of pytest.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 19, 2026
Both concern the fail-to-pass error rule, but #6372 states the original problem while the candidate fixes three residual gaps left by its implementation #6379.devops-cli-service commentedon Nov 19, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
devops-cli-service commentedon Nov 19, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (8)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 19, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
fix(ci): finish the fail-to-pass error rule of #6379 (#6400)
chore(main): release 0.219.0 (#7177)
devops-cli-service commentedon Nov 25, 2026
Released in v0.219.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.219.0
devops-cli-service commentedon Nov 25, 2026
Live since 2026-11-25 17:09 UTC