Skip to content

fix(roadmap): the stage plan of a module move covers every module its layout test forbids #3372

Closed

Description

@dan-petty

Problem or Motivation

The plan in pull request #3322 (for #3187) moves src/devops_cli/roadmap/ into job subpackages. Its spec scenario says that no top-level module name starts with intake, refine, stage or implement.

The plan moves only 15 of the 47 job modules. It leaves 32 top-level job modules, such as stage_ready.py, stage_verify.py, implement_run.py, implement_trace.py and implement_submit.py. The invariant test of the plan would fail on the tree that the plan produces. A reader finds this only by comparing the task list with the folder.

The plan also verifies one sampled import for each group, such as from devops_cli.roadmap.intake_model import, so a missed module in the same group passes the check.

Proposed Solution & Architectural Design

  1. In check_proposal (src/devops_cli/roadmap/stage_change.py), when a plan group moves a set of files by name prefix, require every module of that prefix in the tree to appear in the group changes or in a later group. Refuse a plan that leaves a module that its own spec scenario forbids.
  2. In the stage prompt (src/devops_cli/ai/tasks/roadmap_stage_change.md), ask the planner to name every module of the prefix, not the entry module only.
  3. A group that moves a set of files gives a verification that covers the set, such as one find or git grep command, and not one sample file.

Target Subsystem

src/devops_cli/roadmap/stage_change.py, src/devops_cli/ai/tasks/roadmap_stage_change.md

Existing Tool Considered

The tree walk of check_proposal and git mv cover the need. No new tool is needed. The cost is about 8k tokens and 45 minutes.

Proposed design

Problem statement

The stage plan for a module move can leave top-level job modules in place. Its own layout test then fails. The plan also verifies one sampled import, so a missed module passes the check. The change makes the plan check require every module of a moved name prefix and makes the prompt ask for a prefix-wide verification.

Acceptance criteria

Requirement: Refuse an omitted module of a moved prefix

The stage plan check SHALL refuse a group that moves a top-level module by name prefix and leaves another module of that prefix for no later group.

Scenario: A move group omits a module of its prefix

  • WHEN The staged tree holds src/devops_cli/roadmap/stage_ready.py and src/devops_cli/roadmap/stage_verify.py, and a group moves stage_ready.py to stage/ready.py with no later group.
  • THEN check_proposal returns a problem that names src/devops_cli/roadmap/stage_verify.py.

Requirement: Accept a later group that completes the prefix

The stage plan check SHALL accept a moved prefix when every module of that prefix appears in the move group or in a later group.

Scenario: A later group moves the missing module

  • WHEN The staged tree holds src/devops_cli/roadmap/stage_ready.py and src/devops_cli/roadmap/stage_verify.py, the first group moves stage_ready.py, and a later group moves stage_verify.py.
  • THEN check_proposal returns no problem for either module.

Requirement: Keep modules of another prefix out of the check

The stage plan check SHALL require only top-level modules whose names start with the moved prefix.

Scenario: A move group leaves an unrelated module

  • WHEN The staged tree holds src/devops_cli/roadmap/stage_ready.py and src/devops_cli/roadmap/status.py, and a group moves stage_ready.py.
  • THEN check_proposal returns no problem for src/devops_cli/roadmap/status.py.

Requirement: Ask the planner for every module of the prefix

The stage prompt SHALL tell the planner to list every module of a moved name prefix in the group changes.

Scenario: The stage prompt describes a prefix move

  • WHEN A test reads src/devops_cli/ai/tasks/roadmap_stage_change.md.
  • THEN The prompt text tells the planner to name every module of the prefix and not the entry module only.

Requirement: Refuse a sampled verify for a move group

The stage plan check SHALL refuse a move group whose verify command names one module of the prefix instead of the whole prefix.

Scenario: A move group verifies one sampled import

  • WHEN A move group for prefix stage gives the verify command ! git grep -n -F devops_cli.roadmap.stage_ready src/ tests/.
  • THEN check_proposal returns a problem that says the verify command must cover the prefix, and returns no such problem for ! git grep -n -F devops_cli.roadmap.stage src/ tests/.

Existing Tool Considered

No alternatives check has run. The plan builds its own check with the existing tree walk in check_proposal and git mv; no new external tool is needed. The written cost is about 8k tokens and 45 minutes.

Key questions

  • How does the plan check identify a move by name prefix?: A group moves a top-level module when its changes holds the old path and its creates holds the new path under a subpackage. The check takes the old stem up to the first _, or the whole stem when it has none, as the prefix. It requires every top-level module in tree whose stem starts with that prefix to appear in the group changes or in a later group changes. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_paths.py]
    • Chosen: Old and new path pairs. The existing changes and creates lists already record a move, so the check needs no new schema field.
    • Rejected: A new moves field. It expands the reply schema and the prompt for data that the existing path lists already hold.
    • Rejected: The group title. The title is free text and a planner can omit or change it.
  • Which verify command proves that a move group covers a whole name prefix?: Use one ! git grep command whose literal is the shared import prefix, such as devops_cli.roadmap.stage, and whose paths cover src/ and tests/. Refuse a literal that names one module, such as devops_cli.roadmap.stage_ready. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md, src/devops_cli/roadmap/stage_change.py]
    • Chosen: ! git grep with the prefix. The prompt permits this form, and one search covers every module of the prefix.
    • Rejected: find over the directory. The stage form rules permit only uv run devops and ! git grep commands.
    • Rejected: uv run pytest on one test. The prompt refuses this command, and one test does not prove the full tree.
  • Where does the prefix coverage rule run?: The rule runs in check_proposal, so the stage job and the replay judge the same plan. The prompt states the rule for the planner, but the check enforces it. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:253, src/devops_cli/roadmap/stage_change.py]
    • Chosen: check_proposal. The stage job and the replay already call it, so one rule judges both.
    • Rejected: The prompt only. A prompt tells the planner what to do but cannot refuse a bad plan.
    • Rejected: A new replay gate. The replay already treats check_proposal as its paths gate.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 3, 2026
  2. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Priority: P2-Medium. A plan that violates its own spec produces a broken tree, but the defect is in the planning tool, not in production code.
    • Related: feat(roadmap): Require a move plan to cover each reference #3373, which asks for a different change. Both address incomplete verification of the module-move plan in PR #3322, but #3373 finds missed references to moved modules while the candidate ensures every module of a prefix is included in the plan.
  3. added a commit that references this issue on Nov 3, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 3, 2026
  5. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    Staged: branch fix/3372-the-stage-plan-of-a-module, draft pull request #3378. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. Add the prefix coverage rule to the plan check: 21547 tokens
    2. Refuse a sampled verify command of a move group: 9104 tokens
    3. Ask the stage prompt for every module of a prefix: 11158 tokens

    The plan run made 2 model request(s), and used 150573 input tokens and 10190 output tokens. The model made no tool call.

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • verify_form at specs, group 2: The accepted verify literal devops_cli.roadmap.stage also matches devops_cli.roadmap.stage.ready, the import path after a correct move. The ! git grep command then fails on a correct tree. The check also matches devops_cli.roadmap.stage_change imports, so it accepts a literal that cannot pass. Evidence: "! git grep -n -F devops_cli.roadmap.stage src/ tests/"
  7. added a commit that references this issue on Nov 4, 2026
  8. dan-petty commented on Nov 4, 2026

    @dan-petty
    OwnerAuthor

    Premise correction for the verify scenario:
    ! git grep -n -F devops_cli.roadmap.stage src/ tests/ finds from devops_cli.roadmap.stage import on the staged tree and, after the move, devops_cli.roadmap.stage.ready. A negative search passes only on exit 1, so this literal can never pass on the tree that the plan produces. The literal also equals the import path of stage.py, so it is one sampled module.

    Plan pull request #3378 now refuses that literal and accepts devops_cli.roadmap.stage_. The general gap, that the stage gate never proves a negative search on the produced tree, is #3410.

  9. added a commit that references this issue on Nov 4, 2026
  10. added
    status/planned
    and removed
    status/ready
    on Nov 4, 2026
  11. added
    status/in-review
    and removed
    status/planned
    on Nov 4, 2026
  12. removed
    status/in-review
    on Nov 4, 2026
  13. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor
  14. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-04 04:36 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/lowpriority/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