Skip to content

feat(roadmap): refuse a self-named or untested plan #3321

Closed
1 of 1 issue completed
Closed

Description

@dan-petty

Problem or Motivation

The plan in PR #3278 (for #2441) held three defects that no gate refused, and a reviewer found them by reading:

  • Its group 3 is the task "Write the proposal, design, tasks and spec delta of the change in openspec/changes/2441-loki-monolithic-mode-and-no-memcached-service-account/". The plan is that folder, and it already existed under another name, 2441-loki-values-name-the-monolithic-deployment. The Impact section also listed the files of the plan as the Code and Documents that the change touches.
  • A spec scenario says that _loki_mode calls pytest.fail on SingleBinary, and no task adds a test for that. The rules of openspec/config.yaml say that a scenario is one that a test under tests/ can assert.
  • A comment in tests/commands/k8s/test_k8s.py that names SingleBinary was left out of the tasks, although the plan's own search (references SingleBinary, 4 files) listed it.

The premise of the plan was right (helm template of chart 20.0.2 gives the same render for SingleBinary and Monolithic, and memcached.enabled: false drops only loki-memcached).

Proposed Solution & Architectural Design

  1. Refuse a task or an Impact entry whose path is under openspec/changes/<own change>/: the plan folder is written by the stage job, not by a task of the plan.
  2. For each spec scenario that names a function or a file, require that a task in a behavior group names a test for it, or that the scenario says it holds by a command (helm template, git grep). Name the scenario that has neither.
  3. When the plan quotes a search that lists files (references X answered files N), require each listed file outside openspec/changes/archive/ to appear in a Changes list or in the design as left unchanged.

Target Subsystem

src/devops_cli/roadmap/stage_change.py (check_proposal), src/devops_cli/roadmap/stage_paths.py.

Source: #3278

Proposed design

Problem statement

The stage plan check accepts three defects. A task or an Impact entry can write the plan folder. A spec scenario can name code and have no behavior test. A quoted search can list a file that no task or design covers. A reviewer finds these by reading. The plan check must refuse them before the draft pull request opens.

Acceptance criteria

Requirement: Own change folder in a group path

The plan check SHALL return a problem when a group lists a path under openspec/changes// in changes.

Scenario: A group lists the plan proposal

  • WHEN A behavior group lists openspec/changes/3321-plan-check/proposal.md in changes and check_proposal receives change='3321-plan-check'.
  • THEN check_proposal returns one problem that names the path and the own change folder.

Requirement: Own change folder in a task code span

The plan check SHALL return a problem when a task code span names a path under openspec/changes//.

Scenario: A task names the plan tasks file

  • WHEN A behavior group's implementation names openspec/changes/3321-plan-check/tasks.md in a code span.
  • THEN check_proposal returns one problem that names the group and the path.

Requirement: Scenario with code needs a behavior test

The plan check SHALL return a problem for a spec scenario that names a function or a file and has no behavior test or command exception.

Scenario: A scenario names _loki_mode and no task tests it

  • WHEN A spec scenario's then names _loki_mode in a code span and no behavior group's test or verify names any function or file span of that scenario.
  • THEN check_proposal returns one problem that names the scenario and _loki_mode.

Requirement: Scenario command exception

The plan check SHALL accept a spec scenario that names a function or a file when the scenario names a command such as helm template or git grep.

Scenario: A scenario cites helm template

  • WHEN A spec scenario's then names _loki_mode and helm template in code spans.
  • THEN check_proposal returns no problem for that scenario.

Requirement: Quoted search file needs a change or design decision

The plan check SHALL return a problem for each file that a quoted references ... answered files N search lists outside openspec/changes/archive/ and that no group changes or design decision names.

Scenario: A quoted search lists an untouched test file

  • WHEN feasibility holds references SingleBinary answered files 1 and tests/commands/k8s/test_k8s.py, and no group changes or StageDecision names that path.
  • THEN check_proposal returns one problem that names tests/commands/k8s/test_k8s.py.

Requirement: Archived plan is skipped

The plan check SHALL skip a file under openspec/changes/archive/ that a quoted search lists.

Scenario: A quoted search lists an archived plan

  • WHEN feasibility holds references SingleBinary answered files 1 and openspec/changes/archive/2441-loki-values-name-the-monolithic-deployment/proposal.md.
  • THEN check_proposal returns no problem for that archived path.

Requirement: Design decision leaves a file unchanged

The plan check SHALL accept a file that a quoted search lists when a design decision names it as left unchanged.

Scenario: A design decision leaves the test unchanged

  • WHEN feasibility lists tests/commands/k8s/test_k8s.py and a StageDecision names that path and says it is left unchanged.
  • THEN check_proposal returns no problem for that path.

Existing Tool Considered

No alternatives check has run. No open, maintained tool covers this repository's internal OpenSpec plan validation. The change builds the check in check_proposal: about 5,000 tokens to implement, about 2,000 tokens per year to keep and fix, and half a working day of elapsed time.

Key questions

  • How does check_proposal learn the own change folder?: Add a required change keyword to check_proposal and pass the folder name from the stage job. Compare each path with openspec/changes//. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_paths.py, docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md]
    • Chosen: Add a change keyword to check_proposal. The stage job knows the folder, and check_proposal has no other reliable source.
    • Rejected: Derive the folder from the issue number and slug. The proposal does not hold the slug.
    • Rejected: Treat every openspec/changes/ path as the own folder. This refuses paths of other changes and the archive.
  • Which plan text fields count as a task or an Impact entry for the own-change check?: Check group.changes, the code spans of test, implementation, documentation and process, and the paths of verify. group.changes renders the Impact section. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_paths.py]
    • Chosen: Check changes, task code spans and verify paths. This covers the Impact section and the tasks in one pass.
    • Rejected: Check only changes. A task can name the plan folder and still pass.
    • Rejected: Check only the rendered Impact section. A task can name the plan folder and still pass.
  • How does the plan check identify a function or a file in a spec scenario?: Use code_spans on when and then. A span is a file when StagedTree.as_path returns it. A span is a function when it matches an identifier with a dot or an underscore. (best practice) [sources: src/devops_cli/roadmap/stage_paths.py, src/devops_cli/roadmap/step_files.py]
    • Chosen: Classify code spans by path and identifier pattern. This finds _loki_mode, pytest.fail and tests/... with no network.
    • Rejected: Treat every word in the scenario as a name. This reports prose words.
    • Rejected: Treat only file paths as names. This misses _loki_mode.
  • What satisfies a spec scenario that names a function or a file?: A behavior group's test must name one code span of the scenario, or its verify must name one path of the scenario. A code span with a space and a first word in helm, git, kubectl, uv, devops or gh also satisfies the scenario. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, openspec/config.yaml]
    • Chosen: One behavior group test or verify names one scenario span. This matches the issue example and keeps the check narrow.
    • Rejected: Every behavior group must name every span. This is too strict for a scenario with several names.
    • Rejected: The scenario name must appear in a test. Tests do not name scenarios.
  • How does the plan check read a quoted search and accept a listed file?: Scan feasibility, why and what_changes for references answered files . Collect paths from the same text with StagedTree.paths_in. Skip openspec/changes/archive/. Accept a path in any group.changes or StageDecision text. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_paths.py]
    • Chosen: Scan the plan text and accept changes or design decisions. The existing fields hold the search and the design, so no schema change is needed.
    • Rejected: Add a left_unchanged field to StageProposal. A design decision already states that a file is left unchanged.
    • Rejected: Scan only feasibility. The plan can quote the search in why.
  • Where do the new checks and messages live?: Put the path helpers in stage_paths.py and call them from check_proposal. Add one message for each problem to src/devops_cli/lang/en/messages.py. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_paths.py, src/devops_cli/lang/en/messages.py]
    • Chosen: Helpers in stage_paths.py, calls in check_proposal, messages in messages.py. Path logic already lives in stage_paths.py and the project keeps messages in one module.
    • Rejected: Put all checks in stage_change.py. This duplicates path logic that stage_paths.py owns.
    • Rejected: Write inline problem strings. The project uses MESSAGES for every problem.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 3, 2026
  2. dan-petty commented on Nov 3, 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/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. The checks prevent recurring plan defects found in review, but they are additive guards rather than a blocking failure.
    • Value: Medium. Each check catches a class of defect that a human reviewer found by reading, reducing rework on affected plans.
    • Effort: Medium. Three rules must parse plan structure, cross-reference scenarios with tasks, and match quoted search output to a Changes list in two existing modules.
    • Related: fix(roadmap): stage allows task groups that edit openspec change folders #3285, which asks for a different change. Both refuse tasks whose paths sit under openspec/changes/, but 3285 covers any change folder while the candidate targets the plan's own folder and adds two further validation rules.
  3. added
    priority/p2-medium
    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 b46b6bd (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Staged: branch feat/3321-the-plan-check-refuses-a-self, draft pull request #3335. 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. x: 4544 tokens

    The plan run made 2 model request(s), and used 151773 input tokens and 1127 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:

    • criterion_dropped at groups: The plan has one placeholder group. It has no task for the own-change path refusal, the scenario test rule or the quoted search rule. It also leaves out stage_paths.py and messages.py, and criteria is empty. Evidence: "Refuse a task or an Impact entry whose path is under openspec/changes//"
    • spec_delta_wrong at specs (roadmap-stage, added): The added requirement and its scenario hold only the text "x". No test can assert the scenario, and none of the seven requirements of the issue appears. Evidence: "x SHALL x"
    • verify_form at group 1: The command checks the OpenSpec files, not the new check_proposal behavior. It runs no test of the work in the group. Evidence: "uv run devops openspec check"
    • other at plan: The summary, the feasibility, the decisions and the group text are placeholders. The group has kind other and no test, so a reviewer cannot judge it against the issue. Evidence: ""implementation": "x""
  7. added 2 commits that reference this issue on Nov 3, 2026
  8. added
    status/planned
    and removed
    status/ready
    on Nov 3, 2026
  9. changed the title [-]feat(roadmap): the plan check refuses a self-referential task and a scenario with no test[/-] [+]feat(roadmap): refuse a self-named or untested plan[/+] 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 74 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
  14. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 15:26 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