Skip to content

fix(roadmap): refuse a behavior group that omits a test it changes #3414

Closed

Description

@dan-petty

Problem

The stage service checks that the paths a plan names exist at the staged commit. It does not check that the plan names an existing test the change will break. A plan can name the test it creates and omit the existing test that pins the behavior it changes, and still pass every stage check.

Evidence

The plan of #3351 is the case. It named the two test files it created and the source file it changes, but not tests/roadmap/test_roadmap_implement_step.py. That file holds the two assertions the change updates, The first group (#1) and Make check Static Analysis pass (#1). A review caught the omission. The implement job would have met that failure with no name for it in the plan.

Suggestion

A behavior group that changes an existing source file SHALL name the existing test it updates, not only the test it creates. The problem SHALL name the group, the source path, and the existing test the group does not name.

Source: #3352

Proposed design

Problem statement

The stage plan validation checks that each path a plan names exists at the staged commit, but it does not require a behavior group that changes an existing source file to name the existing test that pins the behavior it changes. A plan can name only the test it creates and pass every stage check; the implement job then meets the broken existing test with no name for it in the plan. The plan validation SHALL refuse such a group and name the group, the source path and the missing existing test.

Acceptance criteria

Requirement: Refuse a behavior group that omits its existing test

The stage plan validation SHALL refuse a behavior group that changes an existing source file under src/ and names no existing test file that imports that module or follows the repository test naming convention for it.

Scenario: A source change names only a new test

  • WHEN A group names src/devops_cli/roadmap/implement_step.py and the new file tests/roadmap/test_implement_step_more.py, and the staged tree holds tests/roadmap/test_roadmap_implement_step.py, which imports that module.
  • THEN The stage plan validation exits nonzero and its message names the group, src/devops_cli/roadmap/implement_step.py and tests/roadmap/test_roadmap_implement_step.py.

Requirement: Accept a named existing test that imports the module

The stage plan validation SHALL accept a behavior group that changes an existing source file under src/ and names at least one existing test file that imports that module.

Scenario: The existing test imports the module and its file name differs from the module name

  • WHEN A group names src/devops_cli/roadmap/step_files.py and tests/roadmap/test_roadmap_implement_step.py, which imports that module.
  • THEN The stage plan validation exits zero for that group.

Requirement: Exempt a source file with no existing test

The stage plan validation SHALL accept a behavior group that changes an existing source file under src/ when the staged tree holds no test file that imports that module and no test file that follows the repository test naming convention for it.

Scenario: An existing module has no existing test

  • WHEN A group names src/devops_cli/roadmap/untested.py and a new test file with another name, and the staged tree holds no test file for that module.
  • THEN The stage plan validation exits zero for that group.

Requirement: Exclude the test files the plan creates

The stage plan validation MUST leave out every test path that the plan lists in creates, so that a test file that the plan creates is no existing test.

Scenario: The plan creates the only test for a module it also changes

  • WHEN A group names src/devops_cli/roadmap/untested.py and creates tests/roadmap/test_roadmap_untested.py, and the staged tree holds no test file for that module.
  • THEN The stage plan validation exits zero for that group.

Requirement: Report one problem for each offending group

The stage plan validation SHALL report one problem for each behavior group that omits an existing test file that imports the source module it changes.

Scenario: Two groups omit their existing tests

  • WHEN Group 1 names src/devops_cli/roadmap/implement_step.py and group 2 names src/devops_cli/roadmap/step_files.py, and neither group names tests/roadmap/test_roadmap_implement_step.py.
  • THEN The stage plan validation exits nonzero and reports two problems, one for each group.

Existing Tool Considered

No open, maintained tool or library covers this repository-specific stage validation: the rule reads the src/devops_cli/ layout and the tests/ naming convention of this repository, and it must run inside the stage job with no test suite. The project builds its own check in path_problems of src/devops_cli/roadmap/stage_paths.py. The written cost is about 6,000 tokens to build, keep and fix that check, and about 1 hour of elapsed time.

Key questions

  • Which existing test holds the two assertions that the plan of feat(roadmap): the implement job formats step commits with conventional prefixes #3351 updates?: tests/roadmap/test_roadmap_implement_step.py holds chore: The first group (#1) and chore: Make check Static Analysis pass (#1); the plan of feat(roadmap): the implement job formats step commits with conventional prefixes #3351 named only the new test file tests/roadmap/test_roadmap_implement_step_commit.py in its changes. [sources: tests/roadmap/test_roadmap_implement_step.py:282, openspec/changes/archive/2026-11-04-3351-the-implement-job-formats-step-commits/tasks.md:14, openspec/changes/archive/2026-11-04-3351-the-implement-job-formats-step-commits/tasks.md:20]
  • Does the stage plan validation already require an existing test for a changed source file?: No. path_problems only reports a named path that the tree lacks and that no earlier group creates; it never requires a test path. [sources: src/devops_cli/roadmap/stage_paths.py:202, src/devops_cli/roadmap/stage_change.py:618]
  • Where shall the stage service refuse a plan that omits an existing test?: In the stage plan validation, as a rule beside path_problems in src/devops_cli/roadmap/stage_paths.py, called from check_proposal. It reads the staged tree and the groups, like the path check. (best practice) [sources: src/devops_cli/roadmap/stage_change.py:618, src/devops_cli/roadmap/stage_paths.py:202]
    • Chosen: A rule beside path_problems, called from check_proposal. It reuses the staged tree and the one rule set of the stage job and the replay.
    • Rejected: Extend path_problems itself. The path check reports a missing path once per path; a missing test is a different problem per group, so a separate rule keeps both clear.
    • Rejected: Refuse in the inputs of an implement step. It runs after a person merges the plan, so a refusal costs an implement step.
    • Rejected: State the rule in the planner instructions only. An instruction is no check, so the plan still passes every stage check.
  • How shall the check identify the existing test that a behavior group must name?: Use a static candidate set in the staged tree: test files under tests/ that import the changed module, plus test files that follow the naming convention tests//test_.py. Require at least one named candidate. Exempt the group when the set is empty. (best practice) [sources: tests/roadmap/test_roadmap_implement_step.py:282, src/devops_cli/roadmap/stage_paths.py:76]
    • Chosen: Static import and naming scan. It is deterministic, it finds the feat(roadmap): the implement job formats step commits with conventional prefixes #3351 test, and it runs no test suite.
    • Rejected: Run the test suite. It is slow, it needs dependencies, and stage validation must not execute tests.
    • Rejected: Exact file name convention only. It misses a test file whose name differs from the module name, such as test_roadmap_implement_step.py for step_files.py.
    • Rejected: Any existing test under tests/. An unrelated test would satisfy the rule and hide the omission.
  • What shall the check do when the staged tree holds no existing test for the module?: Accept the group. A module with no existing test has no test to update. The group must still name a test path, new or existing. (best practice) [sources: src/devops_cli/roadmap/stage_change.py:340]
    • Chosen: Exempt the group. It avoids a false refusal for a new module or an untested module.
    • Rejected: Refuse every source change. It blocks a new module that has no prior test to update.
    • Rejected: Warn only. The issue requires a refusal when an existing test is omitted.
  • What shall the refusal message contain?: The group number and title, the source path, and every missing existing test candidate. One problem covers one group. (best practice) [sources: src/devops_cli/roadmap/stage_paths.py:174]
    • Chosen: Group, source and every candidate. It gives the implementer the exact omission and the test paths to add.
    • Rejected: Group and source only. The implementer must search for the missing test.
    • Rejected: The first candidate only. It hides another existing test that the change may break.
  • Which named files make a task group a behavior group?: A group is a behavior group when its kind is behavior, which already requires a change under src/ (_SOURCE_DIRECTORY). A group of kind other and a group that changes no file under src/ are no behavior groups. [sources: src/devops_cli/roadmap/stage_change.py:105, src/devops_cli/roadmap/stage_change.py:340]
  • Which tree shall the check read to find the existing tests?: The staged tree that check_proposal already receives, leaving out every test path that the plan lists in creates. This is the base tree plus the change folder and nothing the plan itself creates, so no test that the plan creates counts as existing. (best practice) [sources: src/devops_cli/roadmap/stage_paths.py:202, src/devops_cli/roadmap/stage_paths.py:191]
    • Chosen: The staged tree, less the paths the plan creates. It is the tree the other plan checks read, and a created test is no existing test.
    • Rejected: The worktree of the plan. Every group would pass, because the plan creates its own test file.
    • Rejected: A separate base-commit read. It adds a checkout read for a result the staged tree and the creates lists already give.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-06: none.
Tool: none found.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 4, 2026
  2. dan-petty commented on Nov 4, 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/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. Prevents a class of plan errors that currently require human review to catch, but does not block shipping.
    • Value: Medium. Removes a recurring manual-review burden and prevents implement jobs from failing on unnameable test changes.
    • Effort: Medium. Requires mapping source-file changes to the existing test files that assert their behavior, which needs coverage analysis.
    • Related: feat(roadmap): Name the test module for a changed function #3389, which asks for a different change. Both ensure a plan names the test file for a changed function, but #3389 provides the correct test module name to the plan while the candidate refuses a plan that omits it.
  3. added
    priority/p2-medium
    on Nov 4, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 4, 2026
  5. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

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

  6. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    The stage job returned the item to New. The premise of the issue does not hold at the staging commit, so the job planned no change and opened no pull request.

    Evidence:

    placeholder

  7. added
    status/new
    and removed
    status/ready
    status/new
    on Nov 4, 2026
  8. 25 remaining items

  9. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    The runner Job devops-cli-runner-20261110-122751-3b94 ended: succeeded.
    Image digest: sha256:4e4c13460c63a1974b17116e0ca085e2079ee8a31822b89c86b41990fa1659cc

    The last lines of its log:

    Tool call: read_file, ok.
    Tool call: shell, started: git status --short
    Tool call: shell, program git, ok.
    Tool call: read_file, ok.
    Tool call: read_file, ok.
    Tool call: shell, started: git log --oneline -3
    Tool call: shell, started: git diff HEAD --stat
    Tool call: shell, program git, ok.
    Tool call: shell, program git, ok.
    Tool call: shell, started: git show --stat 438e72e8
    Tool call: shell, program git, ok.
    Tool call: shell, started: git show 438e72e8 -- docs/ROADMAP_WORKFLOW.md docs/roadmap/plan-check.md
    Tool call: shell, program git, ok.
    Tool call: grep, ok.
    Tool call: shell, started: uv run devops ci docs
    Tool call: shell, program uv, ok.
    Tool call: shell, started: git status --short --untracked-files=<masked>
    Tool call: shell, program git, ok.
    The checks of pull request #4356 still run after 37 s.
    The checks of pull request #4356 still run after 73 s.
    The checks of pull request #4356 still run after 109 s.
    The checks of pull request #4356 still run after 144 s.
    The checks of pull request #4356 still run after 180 s.
    The checks of pull request #4356 still run after 215 s.
    The checks of pull request #4356 still run after 256 s.
    The checks of pull request #4356 still run after 295 s.
    The checks of pull request #4356 still run after 335 s.
    The checks of pull request #4356 still run after 374 s.
    The checks of pull request #4356 still run after 413 s.
    The checks of pull request #4356 still run after 452 s.
    The checks of pull request #4356 still run after 492 s.
    The checks of pull request #4356 still run after 531 s.
    The checks of pull request #4356 still run after 570 s.
    The checks of pull request #4356 still run after 609 s.
    The checks of pull request #4356 still run after 648 s.
    The checks of pull request #4356 still run after 686 s.
    The checks of pull request #4356 still run after 725 s.
    Failure class conflict. Action left: wait.
    ✓ Took 0 item(s) to a ready pull request, stopped 1.
    Elapsed: 1h 7m 47s
    
  10. removed
    owner/service
    on Nov 10, 2026
  11. added
    status/in-review
    and removed
    status/blocked
    on Nov 10, 2026
  12. removed
    status/in-review
    on Nov 10, 2026
  13. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-10 14:35 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/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions