Repository navigation
Description
Problem
tests/gate/runner.main returns 0 when a gate module gives no case. A row whose checks are gone, or are not collected, passes.
Done when
- The runner exits non-zero when it collects no case, and names the module. A test fails on the base.
Alternatives check of 2026-11-26: none.
Tool: none found.
Reason: Searches returned no tool that covers this: the gate runner is the project's own harness, and a framework's empty-suite exit code (pytest's 5) applies only to its own collected tests, so the guard is a local code change.
Lacks:
- Non-zero exit when a module collects no case
- The module named in the failure output
- A test that fails on the base
Proposed design
Problem statement
The gate runner tests/gate/runner.main returns 0 when a gate module supplies no case. A gate row whose checks are gone, or are not collected, then passes. The change makes the runner exit non-zero, name the empty module, and pass the Fail-to-Pass Check.
Acceptance criteria
Requirement: Empty module helper
The new empty_gate_modules function SHALL return the name of each gate module that supplies no case.
Scenario: One empty module and one non-empty module
- WHEN A test calls
empty_gate_moduleswith a mapping that holds one empty case list and one non-empty case list. - THEN The call returns only the name of the empty module.
Requirement: Non-zero exit for an empty gate module
The gate runner SHALL exit with a non-zero status when a gate module supplies no case.
Scenario: A gate module supplies no case
- WHEN A test calls the gate runner main function with a gate module that supplies no case.
- THEN The call returns a non-zero exit status.
Requirement: The failure names the empty gate module
The gate runner MUST write the name of each gate module that supplies no case to standard error.
Scenario: The empty module name in standard error
- WHEN A test calls the gate runner main function with a gate module that supplies no case and captures standard error.
- THEN The captured standard error contains the name of that gate module.
Requirement: A non-empty gate module keeps the exit status zero
The gate runner SHALL return exit status zero when each gate module supplies at least one case.
Scenario: A gate module with one case
- WHEN A test calls the gate runner main function with a gate module that supplies one passing case.
- THEN The exit status is zero and standard error names no empty gate module.
Requirement: The Fail-to-Pass Check treats the runner as shared harness
The Fail-to-Pass Check SHALL treat a change to tests/gate/runner.py as a change to shared harness and SHALL NOT refuse it as an unowned gate module.
Scenario: A change to the shared runner
- WHEN A test builds the Fail-to-Pass report with
tests/gate/runner.pyas the only changed gate path. - THEN The report is satisfied and no gate module replay is refused.
Requirement: The new test fails on the base
The change MUST add a test that fails against the base commit because the new devops_cli.ci.gate_runner module is absent.
Scenario: The new test at the base commit
- WHEN
uv run devops ci fail-to-pass --base <ref>replays the new testtests/ci/test_gate_runner.pyagainst the base source. - THEN The replay shows the new test fails at collection with
ModuleNotFoundErrorthat namesdevops_cli.ci.gate_runner.
Existing Tool Considered
The alternatives check of 2026-11-26 in the issue body records the verdict none with no tool. The block gives the reason and the lacks list. The proposal covers the need with a new pure helper in src/devops_cli/ci/gate_runner.py and a shared-harness classification in src/devops_cli/ci/fail_to_pass.py. The local code costs about 20k tokens to write, keep and fix, and about 1 hour of elapsed time.
Key questions
- Where does the gate runner detect a gate module that supplies no case?: A new pure helper
empty_gate_modulesinsrc/devops_cli/ci/gate_runner.pytakes the collected cases by module. It returns the names with no case. The runner calls it after collection. It writes each name to standard error and returns 1. (best practice) [sources: tests/gate/runner.py, docs/TESTING.md, src/devops_cli/ci/fail_to_pass.py:476]- Chosen: Per-module helper in
src/devops_cli/ci/gate_runner.py. It fails the exact row that lost its checks and names that module. It lives insrc/, so a test fails on the base when the module is absent. - Rejected: One total count at the end. One empty module among full modules keeps the total above zero. The empty row still passes.
- Rejected: The empty-collection exit code of pytest. The gate runner is the project's own harness. Code 5 of pytest covers only the tests that pytest collects.
- Chosen: Per-module helper in
- How does the change pass the Fail-to-Pass Check for
tests/gate/runner.py?: The change addstests/gate/runner.pyto the shared-harness paths insrc/devops_cli/ci/fail_to_pass.py. The report then does not refuse the runner as an unowned gate module. The test attests/ci/test_fail_to_pass.py:2525uses another unowned module for the refused case. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py:476, src/devops_cli/ci/fail_to_pass.py:703, tests/ci/test_fail_to_pass.py:2525]- Chosen: Shared-harness allowlist.
runner.pyis the shared harness of every gate row. It owns no single row, so the check must not refuse it. - Rejected: Add
runnertoCONST_GATE_MODULE_ROWS. The runner serves every row. A mapping to one row would misstate ownership. - Rejected: Move the runner to
src/. The gate harness is test infrastructure. Product code holds nothing for tests.
- Chosen: Shared-harness allowlist.
- How does the new test fail on the base when the Fail-to-Pass Check overlays
tests/?: The new test importsdevops_cli.ci.gate_runner, which is insrc/. The base commit has no such module. The overlay replaces onlytests/. The test then fails at collection withModuleNotFoundErroron the base. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py:630, docs/TESTING.md]- Chosen: Put the guard logic in
src/devops_cli/ci/gate_runner.py. The test imports asrc/module. The base lacks it, so the test fails on the base even whentests/is overlaid. - Rejected: Test only
tests/gate/runner.py. The overlay replaces the runner with the head version. The test then passes on the base. - Rejected: Prove the base failure by removing the guard by hand. The Fail-to-Pass Check needs an automated test that fails on the base. A manual run gives no check result.
- Chosen: Put the guard logic in
- Which status and output does the runner give for a gate module that supplies no case?: The runner writes one line to standard error for each empty module. It returns a non-zero status. (best practice) [sources: AGENTS.md, docs/TESTING.md]
- Chosen: One line on standard error and a non-zero exit. It keeps standard output for case results. It makes the failure visible in the CI log.
- Rejected: A raised exception with a traceback. A traceback hides the module name among frames. It reads as a crash, not as a gate result.
- Rejected: A line on standard output. Case results use standard output. A reader of that output can miss the failure.
- Where does the new test file sit?: The new test file is
tests/ci/test_gate_runner.py. It sits in the mirror directory ofsrc/devops_cli/ci/gate_runner.py. [sources: docs/TESTING.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 26, 2026
Both deal with what happens when a gate check is absent, but #6456 changes the fail-to-pass report logic while the candidate changes the runner exit code.devops-cli-service commentedon Nov 26, 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 (6)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 28, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
dan-petty commentedon Nov 29, 2026
Returning #7315 to New: it cannot pass CI as specified.
tests/gate/runner.pytriggerschanged.gate_modules = ('tests/gate/runner.py',)insrc/devops_cli/ci/fail_to_pass.py:476-482,605.gate_row_of_module('tests/gate/runner.py')(src/devops_cli/ci/fail_to_pass.py:703-706) looks up'runner'inCONST_GATE_MODULE_ROWS(src/devops_cli/config/constants.py:2730-2740), returnsNone, marksGateModuleReplay.refused = True(fail_to_pass.py:292-295), and causesFailToPassReport.satisfied(fail_to_pass.py:386) to returnFalse(Fail-to-Pass Checkruns ontests/gate/**per.github/workflows/fail-to-pass.yml:9).tests/ci/test_fail_to_pass.py:2525-2539explicitly asserts that changingtests/gate/runner.pyyieldsunowned_report.satisfied == Falseandunowned_report.gate_modules[0].refused == True.materialise_base_with_head_tests(src/devops_cli/ci/fail_to_pass.py:630-641) overlaysHEAD's entiretests/directory ontomerge_base, so a pytest unit test intests/cannot fail on base in automateddevops ci fail-to-passreplay.Possible prerequisite/refinement paths: distinguish shared harness helpers from unowned gate modules in
fail_to_pass.py(and updatetests/ci/test_fail_to_pass.py), or move the runner harness undersrc/wherefail-to-passreplays againstmerge_base.devops-cli-service commentedon Nov 29, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
fix(ci): fail a gate module with no cases (#7315)
devops-cli-service commentedon Nov 29, 2026
Released in v0.248.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.248.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 16:50 UTC