Skip to content

refactor(roadmap): end the kind inference of the plan reader #5218

Open

Description

@dan-petty

Problem or Motivation

#5205 keeps one old-form path in the reader: a group with no Kind: line gets its kind by inference. #5217 keeps another: a created path with no New lines: entry reads as 1 line. The project is alpha, so an old path goes and no shim stays (AGENTS.md). The inference is also weak: a case-first group that changes a path under src/ reads as behavior even when the writer meant manifest. It then gets the behavior-only gates (src/devops_cli/roadmap/stage/stage_paths.py:602, 651-653; src/devops_cli/roadmap/stage/stage_change.py:1270-1273, 1758-1767) and loses the manifest verify rule (src/devops_cli/roadmap/stage/stage_form.py:92-112).

The mechanical rewrite of the project cannot remove the old form as it is:

  • plan-recheck --confirm writes only the records with the result rewrite (src/devops_cli/commands/roadmap.py:930-934).
  • A folder gets rewrite only when the rewritten plan passes every gate and openspec validate (src/devops_cli/roadmap/plan_recheck.py:376-386).
  • At 8fdeea0, 18 active folders of open issues read. Only 3428, 3443 and 3445 pass the gates, and 2742 already has Kind: lines. The other 14 fail a gate that does not depend on the form (spec-delta, content, paths, eval-replay or security): 3075, 3244, 3253, 3296, 3318, 3320, 3391, 3394, 3427, 3429, 3446, 3485, 3574 and 3991. 3075 and 3244 also create paths.

So a form rewrite through the result rewrite leaves 14 folders in the old form, and a strict reader then refuses folders that main reads today. A check through plan-recheck does not show this, because the command applies the rewrite in memory before it reads (plan_recheck.py:345-348).

Proposed Solution & Architectural Design

Do as #3556 and #3912 did for the old verification form, with a form edit that does not depend on the gates.

  1. plan_rewrite.form_edits(root, files) gives the form edits alone: for each group with no Kind: line, the line with the kind of the inference of fix(roadmap): write and read the kind of each plan task group #5205; for each created path with no New lines: entry, the value 1. A form edit changes no fact: the reader gives the same proposal before and after it.
  2. plan_recheck applies the form edits in memory before the read, and records them as form on the record of each folder of an open issue that reads with them, whatever its gate result. rewrite_plan holds them too, so a rewrite record writes both.
  3. --confirm writes form of each record and rewrite of each rewrite record (src/devops_cli/commands/roadmap.py). The module docstring of plan_recheck.py and docs/roadmap/plan-recheck.md say so.
  4. In this PR, uv run devops roadmap plan-recheck --source <checkout> --confirm writes the form edits of each active folder on main in the old form. The edit changes only the files line and adds one line, so a task line that an implement branch ticks does not conflict.
  5. The reader then refuses a group with no Kind: line and a created path with no estimate. The reason names the folder and the command devops roadmap plan-recheck --source <checkout> --confirm, which writes the form edits on a checkout of main.
  6. Open plan heads in the old form. No person or workstation pushes to a bot plan branch, and no agent closes one. A head leaves the old form when fix-plan pushes a revision or a gated plan (the writer of fix(roadmap): write and read the kind of each plan task group #5205), or when the owner merges or closes it in the review that each plan PR gets. A folder that the owner merges after this PR gets its form edits from step 5 in an agent PR on main. Start condition: the validation table shows no open plan PR head in the old form, so fix-plan and implement never meet a head that the new reader refuses.

Target Subsystem

Roadmap: the plan reader (src/devops_cli/roadmap/plan_read.py) and the mechanical rewrite (src/devops_cli/roadmap/plan_rewrite.py, src/devops_cli/roadmap/plan_recheck.py).

Existing Tool Considered

plan_rewrite.py and devops roadmap plan-recheck --confirm (#3556, #3832) are the mechanical rewrite of the project. This issue gives them a write path for form edits. No other tool is needed. Cost to build (estimate): 0.6 M tokens and 2 hours elapsed. Keep: none. Fix: about 0.1 M tokens.

Acceptance Criteria

  • uv run pytest tests/roadmap/test_roadmap_plan_rewrite.py::test_a_group_with_no_kind_line_gets_the_inferred_kind and ::test_a_created_path_with_no_estimate_gets_one_line pass.
  • uv run pytest tests/roadmap/test_roadmap_plan_rewrite.py::test_a_form_edit_changes_no_fact passes for each fixture of tests/fixtures/roadmap/plan_heads/ and each old-form folder of the rewrite: the read of the edited files equals the read that the base reader gave of the old files, kept as a snapshot.
  • uv run pytest tests/roadmap/test_roadmap_plan_recheck.py::test_a_folder_that_fails_a_gate_gets_its_form_edits passes: a new-plan folder that reads gets form, and --confirm writes it.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_a_group_with_no_kind_line_is_a_read_error and ::test_a_created_path_with_no_estimate_is_a_read_error pass, and the reason names the folder and the command.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_a_plan_head_reads_with_its_kinds reads the form edit of each fixture with the kinds of fix(roadmap): write and read the kind of each plan task group #5205.
  • Raw-file check, by a script under .data/agent/scratch/: for each active folder of an open issue that read_change of origin/main reads, read_change of the raw files on the branch reads it with the same facts. At 8fdeea0 that is 18 folders. A PR comment gives the count on the base of the PR, 0 refused and 0 changed facts.
  • uv run devops roadmap plan-recheck --source <checkout> --json on the branch gives no read refusal that origin/main does not give.
  • uv run devops ci fail-to-pass --base origin/main shows that the two read-error tests and test_a_folder_that_fails_a_gate_gets_its_form_edits fail on the base and pass on the head. Each new test imports a new name inside its body, so the module collects on the base. The PR cites the run.
  • Validation table in a PR comment: each open plan PR head and each plan PR closed in the last 14 days, with the read on origin/main and on the branch and a column for the old form. No open head holds the old form.
  • uv run devops ci test tests/roadmap and uv run devops docs check pass.

Files

  • src/devops_cli/roadmap/plan_rewrite.py
  • src/devops_cli/roadmap/plan_recheck.py
  • src/devops_cli/commands/roadmap.py (the write of form)
  • src/devops_cli/roadmap/plan_read.py
  • src/devops_cli/lang/en/messages.py
  • tests/roadmap/test_roadmap_plan_rewrite.py
  • tests/roadmap/test_roadmap_plan_read.py
  • tests/roadmap/test_roadmap_plan_recheck.py
  • the command test of plan-recheck --confirm
  • openspec/changes//tasks.md (the form edits)
  • docs/roadmap/plan-recheck.md
  • docs/roadmap/plan-check.md
  • openspec/specs/roadmap-plan-check/spec.md
  • openspec/specs/roadmap-plan-recheck/spec.md

Dependencies

The stage job leaves this item out until that issue closes. The start condition of the solution must also hold before the work starts.

Related

#3556, #3832, #3912, #3981.

Source: #5211

Alternatives check of 2026-11-22: not-applicable.
Class: refactor, no search.
Tool: none found.

Proposed design

Problem statement

The plan reader infers a group kind and a created-path line count. #5205 and #5217 keep these old-form paths. The inference gives a wrong kind to a case-first group that changes a path under src/. That group gets behavior-only gates and loses the manifest verify rule. A strict reader would refuse 14 active folders that main reads today, because plan-recheck --confirm writes only folders whose rewrite passes every gate. The change writes form edits alone, then makes the reader strict.

Acceptance criteria

Requirement: Form edit writes a missing kind

plan_rewrite.form_edits SHALL write the kind that the #5205 inference gives into each group that has no Kind: line.

Scenario: test_a_group_with_no_kind_line_gets_the_inferred_kind

  • WHEN uv run pytest tests/roadmap/test_roadmap_plan_rewrite.py::test_a_group_with_no_kind_line_gets_the_inferred_kind runs.
  • THEN The test passes and the edited group holds the inferred kind.

Requirement: Form edit writes a missing estimate

plan_rewrite.form_edits SHALL write New lines: 1 for each created path that has no New lines: entry.

Scenario: test_a_created_path_with_no_estimate_gets_one_line

  • WHEN uv run pytest tests/roadmap/test_roadmap_plan_rewrite.py::test_a_created_path_with_no_estimate_gets_one_line runs.
  • THEN The test passes and the edited created path holds New lines: 1.

Requirement: Form edit changes no fact

A form edit SHALL leave the proposal that the reader gives unchanged.

Scenario: test_a_form_edit_changes_no_fact

  • WHEN uv run pytest tests/roadmap/test_roadmap_plan_rewrite.py::test_a_form_edit_changes_no_fact runs for each fixture of tests/fixtures/roadmap/plan_heads/ and each old-form folder of the rewrite.
  • THEN The read of the edited files equals the read that the base reader gave of the old files, kept as a snapshot.

Requirement: A folder that fails a gate gets form edits

plan_recheck SHALL apply the form edits in memory before the read and record them as form on each open-issue folder that reads with them, whatever its gate result.

Scenario: test_a_folder_that_fails_a_gate_gets_its_form_edits

  • WHEN uv run pytest tests/roadmap/test_roadmap_plan_recheck.py::test_a_folder_that_fails_a_gate_gets_its_form_edits runs.
  • THEN A new-plan folder that reads gets form, and --confirm writes it.

Requirement: Confirm writes form and rewrite edits

devops roadmap plan-recheck --confirm SHALL write the form edits of each record and the rewrite edits of each rewrite record, and the module docstring and docs/roadmap/plan-recheck.md SHALL state this.

Scenario: test_confirm_writes_form_and_rewrite

  • WHEN uv run pytest tests/roadmap/test_roadmap_plan_recheck.py::test_confirm_writes_form_and_rewrite runs.
  • THEN The test passes and the checkout holds both the form edits and the rewrite edits.

Requirement: A group with no kind line is a read error

The plan reader SHALL refuse a group with no Kind: line and name the folder and the command devops roadmap plan-recheck --source <checkout> --confirm in the reason.

Scenario: test_a_group_with_no_kind_line_is_a_read_error

  • WHEN uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_a_group_with_no_kind_line_is_a_read_error runs.
  • THEN The test passes and the reason names the folder and the command.

Requirement: A created path with no estimate is a read error

The plan reader SHALL refuse a created path with no New lines: entry and name the folder and the command in the reason.

Scenario: test_a_created_path_with_no_estimate_is_a_read_error

  • WHEN uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_a_created_path_with_no_estimate_is_a_read_error runs.
  • THEN The test passes and the reason names the folder and the command.

Requirement: A plan head reads with its kinds

read_change SHALL read each plan-head fixture after its form edit with the kinds of #5205.

Scenario: test_a_plan_head_reads_with_its_kinds

  • WHEN uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_a_plan_head_reads_with_its_kinds runs.
  • THEN Each fixture reads with the expected kinds.

Requirement: Raw files keep the same facts

The branch SHALL read the raw files of each active old-form folder with the same facts as read_change of origin/main.

Scenario: raw-file form comparison

  • WHEN A script under .data/agent/scratch/ reads each active old-form folder on the branch and on origin/main.
  • THEN The PR comment gives the count, 0 refused and 0 changed facts.

Requirement: Plan-recheck adds no read refusal

uv run devops roadmap plan-recheck --source <checkout> --json SHALL report no read refusal on the branch that origin/main does not report.

Scenario: plan-recheck read refusal comparison

  • WHEN uv run devops roadmap plan-recheck --source <checkout> --json runs on the branch and on origin/main.
  • THEN The branch has no read refusal that origin/main does not have.

Requirement: New tests fail on the base and pass on the head

uv run devops ci fail-to-pass --base origin/main SHALL show that the two read-error tests and test_a_folder_that_fails_a_gate_gets_its_form_edits fail on the base and pass on the head.

Scenario: fail-to-pass run

  • WHEN uv run devops ci fail-to-pass --base origin/main runs after each new test imports a new name inside its body.
  • THEN The command shows that the three tests fail on the base and pass on the head, and the PR cites the run.

Requirement: Validation table shows no open head in the old form

The PR comment SHALL list each open plan PR head and each plan PR closed in the last 14 days with its read on origin/main, its read on the branch and its old-form state.

Scenario: validation table

  • WHEN A script under .data/agent/scratch/ lists each open plan PR head and each plan PR closed in the last 14 days with its read on origin/main, its read on the branch and its old-form state.
  • THEN The PR comment gives the table, and no open head holds the old form.

Requirement: Roadmap tests and docs check pass

uv run devops ci test tests/roadmap and uv run devops docs check SHALL pass.

Scenario: roadmap test and docs check

  • WHEN uv run devops ci test tests/roadmap and uv run devops docs check run.
  • THEN Both commands pass.

Existing Tool Considered

The alternatives check of 2026-11-22 in the issue body gives not-applicable for a refactor and names no tool. The change therefore uses the project's own plan_rewrite.py and devops roadmap plan-recheck --confirm. It adds a form-edit write path to them. The written cost to build is 0.6 M tokens and 2 hours elapsed. The cost to fix is about 0.1 M tokens, and the cost to keep is none.

Key questions

  • Should plan_rewrite.form_edits be a separate function from the gate rewrite?: Yes. Add plan_rewrite.form_edits(root, files). It returns only the missing Kind: line and the missing New lines: edit. plan_recheck applies it before the read and records it whatever the gate result. (best practice) [sources: src/devops_cli/roadmap/plan_rewrite.py, src/devops_cli/roadmap/plan_recheck.py, docs/roadmap/plan-recheck.md]
    • Chosen: Separate form_edits function. It lets plan_recheck record form edits without a passing gate.
    • Rejected: Embed form edits in rewrite_plan. A folder that fails a gate gets no form edit, so 14 active folders keep the old form.
    • Rejected: No form edits; make the reader strict. The strict reader refuses active folders that main reads today.
  • Should plan_recheck record form edits on a folder that fails an unrelated gate?: Yes. plan_recheck applies the form edits in memory before the read. It records form on each open-issue folder that reads with them, whatever its gate result. (best practice) [sources: src/devops_cli/roadmap/plan_recheck.py, src/devops_cli/commands/roadmap.py, docs/roadmap/plan-recheck.md]
    • Chosen: Record form for each open-issue folder that reads. It removes the old form without a gate result.
    • Rejected: Record form only for rewrite records. 14 active folders fail an unrelated gate and keep the old form.
    • Rejected: Record form for every folder. A closed issue folder needs no write, and the issue says open issues only.
  • Should devops roadmap plan-recheck --confirm write both form and rewrite edits?: Yes. It writes the form edits of each record and the rewrite edits of each rewrite record. The module docstring and docs/roadmap/plan-recheck.md say so. (best practice) [sources: src/devops_cli/commands/roadmap.py, src/devops_cli/roadmap/plan_recheck.py, docs/roadmap/plan-recheck.md]
    • Chosen: Write both form and rewrite. It writes the form edits of a folder that fails a gate and the gate rewrite of a rewrite folder.
    • Rejected: Write rewrite only. It leaves 14 active folders in the old form.
    • Rejected: Write form only. It drops the gate rewrite that plan-recheck already writes.
  • Should the plan reader refuse a group with no Kind: line?: Yes. The reader refuses the group and names the folder and the command devops roadmap plan-recheck --source <checkout> --confirm in the reason. This ends the inference and the old path. (best practice) [sources: src/devops_cli/roadmap/plan_read.py, src/devops_cli/roadmap/stage/stage_paths.py, src/devops_cli/roadmap/stage/stage_form.py, AGENTS.md]
    • Chosen: Refuse the group. It ends the inference and the old path.
    • Rejected: Keep the inference. It keeps a wrong kind for a case-first group under src/ and gives behavior-only gates.
    • Rejected: Warn and infer. A warning leaves the wrong kind in the proposal.
  • Should the plan reader refuse a created path with no New lines: entry?: Yes. The reader refuses the path and names the folder and the command in the reason. This ends the default of 1 line and tells the writer. (best practice) [sources: src/devops_cli/roadmap/plan_read.py, src/devops_cli/roadmap/plan_rewrite.py]
    • Chosen: Refuse the path. It ends the default of 1 line and tells the writer.
    • Rejected: Keep the default of 1 line. It keeps the old path and gives no signal to the writer.
    • Rejected: Warn and use 1 line. A warning leaves the old path in the plan.
  • What value does a form edit write for a created path with no estimate?: The form edit writes New lines: 1. The old reader used 1, so the fact does not change. (best practice) [sources: src/devops_cli/roadmap/plan_read.py, src/devops_cli/roadmap/plan_rewrite.py]
    • Chosen: Write New lines: 1. It is the value that the old reader used, so the fact does not change.
    • Rejected: Write New lines: 0. It changes the fact and can fail a gate.
    • Rejected: Ask a person. The old reader gives 1, so the value is known.
  • Should a form edit change only the form lines and add one line?: Yes. The form edit changes only the form line and adds one line. It leaves each task line unchanged, so a task line that an implement branch ticks does not conflict. (best practice) [sources: src/devops_cli/roadmap/plan_rewrite.py, docs/roadmap/plan-recheck.md]
    • Chosen: Edit only the form lines and add one line. A task line that an implement branch ticks does not conflict.
    • Rejected: Rewrite the whole plan. It conflicts with a task line that an implement branch ticks.
    • Rejected: Ask a person. The form edit is mechanical and changes no fact.
  • How does the change keep open plan heads readable while the reader becomes strict?: The PR writes form edits to each active folder on main. fix-plan writes the new form on a revision or a gated plan. The start condition is that no open plan PR head is in the old form. The owner merges or closes each such head. (best practice) [sources: docs/roadmap/plan-recheck.md, src/devops_cli/roadmap/plan_recheck.py, src/devops_cli/commands/roadmap.py]
    • Chosen: Write form edits on main and clear open heads first. It keeps 0 heads broken and removes the old form from active folders.
    • Rejected: Ship the strict reader alone. It refuses active folders that main reads today and breaks plan heads.
    • Rejected: Keep the inference for open heads. It keeps the old path and the wrong kind.
  • Which open, maintained tool or library covers the need?: The alternatives check of 2026-11-22 in the issue body gives not-applicable for a refactor and names no tool. The change uses the project's own plan_rewrite.py and devops roadmap plan-recheck --confirm. The written cost to build is 0.6 M tokens and 2 hours elapsed. The cost to fix is about 0.1 M tokens, and the cost to keep is none. (best practice) [sources: src/devops_cli/roadmap/plan_rewrite.py, src/devops_cli/roadmap/plan_recheck.py, src/devops_cli/commands/roadmap.py]
    • Chosen: Use the project rewrite. It is the existing mechanical rewrite and needs a write path for form edits.
    • Rejected: Use an external tool or library. The alternatives check found no tool for the internal plan form.
    • Rejected: Build a new rewrite. The project already holds plan_rewrite.py and plan-recheck --confirm.

Fit

Fits in one pull request.

Suspected block

An open plan PR head in the old form. The owner merges or closes each such head, or fix-plan pushes a revision or a gated plan.

Dependencies

#6521, #5217

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/refactor
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Scope note from #5205 (PR #5262), 2026-11-12:

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

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Class: refactor. The check makes no search and no model call for an item of this class.

    Tool: none found

    Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.

  7. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 0857ee5 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  8. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  9. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

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/agentstatus/newtype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions