Repository navigation
Description
Problem or Motivation
The plan in PR #3330 (for #3309) put its comment assertion in tests/roadmap/test_roadmap_stage_plan.py. plan_stage writes no comment. The comment is written by _stage_one in apply_stage, and tests/roadmap/test_roadmap_stage_apply.py already covers it. The stage path check accepted the test path because the file exists, and the model review of the plan did not catch the mismatch.
When a plan changes a function that writes an output, the test of its group must name the module that exercises that output. Otherwise the implementer writes a test that cannot fail on the base, or has to find the right module alone.
Proposed Solution & Architectural Design
- Add one rule to the stage prompt
src/devops_cli/ai/tasks/roadmap_stage_change.md: before it writes thetestof a behavior group, callreferencesfor the function whose behavior the group changes, and put the test in the test module that the answer lists. - Name the test module in the stage context for the functions that the issue cites, so the planner has the map before its first reply.
- Add a test to
tests/roadmap/test_roadmap_stage_prompt_rules.pythat asserts the prompt namesreferencesand the test module of a changed function.
Target Subsystem
src/devops_cli/ai/tasks/roadmap_stage_change.md, src/devops_cli/roadmap/stage.py (collect_context), tests/roadmap/test_roadmap_stage_prompt_rules.py.
Acceptance criteria
- The stage prompt asks the planner to call
referencesfor a changed function and to use the test module that the answer lists. - The stage context names the test modules that reference each function the issue cites.
- A prompt rule test fails when either text is absent.
Source: #3330
Proposed design
Problem statement
A stage plan put its comment test in tests/roadmap/test_roadmap_stage_plan.py. plan_stage writes no comment. _stage_one in apply_stage writes it, and tests/roadmap/test_roadmap_stage_apply.py covers it. The path check accepted the test path because the file exists, and the model review missed the mismatch. The stage request and the stage prompt must name the test module that exercises a changed function.
Acceptance criteria
Requirement: The stage prompts name the test module of a changed function
The stage prompts SHALL tell the planner to call references for the function that a behavior group changes and to write the test in a test module that the answer lists.
Scenario: The prompt rule test reads the sentence
- WHEN the prompt rule test loads
roadmap_stage_change.mdandroadmap_stage_split.md - THEN each prompt holds a sentence that names
referencesand the test module that the answer lists.
Requirement: The rule names the fallback for the base toolset
The stage prompts SHALL name the test modules of probes as the source when references is not among the planner's tools.
Scenario: The sentence names the fallback
- WHEN the prompt rule test reads the sentence that names
references - THEN the sentence names
probesas the source of the test module whenreferencesis not offered.
Requirement: The stage request names the test module of each cited function
The stage request SHALL name, in probes, each test module that holds the name of a function that the issue cites.
Scenario: A cited function has a test module
- WHEN the issue cites
_stage_oneandtests/roadmap/test_roadmap_stage_apply.pyholds that name - THEN the
probestext holds a line that namestests/roadmap/test_roadmap_stage_apply.pyfor_stage_one.
Requirement: The stage request states a cited function with no test module
The stage request SHALL state, in probes, that no test module holds the name of a cited function when none does.
Scenario: A cited function has no test module
- WHEN the issue cites
gone_functionand no test module holds that name - THEN the
probestext holds a line that says that no test module namesgone_function.
Requirement: The prompt rule test guards the sentence
The prompt rule test SHALL fail when a stage prompt lacks the sentence that names references and the test module that the answer lists.
Scenario: A prompt drops the sentence
- WHEN a stage prompt lacks the sentence
- THEN the prompt rule test fails with the name of that prompt.
Existing Tool Considered
No alternatives check has run. coverage.py with dynamic_context = test_function covers the mapping at run time and is open and maintained, but it needs a full test run, gives no static answer, and cannot run inside the planner's read-only, offline budget. The change builds its own code instead: about 60k tokens to build, keep and fix it, and about 4 hours.
Key questions
- Where is
collect_contextdefined?:collect_contextis defined insrc/devops_cli/roadmap/refine.py.src/devops_cli/roadmap/stage.pyimports it from there. Refine and stage both call it, so a change to it changes both inputs. [sources: src/devops_cli/roadmap/refine.py, src/devops_cli/roadmap/stage.py] - Where does the test-module map go?: The map goes in
probes.probe_premisealready resolves each cited identifier from read-only git commands at the staged commit.probesis stage-only, so refine keeps its input. (best practice) [sources: src/devops_cli/roadmap/stage.py, src/devops_cli/roadmap/stage_probe.py, src/devops_cli/ai/tasks/roadmap_stage_change.md]- Chosen:
probesfromstage_probe.py. It is stage-only, and it already holds the lines of each cited identifier. - Rejected:
contextfromcollect_context. Refine shares the function, so refine's input and snapshot change too. - Rejected: A new request key
test_modules. It needs a new prompt section and a new schema rule.
- Chosen:
- Is
referencesalways among the planner's tools?: No. The toolsetbaseoffers noreferencestool. A test sets the toolset tobaseand asserts that the planner gets none ofread_issue,find_issuesandreferences. [sources: tests/roadmap/test_roadmap_stage_plan.py, src/devops_cli/roadmap/stage.py] - Which prompts get the rule?:
roadmap_stage_change.mdandroadmap_stage_split.md. The split reply writes new groups, and each behavior group has atest. (best practice) [sources: tests/roadmap/test_roadmap_stage_prompt_rules.py, src/devops_cli/ai/tasks/roadmap_stage_split.md]- Chosen: Both stage prompts. The split reply writes new behavior groups with tests.
- Rejected:
roadmap_stage_change.mdonly. A split group then gets no rule for its test module.
- How does the job find the test modules of a cited function?: A word search of the identifier in
tests/at the staged commit. It reuses the text search that thereferencestool uses. The line lists the test modules in the order of their path. (best practice) [sources: src/devops_cli/roadmap/stage_probe.py, tests/roadmap/test_roadmap_stage_tools.py]- Chosen: A word search at the staged commit. It uses the same match as the
referencestool and needs no test run. - Rejected: A coverage run with
dynamic_context. It needs a full test run and cannot run in the planner's read-only budget. - Rejected: An import graph. A test imports a module, not a function, so the graph names no test.
- Chosen: A word search at the staged commit. It uses the same match as the
- How does the rule read when
referencesis not offered?: One conditional sentence. It says to callreferenceswhen the tool is offered, and to use the test modules ofprobeswhen it is not. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md, tests/roadmap/test_roadmap_stage_plan.py]- Chosen: One conditional sentence. One text holds both cases, so the two toolsets cannot drift.
- Rejected: A prompt for each toolset. Two texts must stay in step, and the rule is short.
- Rejected: No fallback. The base toolset then gets no rule.
- Does
plan_stagewrite the comment?: No._stage_onewrites the comment inapply_stage.tests/roadmap/test_roadmap_stage_apply.pycovers it, andtests/roadmap/test_roadmap_stage_plan.pydoes not. [sources: src/devops_cli/roadmap/stage.py, tests/roadmap/test_roadmap_stage_apply.py, tests/roadmap/test_roadmap_stage_plan.py] - Which test asserts the text of
probes?:test_the_model_input_holds_the_probe_of_each_cited_path_and_identifierintests/roadmap/test_roadmap_stage_plan.pyasserts the lines ofprobes. The change adds the new lines there. [sources: tests/roadmap/test_roadmap_stage_plan.py] - Where does the mapping code live?: In
src/devops_cli/roadmap/stage_probe.py, besideprobe_premise. That function already resolves each cited identifier and builds theprobestext. (best practice) [sources: src/devops_cli/roadmap/stage_probe.py, src/devops_cli/roadmap/stage.py]- Chosen:
stage_probe.py, besideprobe_premise. The identifier list and the git reads are already there. - Rejected: A new module. It adds a module for a function that belongs beside
probe_premise. - Rejected:
refine.py. Refine needs no test-module map, so its input would grow for nothing.
- Chosen:
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-06: partly.
Tool: coverage (https://pypi.org/project/coverage), Apache-2.0, last activity 2026-11-04, maintained.
Activity
dan-petty commentedon Nov 3, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.It prevents implementer rework by fixing test-module routing in generated plans, but does not block current work.Each misnamed test module causes a failed test or an orphaned assertion, so the rule saves repeated rework across plans.It requires editing the stage prompt, extending collect_context, and adding a prompt-rule test across three files.Both items ensure the plan names the correct test module in stage planning, but #3347 covers prompt-text changes while the candidate covers function-behavior changes.devops-cli-service commentedon Nov 3, 2026
Status set to Ready at 6c86ec9 (see proposed design in issue body).
[-]feat(roadmap): the stage context names the test module that exercises a changed function[/-][+]feat(roadmap): Name the test module for a changed function[/+]dan-petty commentedon Nov 6, 2026
The job shortened the title of this item. The summary had 73 characters, and the limit is 60. The type and the scope stay.
feat(roadmap): the stage context names the test module that exercises a changed functionfeat(roadmap): Name the test module for a changed functiondevops-cli-service commentedon Nov 6, 2026
Alternatives check: partly
Tool: coverage (https://pypi.org/project/coverage)
Covers:
dynamic_context = test_function, which is the function-to-test-module mapping the issue asks the planner for.Lacks:
testof a behavior group for a function that the plan changes before that change exists.tests/at the staged commit, so it cannot supply theprobeslines for a cited function without running the suite.Searches run:
Sources:
Checked on 2026-11-06. A person decides what this means for the item. The check changes no label and closes no issue.
1 remaining item
docs(openspec): plan #3389 Name the test module of a changed function
docs(openspec): plan #3389 Name the test module of a changed function (…
devops-cli-service commentedon Nov 16, 2026
Released in v0.160.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.160.0
devops-cli-service commentedon Nov 16, 2026
Live since 2026-11-16 03:02 UTC