Skip to content

feat(roadmap): new tests of an implementation are checked for strength #3051

Closed

Description

@dan-petty

What happened

A generated test can pass and prove nothing. The project has a mutation check and a coverage floor, but the job runs neither on the tests it writes.

What should happen

  • The job runs the mutation check on the changed code and the new tests (bounded by time and file count) and the change-scoped coverage. Surviving mutants and uncovered new lines go to a repair round.

Acceptance criteria

  • A test file that asserts nothing is flagged in a replay test.
  • The mutation run has a time bound and the report is in the PR comment.
  • The coverage delta of the changed files is in the PR comment.
  • The check is skipped, with the reason shown, for groups of kind other.

Related: tracker for this set (filed with it), #2908 (issue workflow), #2867 (draft PR evaluator), #3005 (task kind), #3010 to #3015 (plan gates), #2919 (stuck-item metrics), #2953 (Ollama parser).

Alternatives check of 2026-11-04: partly.
Tool: boxed/mutmut (https://github.com/boxed/mutmut), BSD-3-Clause, last activity 2026-10-28, maintained.

Proposed design

Problem statement

The implement job writes tests but does not check their strength. A generated test can pass and assert nothing, and the job runs no mutation check and no changed-line coverage on the tests it writes. This issue adds a strength scoped check to the implement job: it reuses the existing test-function-has-assertion ast-grep rule, runs mutmut through the existing devops ci mutate --changed selection with a time and file bound, runs diff-cover over the scoped tests' coverage, puts the results in the pull request comment, sends failures to the existing fix-step loop, and skips the changed files of a task group of kind other with the reason shown.

Acceptance criteria

Requirement: Flag a test file with no assertion

The strength check SHALL report a new test file whose test functions hold no assertion as a strength failure.

Scenario: Fixture test file with no assertion

  • WHEN A new test file holds a test function with no assert statement, no pytest.raises or pytest.warns call and no self.assert* call.
  • THEN The strength check reports the test file and the line of the function, and the job starts a fix step.

Requirement: Bound the mutation run by time

The mutation run SHALL stop at roadmap.implement.command_timeout_seconds.

Scenario: Command timeout reached

  • WHEN The mutation run reaches the command timeout.
  • THEN The run stops, and the strength report in the pull request comment names the bound and the survivors that the run found before the stop.

Requirement: Bound the mutation run by file count

The mutation run SHALL test the changed source files of at most CONST_ROADMAP_IMPLEMENT_SCOPED_TEST_MODULES files.

Scenario: More changed files than the bound

  • WHEN A change touches more source files than the bound.
  • THEN The run tests the files up to the bound, and the strength report names each file that the run did not test.

Requirement: Post the mutation report

The implement job SHALL put the mutation report in the pull request comment.

Scenario: Surviving mutant listed

  • WHEN The mutation run reports one surviving mutant.
  • THEN The pull request comment lists the file, the line and the mutant name of the surviving mutant.

Requirement: Post the coverage delta

The implement job SHALL put the coverage delta of the changed files in the pull request comment.

Scenario: Uncovered new line listed

  • WHEN A new line of a changed file has no coverage from the new tests.
  • THEN The pull request comment lists the file and the line number of the uncovered line.

Requirement: Repair a strength failure

The implement job SHALL send a surviving mutant and an uncovered new line to a fix step of the scoped-check repair loop, bounded by roadmap.implement.repair_rounds.

Scenario: One strength failure gets a fix step

  • WHEN The strength check reports a surviving mutant or an uncovered new line.
  • THEN The job runs a fix step with the strength report as input and runs the strength check again after the fix step.

Requirement: Skip a group of kind other

The implement job SHALL skip the strength check for the changed files of a task group of kind other and SHALL show the reason in the pull request comment.

Scenario: Task group of kind other

  • WHEN A task group has kind other.
  • THEN The job runs no mutation check and no coverage check on the files of that group, and the pull request comment states the skip reason.

Existing Tool Considered

boxed/mutmut 3.8 (https://github.com/boxed/mutmut), BSD-3-Clause, last activity 2026-10-28, maintained. The project already runs it through devops ci mutate --changed --base (src/devops_cli/commands/ci.py:2418), which selects the functions of the changed files and reports each surviving mutant with its file, line and diff. mutmut itself lacks an overall wall-clock bound, a changed-file count bound, a coverage delta of the changed lines, a static assertion scan and pull request comment posting. The project already covers the assertion scan with the test-function-has-assertion ast-grep rule in the constructs row (.ast-grep/rules/test-function-has-assertion.yml:1, tests/gate/construct_gate.py:69) and the coverage delta with diff-cover (https://github.com/Bachmann1234/diff_cover), which CI runs at .github/workflows/ci.yml:291. The job adds only the changed-file cap, the report in the pull request comment, the skip for other groups and the repair wiring; it builds no mutation engine.

Key questions

  • Which mutation testing tool does the strength check run?: The check runs boxed/mutmut 3.8 through the project's devops ci mutate --changed --base <base> selection (src/devops_cli/commands/ci.py:2418, src/devops_cli/ci/mutate.py:1). That command maps the changed functions to mutmut names and reports each survivor with its file, line and diff; the job adds the changed-file cap and the pull request comment. The project builds no mutation engine. (best practice) [sources: src/devops_cli/commands/ci.py:2418, src/devops_cli/ci/mutate.py:1]
    • Chosen: boxed/mutmut 3.8 through devops ci mutate --changed. It is open, maintained and already in the project: devops ci mutate selects the changed functions and reports each surviving mutant with its file, line and diff.
    • Rejected: Build a mutation runner in the repository. It repeats a solved problem and costs the tokens to build, keep and fix an engine that mutmut already gives.
    • Rejected: Use the CI Tests & Coverage job only. That job reports changed-line coverage but runs no mutation, and the implement job needs the result before it marks the pull request ready.
  • How does the check find a test file that asserts nothing?: The strength check invokes the existing .ast-grep/rules/test-function-has-assertion.yml rule on the new test files. The constructs row already runs that rule over tests/** (tests/gate/construct_gate.py:69, src/devops_cli/config/constants.py:3514), and it matches an assert statement and a call of pytest.raises, pytest.warns, self.assert* and the other checks in its regex. The strength check reports the rule's violation; it adds no second assertion parser. (best practice) [sources: .ast-grep/rules/test-function-has-assertion.yml:1, tests/gate/construct_gate.py:69, src/devops_cli/config/constants.py:3514]
    • Chosen: Reuse the test-function-has-assertion ast-grep rule. The rule is already in the constructs row, matches asserts, pytest.raises/warns and self.assert*, and runs over tests/**.
    • Rejected: Parse each test file with ast. It duplicates the existing rule and adds a second definition of an assertion.
    • Rejected: Flag a file only when all its mutants survive. The mutation run costs minutes, and a weak file can still kill one mutant.
  • How does the job get the coverage delta of the changed files?: After the tests scoped check, the job runs uv run coverage xml -q and uv run diff-cover .data/coverage.xml --compare-branch=origin/<base> --format markdown:<file>, the same two commands that CI runs at .github/workflows/ci.yml:289 and .github/workflows/ci.yml:291. The job parses the markdown for the missing lines and puts them in the comment. diff-cover reports the changed lines only, which is the delta the issue asks for. (best practice) [sources: .github/workflows/ci.yml:283, .github/workflows/ci.yml:289, .github/workflows/ci.yml:291]
    • Chosen: diff-cover over a coverage.py XML report. The project already runs coverage xml and diff-cover in CI, and diff-cover reports the changed lines only.
    • Rejected: Diff two coverage reports in the job. It repeats the line mapping that diff-cover already does.
    • Rejected: Keep the project coverage floor only. A floor over the whole tree hides the new lines that no test covers.
  • Which wall-clock and changed-file bounds apply to the mutation run?: The mutation run is a scoped check, so roadmap.implement.command_timeout_seconds (default 1800 s) bounds it at src/devops_cli/roadmap/implement/implement_scoped_ci.py:165. The changed-file cap is CONST_ROADMAP_IMPLEMENT_SCOPED_TEST_MODULES (30), the project's existing cap for a scoped check (src/devops_cli/config/constants.py:3520). A run that reaches either bound stops, and the strength report names the bound and the survivors it found or the files it did not test. (best practice) [sources: src/devops_cli/roadmap/implement/implement_scoped_ci.py:165, src/devops_cli/config/settings.py:1107, src/devops_cli/config/constants.py:3520]
    • Chosen: roadmap.implement.command_timeout_seconds (1800 s) and 30 changed files. The setting already bounds every scoped check, and 30 is the project's existing cap for a scoped check (CONST_ROADMAP_IMPLEMENT_SCOPED_TEST_MODULES).
    • Rejected: 5 minutes and 10 files. No project source records these values; they were proposed, not chosen from the project's settings.
    • Rejected: No bound beyond the 4-hour mutmut timeout. The issue requires a time bound and a file count bound, and 4 hours is longer than the implement step's own time limit.
  • Where does the strength check run in the implement job?: The strength check runs as a new strength scoped check after tests and before the push, in the same run_scoped_checks loop (src/devops_cli/roadmap/implement/implement_scoped_ci.py:192). The tests check writes the coverage data that coverage xml and diff-cover read, and a failed strength check gets the existing fix-step loop (openspec/specs/roadmap-implement-job/repair/spec.md:80). (best practice) [sources: src/devops_cli/roadmap/implement/implement_scoped_ci.py:124, src/devops_cli/roadmap/implement/implement_scoped_ci.py:192, openspec/specs/roadmap-implement-job/repair/spec.md:80]
    • Chosen: A new strength scoped check after tests. The scoped tests write the coverage data, the existing timeout applies, and a failed scoped check already gets the fix-step loop.
    • Rejected: Inside each group's exit checks. The coverage data of the scoped tests does not exist yet, and a group of kind other has no test.
    • Rejected: In the CI Tests & Coverage job only. The job would learn of a weak test after it marked the pull request ready, and the issue asks the job to repair before that.
  • Where does the job show the strength report?: In the implement job's pull request comment. _comment already writes the run's table, scoped-check lines and check lines (src/devops_cli/roadmap/implement/implement_run.py:1515), and _check_lines already renders the verify output of other groups (src/devops_cli/roadmap/implement/implement_run.py:1558); the strength report is one more section of that comment. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py:1515, src/devops_cli/roadmap/implement/implement_run.py:1558]
    • Chosen: The implement job's pull request comment. _comment already writes the run's table, scoped checks and check lines, and the issue asks for the report in the pull request comment.
    • Rejected: A check run. The issue asks for a comment, and the job has no check-run writer.
    • Rejected: An issue comment. The pull request is the record of the change.
  • How does the job use a strength failure?: A failed strength check is a failed scoped check, so it starts the existing fix-step loop with the strength report as the log, bounded by roadmap.implement.repair_rounds (default 3), not one round (openspec/specs/roadmap-implement-job/repair/spec.md:80, src/devops_cli/config/settings.py:1050). CONTEXT.md:142 still says 'at most one fix step', but the spec and the setting are the current project decision. (best practice) [sources: openspec/specs/roadmap-implement-job/repair/spec.md:80, src/devops_cli/config/settings.py:1050, docs/ROADMAP_WORKFLOW.md:399]
    • Chosen: The existing scoped-check fix-step loop, bounded by roadmap.implement.repair_rounds. A failed scoped check already gets up to repair_rounds fix steps, and the setting defaults to 3.
    • Rejected: One repair round only. The project's spec and setting bound the loop at repair_rounds, not one; CONTEXT.md's 'at most one fix step' is stale.
    • Rejected: A comment with no fix step. The issue sends the surviving mutants and the uncovered lines to a repair round.
  • What is a task group of kind other?: A task group of kind other is a group whose Kind: line is other. (GroupKind.OTHER = "other"). The kinds are behavior, manifest and other; an other group is a document, a workflow, a deletion, a behavior-preserving refactor, a test-only edit or data, has no test, and is proved by a verify command or a process (src/devops_cli/roadmap/stage/stage_change.py:465). The implement job reads the kind from the Kind: line of the TaskGroup.text with KIND_LINE (src/devops_cli/roadmap/step_files.py:36), so a manifest group is not mistaken for other; plan_read._kind falls back to other only when the first task has no fails on the base suffix (src/devops_cli/roadmap/plan_read.py:348). The strength check skips a group whose kind is other because the group writes no test. [sources: src/devops_cli/roadmap/stage/stage_change.py:465, src/devops_cli/roadmap/stage/stage_change.py:474, src/devops_cli/roadmap/step_files.py:36, src/devops_cli/roadmap/plan_read.py:348, src/devops_cli/roadmap/stage/stage_form.py:259]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Owner decision 2026-11-13

The approved pipeline split (tracker #5482, Phase 7) uses this check in E3 (#5517) and in the tests unit (#5520).

  • Live proof: after the merge and the release, the next implement Job runs the check as the App. A comment gives the strength value of each new test.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 1, 2026
  2. dan-petty commented on Nov 1, 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/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It improves test quality in the pipeline but does not block a broken build or expose a security risk.
    • Value: Medium. It catches weak generated tests that pass without asserting, reducing silent regressions.
    • Effort: Medium. It needs a bounded mutation run, a coverage delta step, a repair loop, and a PR comment, all wired into the job.
    • Related: feat(ci): on-demand mutation testing of changed functions (devops ci mutate) #853, which asks for a different change. Both use mutation testing on changed code, but #853 delivers an on-demand command while the candidate adds an automated gate in the roadmap job.
  3. added
    priority/p2-medium
    on Nov 1, 2026
  4. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at a588893 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • Which mutation testing tool is configured in the project's CI pipeline? (missing verified source)
    • What does groups of kind other mean in the task group system? (missing verified source)
  5. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Tool: boxed/mutmut (https://github.com/boxed/mutmut)

    • License: BSD-3-Clause
    • Last activity: 2026-10-28
    • Maintained: yes

    Covers:

    • Runs mutation testing on selected Python source paths and test directories
    • Reports surviving mutants with file and line information
    • Can limit how long it waits before killing a slow mutation

    Lacks:

    • No overall wall-clock time bound or changed-file count bound for a mutation run
    • No built-in coverage delta for changed files
    • No static check that flags test files containing no assertions
    • No pull request comment posting or task-group kind handling

    Searches run:

    • python mutation testing tool for changed code bounded run
    • coverage delta of changed files tool diff-cover
    • mutmut run only changed files timeout option

    Sources:

    Checked on 2026-11-04. A person decides what this means for the item. The check changes no label and closes no issue.

  6. added
    status/ready
    and removed
    status/new
    on Nov 12, 2026
  7. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 2bd87bc (see proposed design in issue body).

  8. 18 remaining items

  9. added
    status/blocked
    on Nov 15, 2026
  10. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    The runner Job devops-cli-implement-devops-cli-3051-f74c46 ended: succeeded.
    Image digest: sha256:fe47db4ed0f739be963bafe15bf9679f7075fb8156c0d03b13bd21173c3cf8ff

    The last lines of its log:

    Tool call: run_command, started: uv run python -c <masked>
    Tool call: run_command, program uv, refused.
    Tool call: write_file, ok.
    Tool call: run_command, started: uv run python .data/agent/scratch/probe_env.py
    Tool call: run_command, program uv, ok.
    Tool call: run_command, started: grep -n <masked> .venv/lib/python3.14/site-packages/mutmut/__main__.py | head
    Tool call: run_command, program grep, ok.
    Tool call: read_file, ok.
    Tool call: grep, retry (context must be between 0 and 20. Path: src/devops_cli/core/process.py).
    Tool call: grep, ok.
    Tool call: read_file, ok.
    Tool call: grep, ok.
    Tool call: run_command, started: grep -n <masked> .venv/lib/python3.14/site-packages/mutmut/__main__.py
    Tool call: run_command, program grep, ok.
    Tool call: read_file, ok.
    Tool call: write_file, ok.
    Tool call: run_command, started: uv run python .data/agent/scratch/probe_env_extra.py 2>/dev/null
    Tool call: run_command, program uv, ok.
    Tool call: read_file, ok.
    Tool call: run_command, started: grep -rn os.environ .venv/lib/python3.14/site-packages/mutmut/ | head ...
    Tool call: run_command, program grep, ok.
    Tool call: run_command, started: grep -n PYTEST_ADDOPTS -B 5 -A ...
    Tool call: run_command, program grep, ok.
    Tool call: grep, ok.
    Tool call: run_command, started: other
    Tool call: run_command, program other:0d1fad9577bf, refused.
    Tool call: run_command, started: uv run python -c print(__import__('pathlib').Path('.data/agent/scratch/probe_env.py').unlink())
    Tool call: run_command, started: uv run python -c print(__import__('pathlib').Path('.data/agent/scratch/probe_env_extra.py').unlink())
    Tool call: run_command, program uv, ok.
    Tool call: run_command, program uv, ok.
    Tool call: read_file, ok.
    Tool call: read_file, ok.
    Tool call: run_command, started: uv run --help 2>&1 | grep ...
    Tool call: run_command, program uv, ok.
    Tool call: run_command, started: uv run --help 2>&1 | grep ...
    Tool call: run_command, program uv, ok.
    Tool call: run_command, started: uv run devops ci test tests/core/test_subprocess_env_file_write.py ...
    Tool call: run_command, program uv, ok.
    Failure class plan_defect. Action left: wait.
    ✓ Took 0 item(s) to a ready pull request, stopped 1.
    
  11. removed
    owner/service
    on Nov 15, 2026
  12. added
    status/in-review
    and removed
    status/blocked
    on Nov 15, 2026
  13. removed
    status/in-review
    on Nov 15, 2026
  14. added a commit that references this issue on Nov 15, 2026
  15. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor
  16. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-15 06:04 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/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions