Skip to content

fix(roadmap): write and read the kind of each plan task group #5205

Closed

Description

@dan-petty

Problem or Motivation

The stage job pushes plans that its own plan reader refuses.

  • feat(roadmap): add a test-first manifest kind to the stage plan #3981 (8476163, 2026-11-07) added the kind manifest to the stage writer. It changed no line of the reader (git show --stat 847616309).
  • The writer renders a manifest group with the same tasks as a behavior group, and it writes no Kind: line (_task_texts and group_text, src/devops_cli/roadmap/stage/stage_change.py:2655-2730; stage_group_files in src/devops_cli/lang/en/messages.py).
  • The reader gives only behavior or other (_kind, src/devops_cli/roadmap/plan_read.py:348-352). _group has no manifest branch (plan_read.py:371-421). So the reader reads each manifest group as behavior.
  • A manifest group that changes no path under src/ then breaks the fix(roadmap): a stage group has a kind with its own tasks #3035 rule stage_kind_no_source (stage_change.py:552-565), and read_change raises PlanReadError. The fix(roadmap): a stage group has a kind with its own tasks #3035 rule is correct. The missing reader change is the cause.
  • Live cases: docs(openspec): plan #2968 Emit inbox gauges and add the inbox panel #4963 group 3 (head 9c4b2cf) and docs(openspec): plan #4697 Keep one metric stream per workload #5032 groups 3 and 4 (head 7fd165f). The Plan Check job reported the error on both heads (jobs 131044430778 and 131118707993). fix-plan, plan-recheck and implement cannot read these plans.
  • The reader also drops ## Unchanged references of design.md (plan_read.py:480-514), which the writer writes (stage_change.py:2638-2643). fix-plan gates the read plan again with the moved-module references (src/devops_cli/roadmap/stage/stage.py:1924, 1942), so a valid move plan fails after the round trip (stage_change.py:1142-1158). No open plan has this problem today.
  • The text of stage_kind_no_source tells the planner to use the kind other. That is wrong for a test-first manifest group, because an other group has no test (stage_change.py:579-591).
  • docs/TESTING.md:63, k8s/README.md item 15 and the living spec 'A task group has a kind' (openspec/specs/roadmap-stage/task-groups/spec.md:98-99) name only behavior and other.
  • The one round-trip test uses one behavior group (tests/roadmap/test_roadmap_plan_read.py:39). The golden set (tests/fixtures/roadmap_eval/stage/) has 145 behavior groups, 21 other groups and no manifest group.

Proposed Solution & Architectural Design

Write-then-read keeps each fact that the plan files hold.

  1. Writer. stage_group_files becomes Kind: {kind}. Reads: {reads}. Changes: {changes}.. Hand-written plans use this form already (openspec/changes/2742-bound-the-number-of-prewarm-model/tasks.md). KIND_LINE (src/devops_cli/roadmap/step_files.py:36, start of line) and _READS (plan_read.py:68-70, a search) parse it. TaskGroup.is_behavior gives the same value as before for each group that the writer makes.
  2. Reader, explicit kind. A Kind: line sets the kind, for each value of GroupKind. An unknown word raises PlanReadError, and the reason names the word and the known kinds. _group gets a manifest branch that keeps the case task as test. A change of _kind alone is not sufficient: the group then reads as other with no test.
  3. Reader, no Kind: line (a plan written before this change). A case-first group reads as behavior when it changes a path under src/, else as manifest. Each other group reads as other. This is the only old-form path. Its end is refactor(roadmap): end the kind inference of the plan reader #5218 (refactor(roadmap): end the kind inference of the plan reader): a form edit of plan_rewrite.py writes the Kind: line into each old plan, whatever its gate result, and the inference goes. The module docstring and the spec name that end.
  4. Reader, references. Read ## Unchanged references into references.
  5. Contract. plan_read.FIELDS_NOT_IN_FILES names the fields that no file holds: summary, pull_request_body, builds_own, creates_lines and weakened_checks (a person writes these, feat(roadmap): the step guard allows a test removal that the plan records #3490). plan_read.file_facts(proposal) gives proposal with these fields at the values that the reader gives, with only the references whose unchanged is true, with the specs in path order, and with each documentation in the form that the writer renders. A changed reference is no fact of the files: the writer writes only the unchanged references (stage_change.py:2638-2643), and the gate of moved modules reads only those (stage_change.py:1142-1158). The property tests use file_facts, and fix(roadmap): stage reads each plan back before the push #5214 uses it at run time. fix(roadmap): plan files keep the cost mark and line estimates #5217 removes builds_own and creates_lines from the set. This is the documented contract of the reader, not a list of skipped checks, and tests hold it.
  6. Text. stage_kind_no_source names manifest for a group that changes only a rule, a dashboard or a case file, and other for a group with no test.
  7. Callers. The implement split renders its new groups with group_text (src/devops_cli/roadmap/implement/implement_run.py:1060), so they get the Kind: line too. measure_groups (stage_change.py:2905) counts the new line.
  8. A model text that holds a mark of the reader (an inline 'verify that <command> passes' at the end of a process, or the process mark in an implementation) is outside this contract. The property generator does not make such texts. fix(roadmap): stage reads each plan back before the push #5214 sends such a text back to the model.

Target Subsystem

Roadmap: the stage writer (src/devops_cli/roadmap/stage/stage_change.py) and the plan reader (src/devops_cli/roadmap/plan_read.py, src/devops_cli/roadmap/step_files.py).

Existing Tool Considered

  • OpenSpec has no field for the kind of a task group. openspec validate checks only the spec deltas, so tasks.md is the format of this project.
  • A serialized plan (pydantic JSON in .openspec.yaml or in a file beside it) gives an exact round trip. Rejected: persons and the implement agent read and edit the Markdown, so a hand edit makes two sources disagree, and the active plans on main have no JSON.
  • Hypothesis (pinned at pyproject.toml:117) generates the group shapes for the property tests. syrupy holds the snapshots.
  • Cost to build (estimate): 1.5 M tokens and 4 hours elapsed. Keep: the new tests add about 30 s to CI. Fix: about 0.3 M tokens for each reader defect that a property test finds.

Acceptance Criteria

  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_each_group_kind_reads_back passes for behavior, manifest and other.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_no_fact_is_lost (Hypothesis): the generator makes each kind, created paths, and unchanged and changed references. For each generated valid proposal p, read_change(render_change(p)) == file_facts(p).
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_a_read_plan_is_a_fixed_point (Hypothesis): with q = read_change(render_change(p)), read_change(render_change(q)) == q.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_the_fields_that_no_file_holds holds FIELDS_NOT_IN_FILES to the five names.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_a_changed_reference_is_no_fact_of_the_files: a proposal with one changed and one unchanged reference reads back with only the unchanged one, and file_facts gives the same.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_each_golden_plan_reads_back passes for each golden plan.json that validates and for a new manifest case in tests/fixtures/roadmap_eval/stage/.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_a_plan_head_reads_with_its_kinds reads the change folders in tests/fixtures/roadmap/plan_heads/ (docs(openspec): plan #2968 Emit inbox gauges and add the inbox panel #4963 at 9c4b2cf, docs(openspec): plan #4697 Keep one metric stream per workload #5032 at 7fd165f, and docs(openspec): plan #3785 Remove the profiler exclusion of the hawk node #5182 at its head, which reads today) with no PlanReadError. It gives manifest for docs(openspec): plan #2968 Emit inbox gauges and add the inbox panel #4963 group 3 and docs(openspec): plan #4697 Keep one metric stream per workload #5032 groups 3 and 4, and behavior for the other case-first groups.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py -k 'explicit_kind_line_sets_the_kind or unknown_kind_is_a_read_error or unchanged_references_read_back' passes.
  • uv run devops ci test tests/roadmap/stage tests/roadmap/implement/test_roadmap_implement_resplit.py passes, with tests/roadmap/stage/__snapshots__/test_roadmap_stage_plan.ambr updated for the Kind: line.
  • uv run devops ci fail-to-pass --base origin/main shows that these tests fail on the base and pass on the head: the manifest case of test_each_group_kind_reads_back, test_a_plan_head_reads_with_its_kinds, the manifest and other cases of test_explicit_kind_line_sets_the_kind, test_unknown_kind_is_a_read_error and test_unchanged_references_read_back. The behavior and other cases of test_each_group_kind_reads_back are guards that pass on both. Each new test imports a new name inside its body, so the module collects on the base (a file that does not collect on the base is an error, not a fail: src/devops_cli/ci/fail_to_pass.py). The PR cites the run.
  • Validation table in a PR comment, over each open plan PR head and each plan PR closed in the last 14 days (no cap): the read on origin/main and on the branch (OK, or the reason) and the kinds read. uv run devops roadmap plan-check <n> --json gives the open rows. No head that origin/main reads is refused on the branch, no head is refused with stage_kind_no_source, and docs(openspec): plan #2968 Emit inbox gauges and add the inbox panel #4963 and docs(openspec): plan #4697 Keep one metric stream per workload #5032 read.
  • uv run devops docs check passes.

Files

  • src/devops_cli/roadmap/stage/stage_change.py
  • src/devops_cli/roadmap/plan_read.py
  • src/devops_cli/roadmap/step_files.py
  • src/devops_cli/lang/en/messages.py
  • tests/roadmap/test_roadmap_plan_read.py
  • tests/roadmap/stage/test_roadmap_stage_plan.py
  • tests/roadmap/stage/snapshots/test_roadmap_stage_plan.ambr
  • tests/roadmap/implement/test_roadmap_implement_resplit.py
  • tests/fixtures/roadmap/plan_heads/ (new: three real heads)
  • tests/fixtures/roadmap_eval/stage/ (one new manifest case)
  • the other test and fixture files that hold a rendered files line (about 30)
  • docs/TESTING.md
  • docs/roadmap/plan-check.md
  • k8s/README.md (item 15, the kinds)
  • openspec/specs/roadmap-stage/task-groups/spec.md
  • openspec/specs/roadmap-plan-check/spec.md

Dependencies

None. This item is the first of its set.

Related

#3981, #3035, #3425, #3602, #3912, #3556, #4963, #5032, #2968, #4697. #5213, #5214, #5215, #5216, #5217 and #5218 of this set (tracker #5211) change the same files, so each one starts after the one before it merges.

Source: #5104

Activity

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

    @dan-petty
    OwnerAuthor
    • Priority: P1-High. Live plans #4963 and #5032 cannot be read by fix-plan, plan-recheck, or implement, blocking ongoing work. The failed run 131044430778 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 with the label priority/p0-critical.
    • Related: fix(roadmap): a criterion of group 0 escapes the plan reader #3591, which asks for a different change. Both fix a defect in the plan reader in plan_read.py, but #3591 fixes a group-0 criterion escaping as an uncaught error while this candidate adds recognition of the manifest kind and the Unchanged references section.
  3. added
    priority/p1-high
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 12, 2026
  4. added
    status/in-review
    and removed
    status/in-progress
    on Nov 12, 2026
  5. removed
    status/in-review
    owner/agent
    on Nov 12, 2026
  6. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor
  7. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 21:56 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/p1-highscope/roadmapsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions