Skip to content

test(ci): make the mutation run complete its first stats run #7905

Backlog

Description

@dan-petty

What happened

uv run devops ci mutate src/devops_cli/ai/personas/__init__.py cannot finish its first stats run (comment of 2026-11 on #2162). mutmut runs the whole suite serially in mutants/, which has no git tracking. Tests that touch git fail the sandbox check host path reached without a fake. The run passed 1328 tests and stopped at failures in tests/ai/mcp/test_mcp_roadmap_tools.py and tests/ai/agents/test_embedding_config_retention.py. Each cleanup item of #2162 and #6420 needs this run, so none can start.

What should happen

uv run devops ci mutate <src file> ends its first stats run with no failed test. The [tool.mutmut] table in pyproject.toml has current test-selection paths, the openspec copy entry, and a deselect of each git-dependent test that mutants/ cannot run.

Evidence

  • pyproject.toml, [tool.mutmut] table (pytest_add_cli_args_test_selection).
  • openspec/changes/2162-mutation-runs-decide-which-of-the/design.md, stop rule.
  • Each edit of pytest_add_cli_args_test_selection changes mutmut's config fingerprint, so make all edits before the first stats run.

Acceptance criteria

  • uv run devops ci mutate src/devops_cli/ai/personas/__init__.py ends its first stats run with no failed test, and mutants/mutmut-stats.json has the keys duration_by_test and tests_by_mangled_function_name.
  • No deselected test is a guard test of a security check or an invariant.
  • uv run devops ci passes.

Blocks the cleanup items split from #2162, and #6420.

Source

Source: #2162

Alternatives check of 2026-11-30: not-applicable.
Class: test, no model call.
Tool: none found.

Proposed design

Problem statement

The devops ci mutate command stops its first stats run in mutants/ when a test reaches the checkout .git path. The run cannot write mutants/mutmut-stats.json, so the cleanup items of #2162 and #6420 cannot start. The change adds the missing --deselect entry for the agent audit test to the [tool.mutmut] table.

Acceptance criteria

Requirement: First stats run completes

The devops ci mutate command MUST end its first stats run with no failed test and write the stats file.

Scenario: Mutation run of the personas module

  • WHEN A person runs uv run devops ci mutate src/devops_cli/ai/personas/__init__.py on the branch.
  • THEN The command exits 0 with no failed test, and mutants/mutmut-stats.json holds the keys duration_by_test and tests_by_mangled_function_name.

Requirement: Git-dependent agent audit test is deselected

The [tool.mutmut] test selection MUST hold a --deselect entry for the agent audit test.

Scenario: The mutation run leaves out the agent audit test

  • WHEN A person runs uv run devops ci mutate src/devops_cli/ai/personas/__init__.py.
  • THEN The run reports no failure from tests/ai/agent_audit/test_agent_files.py::test_a_line_that_names_a_failure_is_kept.

Requirement: Full check passes

The change MUST keep the full devops ci check passing.

Scenario: Full check on the branch

  • WHEN A person runs uv run devops ci.
  • THEN The command exits 0 with no failed check.

Existing Tool Considered

The alternatives check in the issue body records not-applicable (class: test, no model call; tool: none found). The change keeps the maintained mutmut==3.9.0 that the dev group already installs and edits its [tool.mutmut] table. It builds no new code.

Key questions

  • Which test does the mutation run still fail on, and what entry does it need?: The run fails on tests/ai/agent_audit/test_agent_files.py::test_a_line_that_names_a_failure_is_kept with host path reached without a fake: <checkout>/.git. The change adds --deselect=tests/ai/agent_audit/test_agent_files.py::test_a_line_that_names_a_failure_is_kept to pytest_add_cli_args_test_selection. [sources: pyproject.toml, tests/ai/agent_audit/test_agent_files.py]
  • Is the agent audit test a guard test of a security check or an invariant?: The test checks the audit report's handling of a line that names a failure. It is not a guard test of a security check or an invariant. The change can deselect it. (best practice) [sources: tests/ai/agent_audit/test_agent_files.py]
    • Chosen: Deselect the test. The test reaches the checkout .git path in mutants/, and the issue scope is test selection.
    • Rejected: Fix the test to use a fake for .git. The issue scope is the [tool.mutmut] table, and the test fix would add a separate change.
  • Does the [tool.mutmut] table already hold the openspec copy entry?: Yes. also_copy in pyproject.toml already holds openspec. The change adds no copy entry. [sources: pyproject.toml]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

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

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 30, 2026
  4. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    Premise check pending. The block in this item comes from the #2162 comment of 2026-11-09. #6448 ("the stats run fails in the mutants tree") closed on 2026-11-23, after that comment. A probe run of uv run devops ci mutate src/devops_cli/ai/personas/__init__.py on main at 01b0b15 is running. If its stats run ends with no failed test, this item has no premise: close it as not planned, and the cleanup items of #2162 can start.

  5. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    Premise check done (2026-11-30, main at 01b0b15, linked worktree). uv run devops ci mutate src/devops_cli/ai/personas/__init__.py still fails its stats run after 244 s: failed to collect stats. runner returned 1, 2 errors, tests/ai/agent_audit/test_agent_files.py::test_a_line_that_names_a_failure_is_kept with host path reached without a fake: <checkout>/.git. #6448 fixed other tests of this class, not this one. The item stands: it is the first item of the split of #2162, and the next failure is a different test.

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

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

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/agentstatus/readytype/testvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions