Skip to content

fix(ci): fail-to-pass skips the gate checks of a manifest fix #4554

Closed
0 of 1 issue completed
Closed

Description

@dan-petty

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

  1. Check out PR fix(k8s): delete gateway management bodies from spans #4551 (a manifest fix with a new k8s gate check case).
  2. Run uv run devops ci fail-to-pass --base origin/main.
  3. 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.
  4. Run uv run devops ci --only k8s with the base k8s/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.py and the k8s row 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.k8s and 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 k8s row fails other_module.check_other on the base tree and the fix changes only tests/gate/k8s_checks/otel_collector.py
  • THEN the command exits 1 and the report names other_module.check_other as 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 failed summary 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.yaml and tests/gate/k8s_checks/otel_collector.py
  • THEN the report names tests/gate/k8s_checks/otel_collector.py and holds no no changed test files text

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 exists and 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 Check job 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 only src/ 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-pass run?: Rule 4. It tells each fix pull request to cite devops 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 _checks suffix: a module of tests/gate/k8s_checks/ belongs to the k8s row, whose module tests/gate/k8s.py runs the package with tests/gate/runner.py. A module directly under tests/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>_checks directory name. The directory already names the row, and both rows that use the runner follow it: k8s_checks is k8s and tree_checks is tree, so no table needs an update.
    • Rejected: row from the devops ci check table. The table maps ruff_config, construct_gate, startup_imports and swallowed_failures to 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.
  • 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's tests/, 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())'] with cwd the worktree through run_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_ROOT from the worktree's tests package 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.
  • Where does the command run the gate row for the head tree?: In the working tree when head is HEAD, so an uncommitted fix is seen, and in a detached worktree of the named head otherwise, so --head compares 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. --head supplies 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 feature the 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.
  • 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 failed from 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_*.py module?: Yes. The gate replay is added beside the pytest replay; a change to a tests/**/test_*.py file 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-run list for the gate replay?: Extend plan_fail_to_pass with the base and head gate row runs, the condition a 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 the paths of .github/workflows/fail-to-pass.yml and no other path. The job still runs only for a fix title, and the check is not a required check of main, 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.
  • Which documents does the change update?: The workflow comment, CONTRIBUTING.md's Fail-to-Pass Evidence, the fail_to_pass help 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.py and tests/gate/swallowed_failures.py print 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.

Sub-issues

Sub-issues

0 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    source/agent
    type/bug
    scope/ci
    status/new
    value/medium
    effort/medium
    on Nov 11, 2026
  2. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/ci. The (ci) scope of the title gives the scope.
    • Priority: P2-Medium. The check gives a wrong result for a class of fixes, but a manual workaround exists.
    • Value: Medium. It breaks the standard evidence flow for manifest fixes proven by gate checks.
    • Effort: Medium. It needs a new replay path for gate check modules and a comment correction.
    • Related: feat(ci): fail-to-pass check proves a fix's tests fail on its base (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/.
  3. added
    priority/p2-medium
    on Nov 11, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 5f75d25 (see proposed design in issue body).

    Moved to new items: #4596.

  6. added
    owner/agent
    on Nov 11, 2026
  7. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    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 under src/.

    uv run devops ci fail-to-pass --base origin/main exits 1 with 0 failed on base (0 failed and 27 passed in tests/invariants/test_hermetic_floor.py; 0 errored). The replay puts the whole tests/ 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 changed tests/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 under tests/), and keep only the changed test_*.py files of the head.

  8. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 12, 2026
  9. removed
    status/in-review
    owner/agent
    on Nov 12, 2026
  10. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor
  11. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 04:08 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/cisource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions