Repository navigation
Description
Problem Description
When stage creates task groups for an item, it generates Reads: and Changes: lists for each group. During implement, the job calculates scoped tests dynamically with plan_tests() based on changed source files. If the tests selected by plan_tests() are not included in Reads:, the implement model does not have them in its initial context. Moreover, if any of those scoped tests fail on the base commit or are sensitive to the runner environment, stage does not detect the issue, leading to wasted implement turns and budget exhaustion.
Proposed Solution
- When
stageplans an item, runplan_tests()against the plannedChanges:list. - Include the identified test modules in
Reads:so the implement model has full context on tests that will gate the commit. - Validate that the identified scoped tests pass on the base commit before opening the staging pull request.
Expected vs Actual Behavior
Expected: The plan explicitly identifies which existing test modules cover the changed files, surfaces them in Reads:, and verifies they pass on the base commit.
Actual: stage only checks that file paths exist, leaving implement to discover and run tests that the model was never shown.
Environment Diagnostics
- DevOps CLI Version: 0.77.2
- Python Version: 3.14.10
- Execution Environment: Roadmap Service (Stage & Implement jobs)
Proposed design
Problem statement
Stage plans do not show the scoped tests that implement will run. The implement model must discover those tests, and a scoped test that fails on the base commit wastes implement turns. The change surfaces the scoped tests in each group's Reads list.
Acceptance criteria
Requirement: Scoped tests in plan reads
When stage plans a task group, it SHALL run plan_tests() against the group's planned Changes: list and add each selected test module to the group's Reads: list.
Scenario: Source change selects a test
- WHEN Stage plans a group whose
Changes:list contains a source file thatplan_tests()maps to a test module. - THEN The group's
Reads:list contains that test module.
Requirement: Existing reads preserved
Stage MUST keep every file that it already puts in a group's Reads: list and MUST add each scoped test module once.
Scenario: Scoped test is already in reads
- WHEN A test module selected by
plan_tests()is already in the group'sReads:list. - THEN The group's
Reads:list contains that module once and keeps the other files.
Requirement: No scoped tests
When plan_tests() returns no test module for a group, stage MUST leave the group's Reads: list unchanged.
Scenario: No test covers the change
- WHEN Stage plans a group whose
Changes:list yields no test module fromplan_tests(). - THEN The group's
Reads:list has the same files as before the scoped-test step.
Requirement: Missing scoped test path
When plan_tests() returns a test path that does not exist, stage MUST omit the path from Reads: and MUST record a warning in the plan.
Scenario: Scoped test path is missing
- WHEN
plan_tests()returns a test path that does not exist in the repository. - THEN The group's
Reads:list does not contain that path, and the plan records a warning that names the path.
Existing Tool Considered
No alternatives check has run. No external tool covers the stage plan Reads: integration. The change reuses the existing plan_tests() function and adds a small adapter. pytest-testmon is an open, maintained library that selects tests affected by code changes, but it lacks stage plan Reads: integration and needs coverage instrumentation. The adapter costs one function and its tests; it builds no new selector.
Key questions
- Which test-selection function should stage use?: Stage should reuse the existing
plan_tests()function that the implement job uses. Stage must not add a second selector. (best practice) [sources: tests/roadmap/implement/test_roadmap_implement_job_scoped.py]- Chosen: Reuse
plan_tests(). It keeps stage and implement on one selector and adds no new code to maintain. - Rejected: Build a stage selector. It duplicates the implement selector and can disagree with it.
- Rejected: Adopt
pytest-testmon. It needs coverage instrumentation and lacks the planReads:integration.
- Chosen: Reuse
- Which task group receives a scoped test module?: The group whose
Changes:list causesplan_tests()to return the module. Each group gets only its own scoped tests. (best practice) [sources: CONTEXT.md]- Chosen: Per group. The group is the unit of a step, and its inputs must fit the token budget.
- Rejected: All groups. It repeats the same test in every group and can exceed the step budget.
- Rejected: Item level only. It loses the link between a change and the test that covers it.
- What should stage do when
plan_tests()returns a test path that does not exist?: Stage should omit the path fromReads:and record a plan warning. Stage should not fail for an advisory selection result. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md]- Chosen: Omit and warn. The plan stays buildable and the missing test stays visible.
- Rejected: Fail staging. A stale test mapping stops an otherwise valid plan.
- Rejected: Add the path. A missing file gives the implement model no context.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-09: none.
Tool: none found.
Activity
dan-petty commentedon Nov 7, 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 reduces wasted implement turns and budget burn but does not block a broken pipeline.It saves model calls and prevents budget exhaustion on every stage that touches tested code.It requires wiring plan_tests() into stage, editing Reads generation, and adding a pre-PR validation step.Both concern stage including test files in the plan, but #3972 fixes a specific omitted test in Changes while the candidate generalizes via plan_tests() into Reads and adds a base-commit pass check.devops-cli-service commentedon Nov 8, 2026
Status set to Ready at 1f03ee3 (see proposed design in issue body).
Moved to new items: #4145.
devops-cli-service commentedon Nov 9, 2026
Alternatives check: none
Reason: The need is internal wiring. Stage's plan
Reads:lists must include the test modules that the project's ownplan_tests()selects, with a warning for missing paths and a base-commit check. My one web search found nothing relevant.pytest-testmonis open and maintained, but it selects tests from coverage data. It does not know the stage plan format, and it would add a second selector that could disagree withplan_tests(). No ADR rejects it by name.Tool: none found
Covers:
Lacks:
Reads:listsplan_tests()selectorTools considered:
Searches run:
Sources:
Checked on 2026-11-09. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 16, 2026
Released in v0.161.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.161.0
devops-cli-service commentedon Nov 16, 2026
Live since 2026-11-16 06:35 UTC