Skip to content

docs(openspec): plan #3051 Check the strength of the new tests - #5586

Merged
dan-petty merged 4 commits into
mainfrom
feat/3051-new-tests-of-an-implementation-are
Nov 14, 2026
Merged

dan-petty merged 4 commits into
mainfrom
feat/3051-new-tests-of-an-implementation-are

Conversation

@devops-cli-service

Copy link
Copy Markdown
Contributor

Plans #3051

The implement job writes tests but checks their strength nowhere: a generated test can pass and assert nothing. This change adds a strength scoped check after the scoped checks. It reuses the test-function-has-assertion ast-grep rule, devops ci mutate and diff-cover. The mutation run stops at roadmap.implement.command_timeout_seconds and at 30 changed source files, and the report names the bound. The coverage part runs the scoped test modules with coverage on, because devops ci test writes none, and reads the changed lines with diff-cover. The comment shows the mutants, the uncovered lines and the skip reason of an other group. A finding goes to the repair loop. No dependency is added.

Change: openspec/changes/3051-new-tests-of-an-implementation-are/

@devops-cli-service devops-cli-service Bot added type/docs Type docs: a change to the documents scope/openspec OpenSpec changes, specs and their checks labels Nov 14, 2026
@devops-cli-service
devops-cli-service Bot marked this pull request as ready for review November 14, 2026 01:35
@dan-petty

Copy link
Copy Markdown
Owner

