Repository navigation
Description
Context & Rationale
AGENTS.md:203 requires test-first fixes, and #601 made 'fails unpatched, passes patched' the evidence standard. In practice the evidence is typed by hand: '16 of them fail on 07a52ef' in #802 and task-786. #704 forbids cross-checking typed numbers, and CI keeps no artifact to compare against.
A read-only replay ran each fix's tests against its base tree, with the head's tests overlaid, the head's .venv, and pythonpath=['src'] putting the base src first (pyproject.toml:101-105). 10 of 11 sampled fix commits fail on their base:
- 5768cd9 (fix(ai): keep a reply's structured output when its prose contains brackets (#786) #802): 16 failed, 24 passed, matching task-786;
- eda3e16 (fix(security): gitleaks scans every file of a list target (#781) #784): 2;
- 66255f6 (fix(security): default dependency severity to unchecked and avoid caching failed lookups (#708) #762): 2;
- ad69071 (fix(security): unify cloud metadata predicate and harden path validation (#701) #760): 7;
- cc13175 (fix(sandbox): emit full-length prefix and parse ipv6 endpoints in network policy (#701) #759): 4;
- a98c86f (fix(ci): keep the quality gate within its five-minute budget (#748) #751): 3;
- f93231b (fix(k8s): restore kubernetes cpu metrics and align monitoring dashboards to homelab-k3s (#737) #738): 12;
- d59bc6f: 2;
- 6d78b01: 1, a TypeError from a changed signature;
- 4aaf26a: 3.
The exception, e8eaf4a (#758), fixed the test harness itself.
Scope & Deliverables
- Deliverable:
devops ci fail-to-pass --base <ref>:- resolves the merge base;
- lists the added or modified
tests/**/test_*.pyfiles; - materialises the base tree in a temporary directory, with the head's
tests/overlaid; - runs those files with the current pytest (
-o addopts=,-p no:cacheprovider,--junitxml); - reports, per test, whether it failed, errored or passed on base.
- Defect PRs:
- A defect PR has a title starting
fix(orfix:, or atype/bugortype/securitylabel. This is the same classifier as feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697. - A defect PR exits non-zero unless at least one changed test fails in the call phase on base (any exception type), or the PR body holds a
Fail-to-pass: not applicable: <reason>line, which the job summary echoes. - Collection errors are reported but do not count. Other PRs get the report and exit 0.
- A defect PR has a title starting
.github/workflows/fail-to-pass.yml:- triggers on
pull_request[opened, synchronize, reopened, edited, labeled] intomainandrelease/**; - uses
fetch-depth: 0; - passes the title, labels and body through
env, with no expression insiderun:; - replays one recorded fix as a self-check when its own files change.
- triggers on
- AGENTS.md and
instruction_generator.pytell fix PRs to cite this check run instead of typing failure counts.
- Acceptance criteria:
-
Unit tests with a mocked pytest run cover:
- a test that fails on base exits 0 and reports '1 failed on base';
- a test that passes on base exits 1 and names the test;
- a collection error does not satisfy the check;
- the not-applicable line exits 0 and prints its reason;
- a non-defect PR exits 0.
Together they take at most 1 s.
-
The workflow's self-check replays 5768cd9 against 36b2bee and reports 16 failed and 24 passed in
tests/test_ai_fixer.py. It runs outsidedevops ci. -
A workflow contract test asserts that the job calls
devops ci fail-to-passand has no expression insiderun:. -
uv run devops cigains no stage.
-
- Key questions:
- Where does the shared defect-PR classifier live? (proposed) In
src/devops_cli/github/, delivered by whichever of this item and feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697 lands first.
- Where does the shared defect-PR classifier live? (proposed) In
- Constraint:
- The check proves that a test detects a change, not that it detects the right change; reviewers still judge that.
- PRs that change dependencies error on base and need the escape line.
Strategic Alignment
- Milestone: Backlog
- Depends on: none (coordinate with feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697)
Proposed design
Problem statement
The project requires test-first fixes (AGENTS.md:203, #601) and forbids cross-checking hand-typed failure counts (#704), yet CI keeps no artifact to compare against. In practice, evidence that a fix's tests fail on the base commit is typed by hand in PR bodies. This issue adds a devops ci fail-to-pass command and a GitHub Actions workflow that automatically replays a defect PR's changed tests against its merge-base tree, proving they fail there, and gates defect PRs on that evidence.
Acceptance criteria
- Criterion 1: A test that fails on base causes the command to exit 0 and report '1 failed on base'.
Verification: Run the unit test suite fordevops ci fail-to-passwith a mocked pytest run that returns one failure; assert exit code 0 and that the output contains '1 failed on base'. - Criterion 2: A test that passes on base causes the command to exit 1 and name the test.
Verification: Run the unit test suite with a mocked pytest run where all tests pass; assert exit code 1 and that the output names the specific test that passed. - Criterion 3: A collection error does not satisfy the fail-to-pass check.
Verification: Run the unit test suite with a mocked pytest run that produces a collection error; assert the check is not satisfied (exit non-zero for a defect PR) and the error is reported. - Criterion 4: A PR body containing 'Fail-to-pass: not applicable: ' causes the command to exit 0 and print the reason.
Verification: Run the unit test suite with a mocked PR body holding the not-applicable line; assert exit code 0 and that the reason text appears in the output. - Criterion 5: A non-defect PR (title not starting with fix(/fix: and no type/bug or type/security label) exits 0 regardless of test results.
Verification: Run the unit test suite with a non-defect PR title and labels; assert exit code 0. - Criterion 6: The five unit tests above complete in at most 1 second together.
Verification: Runuv run pytest tests/ -k fail_to_pass --durations=0and confirm total duration is ≤ 1 s. - Criterion 7: The workflow self-check replays commit 5768cd9 against base 36b2bee and reports 16 failed and 24 passed in tests/test_ai_fixer.py, running outside
devops ci.
Verification: Inspect.github/workflows/fail-to-pass.ymlfor a self-check job that invokes the replay of 5768cd9 against 36b2bee and asserts the 16/24 counts; confirm it is a separate job not part of thedevops cistage. - Criterion 8: A workflow contract test asserts the job calls
devops ci fail-to-passand contains no expression insiderun:.
Verification: Run the workflow contract test (e.g.uv run pytest tests/ -k workflow_contract_fail_to_pass); it parses the YAML and asserts therun:block contains the literal stringdevops ci fail-to-passand no${{expression. - Criterion 9:
uv run devops cigains no new stage from this change.
Verification: Runuv run devops ci --helpand confirm the stage list is unchanged from before this PR. - Criterion 10: AGENTS.md and instruction_generator.py instruct fix PRs to cite the fail-to-pass check run instead of typing failure counts.
Verification: Grep AGENTS.md andsrc/devops_cli/(instruction_generator) for a reference to the fail-to-pass check; confirm the old guidance about typing counts is replaced or supplemented. - Criterion 11: The workflow triggers on pull_request [opened, synchronize, reopened, edited, labeled] into main and release/**, uses fetch-depth: 0, and passes title, labels, and body through env with no expression inside run:.
Verification: Parse.github/workflows/fail-to-pass.yml; assert theon.pull_request.typeslist,brancheslist,fetch-depth: 0, and thatenvcarries PR_TITLE, PR_LABELS, PR_BODY whilerun:contains no${{.
Key questions
- Where does the shared defect-PR classifier live?: In
src/devops_cli/github/, delivered by whichever of this item (feat(ci): fail-to-pass check proves a fix's tests fail on its base (devops ci fail-to-pass) #844) and feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697 lands first. The classifier checks whether the PR title starts withfix(orfix:, or whether the PR carries atype/bugortype/securitylabel. (proposed)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 2, 2026
Placement (2026-10-02): moved from v0.2.28 to the top of the backlog, by the owner's decision. #921 (hand-written docs fixes, P1, high value, medium effort) took its slot as the lowest-ranked item there. This item stays P1 and takes the next open slot.
dan-petty-bot commentedon Oct 10, 2026
Status set to Ready at 69c99cf (see proposed design in issue body).
feat(ci): fail-to-pass check proves a fix's tests fail on its base (#844
dan-petty commentedon Oct 16, 2026
What changed
#1596, merged into
release/v0.2.36as 3bb1951.15 file(s) changed.
How it was verified
Check runs at 943cad9:
Acceptance Criteria of
docs/agent/tasks/task-844-fail-to-pass.md:No Acceptance Criteria section.
feat(release): v0.2.36 (#1615)