Repository navigation
Description
Problem Description
devops ci fail-to-pass reads only tests/**/test_*.py files. A fix of a manifest proves itself with a k8s gate check in tests/gate/k8s_checks/*.py, which the k8s row of devops ci runs. The command does not run these checks, so it exits 1 for each manifest fix, also when the gate check fails on the base and passes on the head. AGENTS.md rule 4 tells each fix pull request to cite its fail-to-pass run, so the cited run of a manifest fix always shows a failure. The comment of .github/workflows/fail-to-pass.yml says that "only a change to the code under src/ can make a test fail on base", which is not true for a gate check.
Reproduction Steps
- Check out PR fix(k8s): delete gateway management bodies from spans #4551 (a manifest fix with a new
k8sgate check case). - Run
uv run devops ci fail-to-pass --base origin/main. - The command exits 1:
0 failed on base (0 failed and 0 passed in no changed test files; 0 errored). The fix changes no tests/**/test_*.py file. - Run
uv run devops ci --only k8swith the basek8s/otel/values.yaml:107 cases, 1 failed. On the head:107 cases, 0 failed.
Expected vs Actual Behavior
Expected: fail-to-pass also replays the changed gate checks of tests/gate/ against the base tree, and passes when a changed gate check fails on the base and passes on the head.
Actual: the command reports no changed test and exits 1. PR #4514 and PR #4551 wrote the k8s row runs by hand in a comment as the proof.
Proposed Fix
Let fail-to-pass replay a changed gate check module of tests/gate/ with the gate runner of its row against the base tree, and correct the comment of fail-to-pass.yml.
Environment Diagnostics
devops-cli main at 5f75d25.
Source: #4551
Proposed design
Problem statement
devops ci fail-to-pass lists only tests/**/test_*.py files, so a manifest fix that proves itself with a changed k8s gate check gets no replay: the command exits 1 with no changed test files, also when the changed check fails on the base tree and passes on the head. AGENTS.md rule 4 asks each fix pull request to cite this run, so the cited run of a manifest fix shows a false failure, and PR #4514 and PR #4551 wrote the k8s row runs by hand. The change replays a changed module of tests/gate/<row>_checks/ with the row's runner on the base and head trees, and corrects the workflow's path filter and comment.
Acceptance criteria
Requirement: Changed gate check replay
devops ci fail-to-pass SHALL replay a changed check module of tests/gate/<row>_checks/ against the base tree with the gate module of its row.
Scenario: A k8s gate check fails on base
- WHEN the fix changes
tests/gate/k8s_checks/otel_collector.pyand thek8srow fails one of its cases on the base tree and passes that case on the head tree - THEN the command exits 0 and the report names that case as failed on base and passed on head
Requirement: Row from the check package
The command SHALL take the gate row of a changed check module from the <row>_checks directory name under tests/gate/.
Scenario: The k8s row
- WHEN the changed module is
tests/gate/k8s_checks/otel_collector.py - THEN the command runs
tests.gate.k8sand no other gate module
Requirement: No fail-to-pass on the gate
The command MUST exit 1 when no changed gate case fails on the base tree and passes on the head tree.
Scenario: A gate check passes on both trees
- WHEN the changed gate check passes on the base tree and on the head tree
- THEN the command exits 1 and the report says that no changed gate check failed on base
Requirement: Failure outside the changed check modules
The command MUST exit 1 when a gate case that fails on the base tree belongs to a check module that the fix does not change.
Scenario: An unrelated gate failure
- WHEN the
k8srow failsother_module.check_otheron the base tree and the fix changes onlytests/gate/k8s_checks/otel_collector.py - THEN the command exits 1 and the report names
other_module.check_otheras a failure of a module that the fix does not change
Requirement: Replay that could not run
The command MUST exit 1 when a gate row writes no case summary or exits with a status other than 0 or 1.
Scenario: A row that cannot import
- WHEN the gate row run on the base tree exits 1 with a traceback and no
cases, N failedsummary line - THEN the command exits 1 and the report names the row, its exit status and the last lines of its output
Requirement: Changed gate check in the report
The command SHALL name each changed gate check module in its report.
Scenario: A manifest fix
- WHEN the fix changes
k8s/otel/values.yamlandtests/gate/k8s_checks/otel_collector.py - THEN the report names
tests/gate/k8s_checks/otel_collector.pyand holds nono changed test filestext
Requirement: Dry-run plan of the gate replay
devops ci fail-to-pass --dry-run SHALL list the base and head gate row runs and start no process.
Scenario: A gate check fix
- WHEN the dry run runs for a fix that changes
tests/gate/k8s_checks/otel_collector.py - THEN the plan lists the two gate row runs with the condition
a changed gate check existsand the process fake records no call
Requirement: Workflow trigger
.github/workflows/fail-to-pass.yml SHALL start for a pull request that changes a module under tests/gate/*_checks/.
Scenario: A gate check pull request
- WHEN a pull request with a fix title changes only
tests/gate/k8s_checks/otel_collector.py - THEN the path filter matches that file and the
Fail-to-Pass Checkjob runs
Requirement: Workflow comment
The comment block of .github/workflows/fail-to-pass.yml MUST state that a changed gate check can fail on the base tree.
Scenario: Comment text
- WHEN a reader reads the comment block of the workflow
- THEN the comment names
tests/gate/*_checks/and holds no sentence that onlysrc/can make a test fail on base
Requirement: Documents name the gate replay
CONTRIBUTING.md's Fail-to-Pass Evidence and the devops ci fail-to-pass help SHALL name the gate replay.
Scenario: The Fail-to-Pass Evidence rule
- WHEN a reader reads the Fail-to-Pass Evidence bullet and the command help
- THEN both name a changed module under
tests/gate/*_checks/as a proof that fails on base and passes on head
Requirement: Test replay unchanged
The command SHALL keep the replay of a changed tests/**/test_*.py module as it is today.
Scenario: A unit test fix
- WHEN the fix changes only
tests/test_mod.py - THEN the command runs the pytest replay of that file, starts no gate row, and reports the same result as before the change
Existing Tool Considered
git worktree (git) checks out the base and head trees, pytest replays the changed test modules, and the project's tests/gate/runner.py runs a row's checks. None maps a changed tests/gate/<row>_checks/ path to its row, runs that row on two trees and compares the failing cases; that comparison is specific to this repository's gate rows, and the four gate modules that print their own output are the deferred issue. The change builds the mapping and the comparison in devops ci fail-to-pass: about 20,000 output tokens to write the code and its tests, about 2,000 tokens each month to keep and fix it, and about 2 hours of elapsed time. No alternatives check has run.
Key questions
- Which AGENTS.md rule asks a fix pull request to cite its
fail-to-passrun?: Rule 4. It tells each fix pull request to citedevops ci fail-to-pass --base <ref>. [sources: AGENTS.md:12] - How does the command find the gate row of a changed check module?: The row is the parent directory name without the
_checkssuffix: a module oftests/gate/k8s_checks/belongs to thek8srow, whose moduletests/gate/k8s.pyruns the package withtests/gate/runner.py. A module directly undertests/gate/is not replayed by this change; the deferred issue covers it. (best practice) [sources: tests/gate/k8s.py:12, tests/gate/k8s.py:17, tests/gate/tree.py:22, src/devops_cli/commands/ci.py:723]- Chosen: row from the
<row>_checksdirectory name. The directory already names the row, and both rows that use the runner follow it:k8s_checksisk8sandtree_checksistree, so no table needs an update. - Rejected: row from the
devops cicheck table. The table mapsruff_config,construct_gate,startup_importsandswallowed_failuresto rows, but those modules print their own problem lines and no case IDs or summary, so comparing them needs the deferred uniform output. - Rejected: run every row. The base and head replays would run every row for one changed module and take minutes.
- Chosen: row from the
- How does the command replay a changed gate check against the base tree?: Make the base worktree with
materialise_base_with_head_tests, which checks out the merge base and overlays the head'stests/, so the head's check code runs against the base manifests. Run[sys.executable, '-c', 'import sys; from tests.gate.<row> import main; sys.exit(main())']withcwdthe worktree throughrun_subprocess. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py:270, src/devops_cli/ci/fail_to_pass.py:283, tests/support/paths.py:20, tests/gate/k8s_render.py:31, ARCHITECTURE.md:177]- Chosen: overlay the head's tests on a base worktree. The helper already does this for the pytest replay, and
REPO_ROOTfrom the worktree'stestspackage makes each check read the base manifests. - Rejected: copy only the changed modules onto the base worktree. The overlay already copies the head's
tests/tree, so a second copy adds no behaviour. - Rejected: call the row function in process. The process imports the working tree's module, not the worktree's copy.
- Chosen: overlay the head's tests on a base worktree. The helper already does this for the pytest replay, and
- Where does the command run the gate row for the head tree?: In the working tree when
headisHEAD, so an uncommitted fix is seen, and in a detached worktree of the named head otherwise, so--headcompares the same check code on both sides. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py:246, src/devops_cli/lang/en/help.py:840, src/devops_cli/ci/fail_to_pass.py:209]- Chosen: working tree for
HEAD, a worktree for a named head.--headsupplies the overlaid tests today, and a named head must also supply the tree that the head run reads. - Rejected: always the working tree. With
--head featurethe base run would hold feature's checks and the head run the working tree's, so the comparison is between two different check trees. - Rejected: always a worktree of
HEAD. An uncommitted gate check or manifest change would be missing from the head run, and the reproduction runs before the commit.
- Chosen: working tree for
- How does the command decide that a changed gate check fails on base and passes on head?: Parse the runner's failure lines
<row>: <case> failed:and its summary<row>: N cases, M failedfrom both runs. A case that fails on base and is not a failure on head is a fail-to-pass, when the two runs report the same case count. (best practice) [sources: tests/gate/runner.py:117, tests/gate/runner.py:133, src/devops_cli/ci/fail_to_pass.py:132]- Chosen: compare failing case IDs with the same case count. It names the case that the fix repairs, accepts an unrelated failure on head, and the count refuses a fix that deletes the failing case.
- Rejected: compare the failed totals only. A fix that trades one failure for another keeps the same total.
- Rejected: require the whole row to pass on head. A failure that the fix does not touch would refuse a valid replay.
- Rejected: compare raw problem lines of every gate module. Only the runner rows print case IDs and a summary; the other gate modules print their own problem lines, which the deferred issue covers.
- What does the command do when a gate row cannot run on the base tree?: Keep the current rule: a row run that writes no summary or exits with a status other than 0 or 1 could not run; the report names the row, the exit status and the tail of its output, and the command exits 1. A replay that did not run is no pass. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py:393, src/devops_cli/ci/fail_to_pass.py:405, src/devops_cli/ci/fail_to_pass.py:143, src/devops_cli/lang/en/messages.py:1916, AGENTS.md:12]
- Chosen: exit 1 and name the next step. A false pass is the defect that this issue fixes.
- Rejected: exit 0 with a warning. The run would prove nothing and the fix would cite it as proof.
- What does the command do when a gate case fails on base in a module that the fix does not change?: Exit 1 and name the case and its module, as the test replay does for a test that the fix does not change. A case of a module in the changed gate list is not an unchanged failure. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py:143, src/devops_cli/ci/fail_to_pass.py:446, CONTRIBUTING.md:155]
- Chosen: an unchanged gate failure fails the replay. It mirrors the test replay's rule and refuses a pass on a base that another change broke.
- Rejected: ignore an unchanged gate failure. A fix would then pass on a broken base.
- Rejected: compare each check function's syntax tree. The issue's unit is the changed check module, and the gate checks are not test functions.
- Does the command keep the current replay of a changed
tests/**/test_*.pymodule?: Yes. The gate replay is added beside the pytest replay; a change to atests/**/test_*.pyfile starts no gate row, and the command is satisfied when either replay is satisfied, each with its own vetoes. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py:470, CONTRIBUTING.md:155, tests/ci/test_fail_to_pass.py:292]- Chosen: keep the test replay and add the gate replay. The issue asks for an addition, and the test replay has its own proven rules.
- Rejected: replace both with one unified replay. A rewrite puts the proven test replay at risk for no gain.
- What does
--dry-runlist for the gate replay?: Extendplan_fail_to_passwith the base and head gate row runs, the conditiona changed gate check exists, and the head worktree calls for a named head. The existing test compares each recorded argv with the plan, so a run that the plan lacks fails it. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py:315, tests/ci/test_fail_to_pass.py:993, ARCHITECTURE.md:164]- Chosen: extend the plan. The plan is the command's documented dry run, and a test holds it to the recorded calls.
- Rejected: leave the plan unchanged. The dry-run test fails and the preview hides a process.
- Rejected: list only the base run. The head run starts too.
- Does the workflow start for a pull request that changes only a gate check?: Yes. Add
tests/gate/*_checks/**to thepathsof.github/workflows/fail-to-pass.ymland no other path. The job still runs only for a fix title, and the check is not a required check ofmain, so the new run blocks no merge. (best practice) [sources: .github/workflows/fail-to-pass.yml:12, tests/invariants/test_workflow_contracts.py:995, docs/adr/0014-required-checks-gate-the-merge-and-the-pre-push-hook-runs-the-fast-static-checks.md:11]- Chosen: add
tests/gate/*_checks/**. The filter starts the workflow exactly for the files that the command can replay, and the job's fix-title condition stays. - Rejected: add
tests/gate/**. It starts the check for a module that the command cannot replay until the deferred issue lands, so the fix gets a red check with no proof. - Rejected: keep
src/**and correct the comment only. The workflow never starts for the case of this issue, so only a hand run gets the fix. - Rejected: add
k8s/**too. A fix that changes only a manifest has no changed check to replay, and the command exits 1.
- Chosen: add
- Which documents does the change update?: The workflow comment, CONTRIBUTING.md's Fail-to-Pass Evidence, the
fail_to_passhelp with the generated README and CLI_REFERENCE, and the workflow-contract test's docstring. [sources: AGENTS.md:16, CONTRIBUTING.md:155, src/devops_cli/lang/en/help.py:836, README.md:325, docs/CLI_REFERENCE.md:3361, tests/invariants/test_workflow_contracts.py:958] - Which gate modules does this change not replay?:
tests/gate/ruff_config.py,tests/gate/construct_gate.py,tests/gate/startup_imports.pyandtests/gate/swallowed_failures.pyprint their own problem lines and no case IDs or summary; a changed one is not replayed, and the deferred issue covers it. [sources: tests/gate/ruff_config.py:188, tests/gate/construct_gate.py:419, tests/gate/startup_imports.py:474, tests/gate/swallowed_failures.py:365, tests/gate/runner.py:133]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(ci)scope of the title gives the scope.The check gives a wrong result for a class of fixes, but a manual workaround exists.It breaks the standard evidence flow for manifest fixes proven by gate checks.It needs a new replay path for gate check modules and a comment correction.devops ci fail-to-pass) #844, which asks for a different change.Both concern the devops ci fail-to-pass command, but #844 built the feature while this candidate reports a gap: it skips gate checks in tests/gate/.devops-cli-service commentedon Nov 11, 2026
Status set to Ready at 5f75d25 (see proposed design in issue body).
Moved to new items: #4596.
dan-petty commentedon Nov 11, 2026
One more case of the same limit: a fix of the test floor. PR #4857 fixes code in
tests/support/only, and changes no file undersrc/.uv run devops ci fail-to-pass --base origin/mainexits 1 with0 failed on base (0 failed and 27 passed in tests/invariants/test_hermetic_floor.py; 0 errored). The replay puts the wholetests/tree of the head on the base, so it also runs the fixed support code, and the new tests pass. With the base versions of the changedtests/support/files, the same three new tests fail for the defect (3 failed). The pull request comment records that run by hand as the proof.A fix for this issue can also replay the base versions of the changed files under
tests/support/(and other non-test files undertests/), and keep only the changedtest_*.pyfiles of the head.devops-cli-service commentedon Nov 12, 2026
Released in v0.115.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.115.0
devops-cli-service commentedon Nov 12, 2026
Live since 2026-11-12 04:08 UTC