Repository navigation
Description
Problem
The Fail-to-Pass Check replays the tests of a fix with pytest -o addopts= (src/devops_cli/ci/fail_to_pass.py:6). The option clears the addopts of the project configuration.
tests/commands/test_test_selection.py::test_the_full_gate_collects_every_test_module reads addopts. Under the replay it fails on every base, but in a normal run it passes on the same base. So each fix that changes tests/commands/test_test_selection.py gets one false "failed on base" line for this test.
Found while an agent fixed PR #5547 (#4472) on 2026-11-14: the replay listed this test as failed on base, and the cause was the replay option, not the base.
Expected behavior
A test that passes on the base in a normal run also passes on the base in the replay. The replay does not report a failure that its own options cause.
Fix options (the plan decides)
- Keep the
addoptsthat a test reads, and clear only the options that change the replay result (for example coverage or parallel workers). - Or make the test read the configuration that the run uses, and not the raw
addoptsvalue.
Test first: a replay of tests/commands/test_test_selection.py on an unchanged base reports 0 failed on base.
Related
- fix(ci): fail-to-pass refuses the fix of a red main #5590: the check refuses the fix of a red
main. - fix(roadmap): keep no tool versions in runner_tools.py #5585: a
tools.lockpin bump starts the check.
Source: #5547
Proposed design
Problem statement
The fail-to-pass replay passes pytest -o addopts= and clears the project addopts. The test tests/commands/test_test_selection.py::test_the_full_gate_collects_every_test_module reads addopts, so it fails on every base and gives a false failed on base line. The replay must keep addopts and override only coverage and parallel workers.
Acceptance criteria
Requirement: Replay keeps addopts
The fail-to-pass replay SHALL keep the project addopts value that a test reads.
Scenario: A test reads addopts under replay
- WHEN The replay runs tests/commands/test_test_selection.py::test_the_full_gate_collects_every_test_module on an unchanged base.
- THEN The replay reports 0 failed on base and adds no failed on base line for that test.
Requirement: Replay overrides coverage and workers
The fail-to-pass replay SHALL disable coverage and parallel workers with explicit pytest options and SHALL NOT clear addopts with -o addopts=.
Scenario: Replay command line
- WHEN A fix changes a source file and the replay starts its pytest run.
- THEN A unit test in tests/ci/test_fail_to_pass.py asserts that the command line contains --no-cov and -n 0, and does not contain -o addopts=.
Requirement: No false base failure from replay options
The replay SHALL report a base failure only when the test fails without the replay options.
Scenario: A test passes in a normal base run
- WHEN A test passes on the base commit in a normal run and reads the project addopts.
- THEN The replay reports 0 failed on base for that test.
Existing Tool Considered
No alternatives check has run. pytest, with pytest-cov and pytest-xdist, is already in use. It covers the need: --no-cov turns off coverage, and -n 0 turns off parallel workers. The project addopts stays in place. These tools lack a replay mode that keeps addopts, so the proposal adds the two flags to the replay command line. Cost: one command-line edit and one regression test, about 2k tokens and 30 minutes to build, keep and fix.
Key questions
- Should the replay keep the project addopts and override only coverage and workers, or clear addopts?: Keep the project addopts. Add --no-cov and -n 0 to the replay command line, and remove -o addopts=. This keeps the value that a test reads and stops coverage and parallel workers from changing the replay. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py:6, tests/commands/test_test_selection.py]
- Chosen: Keep addopts and override coverage and workers. It preserves the configuration that a test reads, and explicit flags stop coverage and parallel workers from changing the replay.
- Rejected: Clear addopts with -o addopts=. It causes the false base failure in fix(ci): the fail-to-pass replay clears the addopts #5599 because tests see an empty addopts.
- Rejected: Change the affected test to read the effective run configuration. It treats the symptom, and the replay still clears configuration that any test may read.
- Which pytest options disable coverage and parallel workers without clearing addopts?: --no-cov turns off coverage from pytest-cov, and -n 0 turns off workers from pytest-xdist. The rest of addopts stays in place, including -n logical as the value that a test reads. (best practice) [sources: tests/commands/test_test_selection.py]
- Chosen: Use --no-cov and -n 0. They override the two replay-changing options and leave addopts in place.
- Rejected: Filter the addopts string from pyproject.toml. It duplicates pytest parsing and can remove options that a test reads.
- Rejected: Clear addopts. It causes the false base failure.
- Does -o addopts= empty the project addopts for the replay?: Yes. Pytest -o overrides an ini value, and addopts= sets the value to an empty string. [sources: src/devops_cli/ci/fail_to_pass.py:6]
- Which test reads addopts and gives the false base failure?: tests/commands/test_test_selection.py::test_the_full_gate_collects_every_test_module reads addopts. It passes on the base in a normal run and fails under the replay. [sources: tests/commands/test_test_selection.py, src/devops_cli/ci/fail_to_pass.py:6]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-20: none.
Tool: none found.
Reason: Searches found only pytest and its coverage and worker plugins, which the project already uses; none provides a replay that keeps addopts, so the fix stays a two-flag edit in the project's own replay command line.
Lacks:
- No replay harness that runs a test set on a base commit
- No check that flags failures caused by the replay options
- No single option that keeps addopts and drops coverage and workers
Activity
dan-petty commentedon Nov 14, 2026
Both fix false failures in the fail-to-pass replay, but #4908 fixes support files being copied to the base while this fixes addopts being cleared by the replay option.devops-cli-service commentedon Nov 18, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
devops-cli-service commentedon Nov 20, 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 (10)
Tools considered:
Searches run:
Sources:
dan-petty commentedon Nov 21, 2026
This defect now stops the Fail-to-Pass Check of a fix, and it does not only add a false line.
Issue #6564 (P0, pull request #6568) changes
tests/commands/test_test_selection.py.uv run devops ci fail-to-pass --base origin/mainon that branch reportstest_the_full_gate_collects_every_test_moduleas failed on the base, and then exits 1 with: "A test that the fix does not change does not pass on the head". The cause is the same: the replay gives-o addopts=, and the test readsaddopts.In a normal run on the same head, the test passes (
uv run pytest -n 0 tests/commands/test_test_selection.py::test_the_full_gate_collects_every_test_module: 1 passed).So each fix that changes
tests/commands/test_test_selection.pygets a red Fail-to-Pass Check until this item is fixed. This item blocks #6564.chore(main): release 0.187.0 (#6584)
devops-cli-service commentedon Nov 21, 2026
Released in v0.187.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.187.0
devops-cli-service commentedon Nov 21, 2026
Live since 2026-11-21 06:24 UTC