An agent vetted this plan before a merge (shepherd, 2026-11-14). Verdict: needs fix. Each point below blocks a correct build.

  1. The mutation run cannot give a result in a runner Job. The home of the Job is an emptyDir (sizeLimit 4Gi), so each Job starts with no mutants/ folder. mutmut 3.8.1 _run copies the tree, mutates all of src/devops_cli, and then runs collect_or_load_stats -> run_stats_collection over the whole suite, serially (pytest_add_cli_args = ["-n", "0"]), before it runs any mutant (.venv mutmut/main.py:658-700, 945-999). docs/commands/ci.md:347 says that this first run 'can take hours'. On main, each of the 4 CI test shards takes about 4.5 min on 4 workers, so a serial run takes much more than the 1800 s bound. design.md accepts this ('a bound is the normal end of the run') and makes the bound a pass. Result: no Job ever tests a mutant, so no surviving mutant ever goes to a repair round. Each scoped round still adds 1800 s, and with repair_rounds=3 that is up to 4 x 1800 s inside a Job deadline of 14400 s and an item limit of 12600 s. The plan does not count this time. The plan must change the design and get an owner decision: scope the mutmut stats run to the scoped test modules, keep the stats between Jobs, or take the mutation run out of the Job.
  2. Group 1 repeats a gate that already exists, and its scan can never report a finding. The static scoped check runs the constructs row (uv run ast-grep scan ... src tests, commands/ci.py:924). That row holds test-function-has-assertion for tests/** at severity error (constants CONST_TEST_CONSTRUCT_RULES), and the check runs before tests. Proof: a scratch file tests/vet_scratch/test_noassert.py on the PR head made the same scan report error[test-function-has-assertion] and exit 1. The strength check runs only after static passes, so its own scan of the same rule over the same files finds nothing. On main, the static scoped check and its repair loop already meet acceptance criterion 1. Replace group 1 with a replay test of the existing path, or cite the test that already exists, and remove the second scan.
  3. The coverage part gives false failures when the test selection is narrowed. Above CONST_ROADMAP_IMPLEMENT_SCOPED_TEST_MODULES (30) selected modules, plan_tests runs only the changed test modules (implement_scoped_ci.py:117-121). Any change to constants.py or messages.py triggers this ('333 of 725' modules, constants.py:3566). The plan still runs diff-cover with --fail-under 100 over every changed src line. A line that only unselected modules cover is then reported as uncovered, the strength check fails, the repair rounds run out, and the item stops Blocked, although the CI gate (90 %, ci.yml:292) passes it. Task 4.2 handles only the case where no test covers the change. Group 4 of this same plan changes messages.py.
  4. The shared job test world is not named (the feat(roadmap): Require a rejected alternative with a fact #3257 pattern, PLAUSIBLE, not proved because the code does not exist yet). Group 5 connects the strength check to _scoped_run. Every JobWorld test with a Python change gets to that point: 319 test parameters in 29 test files take job_world or planned_world from tests/support/roadmap_implement.py. The ProcessFake answers each command that has no match with exit 0 and empty output (tests/support/fakes/process.py:263). It writes no diff-cover markdown file, and it gives no JSON list from ast-grep. The plan names neither tests/support/roadmap_implement.py nor the job tests whose command lists and comment text change (for example tests/roadmap/implement/test_roadmap_implement_job_scoped.py).

Paths that the change must touch and that the plan does not name: tests/support/roadmap_implement.py, tests/roadmap/implement/test_roadmap_implement_job_scoped.py, docs/roadmap/package-layout.md, src/devops_cli/roadmap/implement/implement_scoped_ci.py (module docstring: three checks before the push)

Points that do not block:

  • The name in task 2.1 test_more_changed_files_than_CONST_ROADMAP_IMPLEMENT_SCOPED_TEST_MODULES_are_named fails ruff N802. The project selects "N", and ruff on a scratch copy reported invalid-function-name. Use a name in lowercase.
  • docs/roadmap/package-layout.md:12 lists every module of roadmap/implement/. Group 6 must add implement_strength to it (rule 8, the change makes the document wrong).
  • docs/ROADMAP_WORKFLOW.md:415 ('Time') says that the scoped checks add about 35 s plus at most about 3.5 min. Group 6 must give the time of the strength check. The module docstring of implement_scoped_ci.py says that the job runs three checks before the push.
  • Tasks 6.1 and 6.2 do the same work with two verify commands. Both commands are real (devops ci --check --only docs, devops ci docs).
  • Prose: the last decision in design.md ('The earlier reply named only files that the change creates...') is planner history, not text written as merged. The criteria line 'Pending person: Live proof: ..., Only a person can merge...' is garbled. Some design sentences have more than 25 words (ASD-STE100).
  • Task 2.2 does not give the base of select_targets. devops ci mutate uses main by default. The job worktree must use origin/<default>.
  • Task 4.2 leaves the src files of an other group out of the coverage delta, but it does not name the diff-cover option that does this (for example --exclude).
  • diff-cover --fail-under 100 is stricter than the CI gate of 90. This does not lower a threshold, but it stops items that CI passes. The owner must decide.
  • Risk, not measured: mutmut copies src, tests and the also_copy folders (about 51 MB, plus the mutated src) into mutants/ in the 4Gi home emptyDir of the Job.
  • The final plan fixes both points of the model review (claude-sonnet-5-5): the coverage now runs again with --cov, and the test uses _ItemRun.
  • No security control is weaker and no threshold is lower. --cov-fail-under=0 applies only to the strength coverage run, as in a CI shard. The commands use a fixed argv with no shell. No dependency is added: mutmut 3.8.1, diff-cover 11.0.1, pytest-cov 7.1.0 and ast-grep-cli 0.51.2 are dev pins, and the runner image installs the dev group (Dockerfile lock/runner-deps).

@dan-petty dan-petty added the verdict/fix-plan Verdict Needs fix of a plan: an open finding keeps the plan in draft until a fix label Nov 14, 2026
@dan-petty

Copy link
Copy Markdown
Owner

An agent vetted this plan before a merge (2026-11-14). Verdict: still needs work.

The plan cannot be built as written until fundamental design questions are resolved:

  1. The mutation testing step (mutmut) runs serial whole-suite stats collection (run_stats_collection with -n 0) inside an emptyDir home directory on each fresh Job, which takes hours and exceeds the 1800s step limit and 12600s item limit. Scoping the stats collection or taking mutation testing out of the per-job loop requires an architectural/owner decision.
  2. Group 1 duplicates the existing static constructs check (test-function-has-assertion), which already runs and gates PRs before tests execute.
  3. The diff-cover requirement with --fail-under 100 falsely fails when test selection is narrowed (e.g. changes to messages.py or constants.py), blocking items that pass CI's 90% gate.
  4. tests/support/roadmap_implement.py and tests/roadmap/implement/test_roadmap_implement_job_scoped.py must be accounted for in task lists and test worlds.

@dan-petty
dan-petty force-pushed the feat/3051-new-tests-of-an-implementation-are branch from 7a5fe7c to 72ade18 Compare November 14, 2026 14:23
@dan-petty

Copy link
Copy Markdown
Owner

An agent vetted this plan before a merge (2026-11-14). Verdict: ready.

  • Scoped mutmut stats collection via PYTEST_ADDOPTS=" ".join(tests) so stats collection runs only the scoped test modules within command_timeout_seconds.
  • Aligned diff-cover --fail-under to 90% matching project CI floor to handle narrowed test selections.
  • Removed duplicate scan and streamlined strength checks after scoped CI.
  • Named declared registry path tests/roadmap/test_roadmap_limit_classes.py in Task 2.1 to satisfy stage registry checks.
  • Plan check devops roadmap plan-check 5586 passed cleanly.

@dan-petty
dan-petty merged commit 5b9c7a2 into main Nov 14, 2026
22 checks passed
@dan-petty
dan-petty deleted the feat/3051-new-tests-of-an-implementation-are branch November 14, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/openspec OpenSpec changes, specs and their checks type/docs Type docs: a change to the documents verdict/fix-plan Verdict Needs fix of a plan: an open finding keeps the plan in draft until a fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant