Skip to content

feat(roadmap): Require a move plan to cover each reference #3373

Closed

Description

@dan-petty

Problem or Motivation

The plan in pull request #3322 (for #3187) moves 50 modules of src/devops_cli/roadmap/. Its first version planned to rewrite the imports of each caller and did not name the other references to a module. A string does not follow an import.

The tree has 37 quoted module targets in 12 test files, such as devops_cli.roadmap.implement_run in a monkeypatch.setattr call and in a caplog logger name. It also has five snapshot files keyed by the path of a test module, and the docstring of src/devops_cli/roadmap/__init__.py names devops_cli.roadmap.store. A move that rewrites only imports leaves each of these broken, and the tests fail after the implement step.

The plan's Impact named about 30 files. grep -rln 'devops_cli\.roadmap' src tests --include='*.py' | grep -v '^src/devops_cli/roadmap/' finds 173 files, so a reader cannot see the work from the plan.

Proposed Solution & Architectural Design

  1. When a plan moves or renames a module, the stage probe uses the references tool on the old module path and on its dotted name, and lists each hit in src/ and tests/, including a string literal and a snapshot path.
  2. check_proposal requires each such hit to appear in a group changes list or in the design as left unchanged.
  3. The stage prompt names a quoted target, a logger name and a snapshot file as references that an import rewrite does not update.
  4. A move plan gives a verification that searches src/ and tests/ for the old dotted name, and not only for from <old> import.

This differs from #3324, which scans the references of a removed entity. This issue scans the references of a moved path.

Target Subsystem

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

Existing Tool Considered

git grep and the existing references tool find a dotted name in an import and in a string. No new tool is needed. The cost is about 10k tokens and 1 hour.

Proposed design

Problem statement

A stage plan that moves 50 modules rewrites imports only. String literals, logger names and snapshot paths still name the old module, and the tests fail after the move. The plan's Impact list names about 30 files, but 173 files mention the package. A reader cannot see the full work.

Acceptance criteria

Requirement: Probe both names of a moved module

The stage prompt SHALL require the references tool on the old module path and on its dotted name when a plan moves a module.

Scenario: The prompt names both searches

  • WHEN The stage prompt is read.
  • THEN It holds the references tool, the old module path and the dotted name.

Requirement: List each reference hit

The stage reply SHALL list each reference hit in src/ and tests/ for a moved module.

Scenario: A string literal names the old module

  • WHEN A move plan lists a reference in a string literal under tests/.
  • THEN The parsed StageProposal holds a StageReference for that test path.

Requirement: Refuse an uncovered reference

check_proposal SHALL refuse a reference that no group changes and that the design does not leave unchanged.

Scenario: A reference is missing from the plan

  • WHEN A reference names tests/roadmap/test_x.py, no group lists that path in changes, and the reference is not unchanged.
  • THEN check_proposal returns a problem that names tests/roadmap/test_x.py.

Requirement: Accept a changed reference

check_proposal SHALL accept a reference when a group lists its path in changes.

Scenario: A group changes the reference file

  • WHEN A reference names tests/roadmap/test_x.py and one group lists that path in changes.
  • THEN check_proposal returns no reference problem for that path.

Requirement: Unchanged reference in the design

The design SHALL record each unchanged reference with its path and a reason.

Scenario: A snapshot stays keyed by the old module

  • WHEN A reply marks tests/snapshots/roadmap/test_x.ambr as unchanged with a reason.
  • THEN The rendered design.md holds that path and that reason.

Requirement: Prompt names non-import references

The stage prompt SHALL name a quoted target, a logger name and a snapshot file as references that an import rewrite does not update.

Scenario: The prompt lists the reference kinds

  • WHEN The stage prompt is read.
  • THEN It holds the words quoted target, logger name and snapshot file.

Requirement: Verification for a moved module

The stage prompt SHALL require a move plan to give a verification that searches src/ and tests/ for the old dotted name.

Scenario: The prompt states the verification

  • WHEN The stage prompt is read.
  • THEN It holds the ! git grep form, the old dotted name and both src/ and tests/.

Existing Tool Considered

No alternatives check has run. git grep and the existing references stage tool cover the search need. They lack a structured coverage check, so the change adds that check. The written cost is about 10k tokens and 1 hour.

Key questions

  • Which tool finds the references of a moved module?: Use git grep through the existing references stage tool. It already searches every file of the staged commit and keeps files from each group, including tests and snapshots. No new scanner is needed. (best practice) [sources: src/devops_cli/roadmap/stage_references.py, src/devops_cli/ai/tasks/roadmap_stage_change.md]
    • Chosen: Existing references tool. It runs git grep -n -F over the staged commit and keeps source, test, spec, document and change files.
    • Rejected: New AST scanner. It misses string literals and snapshot paths and adds code to build and keep.
    • Rejected: Import-only rewrite. A string does not follow an import, so it leaves broken references.
  • How does the plan record a reference that it leaves unchanged?: Add a structured StageReference entry to StageProposal. Each entry holds the path, its kind, an unchanged flag and a reason. _design_file renders each unchanged entry in design.md. check_proposal reads the flag and does not parse free text. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/ai/tasks/roadmap_stage_change.md]
    • Chosen: Structured reference list. A field is exact, and the design renders it from the same data.
    • Rejected: Free-text decision. A path in a decision is hard to check and easy to miss.
    • Rejected: Separate unchanged list. It splits one reference into two lists that can disagree.
  • Where does check_proposal get the reference hits?: The stage reply carries the hits from the references tool in the references list. check_proposal checks that list against the group changes and the unchanged entries. It runs no git, because the replay reads no git. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, docs/ROADMAP_WORKFLOW.md:253, src/devops_cli/roadmap/stage_references.py]
    • Chosen: Structured list in the reply. The job and the replay check the same reply without a git call.
    • Rejected: Re-run git grep in check_proposal. The replay reads no git, so the gate would fail on a recorded plan.
    • Rejected: Parse feasibility text. The text is free form and a path is easy to miss.
  • Which verification proves that the old dotted name is gone?: Use the ! git grep -n -F '' src/ tests/ form in the group verify. It fails when any file still names the old module, including a string literal or a snapshot key. A search for from import is not enough. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md, src/devops_cli/roadmap/stage_references.py]
    • Chosen: ! git grep on the old dotted name. The stage prompt allows this form, and it fails on any remaining literal.
    • Rejected: ! git grep on from import. It misses string literals, logger names and snapshot paths.
    • Rejected: No verification. A broken reference then reaches the implement step.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    source/agent
    scope/roadmap
    status/new
    value/medium
    effort/medium
    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. It improves plan correctness for module moves but does not block current work.
    • Related: feat(roadmap): Check test references to entities a plan removes #3324, which asks for a different change. Both add reference scanning to the stage probe, but #3324 targets a removed entity while this targets a moved or renamed module path.
  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 feat/3373-the-stage-plan-of-a-module, draft pull request #3379. 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. Carry the reference hits in the stage reply: 27392 tokens
    2. Refuse an uncovered reference and render an unchanged one: 22657 tokens
    3. Name the references and the verification in the stage prompt: 11575 tokens

    The plan run made 3 model request(s), and used 226324 input tokens and 12488 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:

    • other at group 3: The plan adds references to StageProposal but never adds a references bullet to the reply-keys section of the prompt. The existing test then fails after group 1, and group 3 would not fix it. Evidence: "assert sorted(bullets) == sorted(StageProposal.model_fields)"
    • other at what_changes: The plan promises messages in the roadmap message catalogue. No group changes or creates a catalogue file, and group 2 puts the message text in stage_change.py, so the task is missing or the plan contradicts itself. Evidence: "Add the stage messages for the reference problems to the roadmap message catalogue."
  7. added 3 commits that reference this issue on Nov 4, 2026
  8. added
    status/planned
    and removed
    status/ready
    on Nov 4, 2026
  9. changed the title [-]feat(roadmap): the stage plan of a module move finds the references that an import rewrite misses[/-] [+]feat(roadmap): Require a move plan to cover each reference[/+] on Nov 6, 2026
  10. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 82 characters, and the limit is 60. The type and the scope stay.

  11. added
    status/in-progress
    status/in-review
    and removed
    status/planned
    status/in-progress
    on Nov 8, 2026
  12. removed
    status/in-review
    on Nov 8, 2026
  13. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 17:21 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