Skip to content

fix(roadmap): plan files keep the cost mark and line estimates #5217

Open

Description

@dan-petty

Problem or Motivation

render_change does not write builds_own or creates_lines (src/devops_cli/roadmap/plan_read.py:9-11). The reader sets builds_own to false (plan_read.py:496-512) and gives each created path 1 line (plan_read.py:393, 409). So when plan-check, plan-recheck, implement or fix-plan judge a read plan:

  • the cost rule of AGENTS.md rule 3 does not run (src/devops_cli/roadmap/stage/stage_change.py:1825-1829);
  • the size measure counts too few tokens (measure_groups, stage_change.py:2892-2915; callers plan_check.py:529 and the budget check of _gated).
    A read plan can pass checks that the same plan failed at write time. In the golden set, plan 3247 sets builds_own, and 4 groups have other line estimates. fix(roadmap): write and read the kind of each plan task group #5205 lists both fields in FIELDS_NOT_IN_FILES.

Proposed Solution & Architectural Design

  • builds_own: the writer adds one fixed sentence at the end of ## Existing Tool Considered of proposal.md when the field is true. The reader sets the field when the sentence is there and removes it from existing_tool. The sentence is written only for true, so its absence is the value false.
  • creates_lines: the writer adds one line under the files line of a group that creates a path: New lines: <n>, .... The (new) mark does not change, so the other parsers of the mark still work: created_paths (plan_read.py:256-266), group_files (plan_read.py:269-287), src/devops_cli/roadmap/implement/implement_amend.py:150-153 and src/devops_cli/roadmap/planned.py:110-122. _READS matches only the files line (re.M, $).
  • A created path with no New lines: entry (a plan written before this change) reads as 1 line, as today. Its end is refactor(roadmap): end the kind inference of the plan reader #5218, which writes the value 1 into each old plan with the form edit of plan_rewrite.py, whatever the gate result, and then refuses a missing entry.
  • Remove builds_own and creates_lines from FIELDS_NOT_IN_FILES.

Target Subsystem

Roadmap: the stage writer and the plan reader.

Existing Tool Considered

No open tool holds these fields: the plan Markdown is the format of this project, and OpenSpec has no field for them. 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_read.py::test_builds_own_reads_back and ::test_created_line_estimates_read_back pass.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_the_fields_that_no_file_holds holds FIELDS_NOT_IN_FILES to summary, pull_request_body and weakened_checks, and ::test_no_fact_is_lost passes.
  • uv run pytest tests/roadmap/test_roadmap_plan_read.py::test_each_golden_plan_reads_back gives builds_own true for plan 3247.
  • uv run devops ci test tests/roadmap/implement/test_roadmap_implement_amend.py tests/roadmap/stage tests/roadmap/test_roadmap_plan_check.py passes, with the snapshots updated.
  • uv run devops ci fail-to-pass --base origin/main shows that test_builds_own_reads_back, test_created_line_estimates_read_back and test_the_fields_that_no_file_holds fail on the base and pass on the head. The PR cites the run.
  • Validation table in a PR comment, as in fix(roadmap): write and read the kind of each plan task group #5205: the read on origin/main and on the branch of each open plan PR head and each plan PR closed in the last 14 days, with builds_own and the sum of the line estimates. No head that origin/main reads is refused on the branch. The fixtures in tests/fixtures/roadmap/plan_heads/ read with the same values as on the base.
  • 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/lang/en/messages.py
  • tests/roadmap/test_roadmap_plan_read.py
  • tests/roadmap/stage/snapshots/test_roadmap_stage_plan.ambr and the fixtures that hold a rendered group with a created path
  • docs/roadmap/plan-check.md
  • openspec/specs/roadmap-plan-check/spec.md

Dependencies

The stage job leaves this item out until that issue closes. The earlier PRs of this set change stage_change.py, plan_read.py and messages.py, and this item needs FIELDS_NOT_IN_FILES and the property tests of the reader fix.

Related

#3201, #3490, AGENTS.md rule 3.

Source: #5211

Alternatives check of 2026-11-22: none.
Tool: none found.
Reason: Searches returned no open tool that stores a builds-own cost flag or per-created-path line estimates in a plan file and reads them back; OpenSpec, the project's spec layer, has no such field.

Lacks:

  • No field for a builds-own cost flag
  • No per-created-path line estimates
  • No read back into the cost rule and size measure

Proposed design

Problem statement

Do not build this item until #5216 and #6521 close. render_change does not write builds_own or creates_lines. The reader sets builds_own false and gives each created path 1 line. A read plan then shows less cost than the writer recorded. The cost rule of AGENTS.md rule 3 does not run, and the size measure counts too few tokens. This item writes both values into the plan files and reads them back.

Acceptance criteria

Requirement: True builds_own is written

render_change SHALL write the line This change builds its own tool. as the last line of ## Existing Tool Considered in proposal.md when builds_own is true.

Scenario: A true builds_own is written

  • WHEN A test calls render_change for a stage proposal with builds_own true.
  • THEN The ## Existing Tool Considered section of proposal.md ends with the line This change builds its own tool.

Requirement: False builds_own is not written

render_change SHALL write no line This change builds its own tool. when builds_own is false.

Scenario: A false builds_own is not written

  • WHEN A test calls render_change for a stage proposal with builds_own false.
  • THEN The rendered proposal.md holds no line This change builds its own tool.

Requirement: True builds_own is read

read_change SHALL set builds_own true and SHALL remove the line This change builds its own tool. from existing_tool when proposal.md holds that line.

Scenario: A plan with the builds-own line

  • WHEN A test calls read_change on a rendered proposal.md whose ## Existing Tool Considered section ends with that line.
  • THEN The returned builds_own is true and the returned existing_tool holds no line This change builds its own tool.

Requirement: Missing builds_own line reads false

read_change SHALL set builds_own false when proposal.md holds no line This change builds its own tool.

Scenario: A plan with no builds-own line

  • WHEN A test calls read_change on a rendered proposal.md of a proposal with builds_own false.
  • THEN The returned builds_own is false.

Requirement: Created-line estimates are written

render_change SHALL write one New lines: line below the Changes: line of each group that creates a path.

Scenario: A group with created paths and line estimates

  • WHEN A test calls render_change for a group with two created paths and their creates_lines values.
  • THEN The group in tasks.md holds one New lines: line with each created path in a code span and its value.

Requirement: The (new) mark stays on the Changes line

render_change SHALL keep the (new) mark on the Changes: line of each created path.

Scenario: The mark of a created path

  • WHEN A test calls render_change for a group with a created path.
  • THEN The Changes: line of the group marks the created path (new).

Requirement: No New lines line without created paths

render_change SHALL write no New lines: line for a group that creates no path.

Scenario: A group with no created path

  • WHEN A test calls render_change for a group with no creates paths.
  • THEN The group in tasks.md holds no New lines: line.

Requirement: Created-line estimates are read

read_change SHALL set creates_lines of a group from its New lines: line.

Scenario: A plan with New lines entries

  • WHEN A test calls read_change on a tasks.md whose group holds a New lines: line with two paths.
  • THEN The group's creates_lines equals the two path and value pairs of that line.

Requirement: Missing created-line estimate reads one

read_change SHALL give one line to each created path that has no New lines: entry.

Scenario: A created path with no estimate

  • WHEN A test calls read_change on a group that marks a path (new) and holds no New lines: entry for that path.
  • THEN The group's creates_lines gives that path the value 1.

Requirement: Round trip keeps both fields

A render_change followed by a read_change SHALL keep builds_own and each creates_lines value.

Scenario: The round-trip property test

  • WHEN tests/roadmap/test_roadmap_plan_read.py::test_no_fact_is_lost runs over the stage proposals.
  • THEN Each read proposal has the same builds_own and the same creates_lines values as the proposal that the test rendered.

Requirement: file_facts keeps both fields

file_facts SHALL keep the builds_own and creates_lines values of the proposal that it reads.

Scenario: A proposal with a true builds_own and a line estimate

  • WHEN A test calls file_facts on a proposal with builds_own true and a created path with 40 lines.
  • THEN The returned proposal has builds_own true and gives the created path 40 lines.

Requirement: The fields leave FIELDS_NOT_IN_FILES

FIELDS_NOT_IN_FILES SHALL hold only summary, pull_request_body and weakened_checks.

Scenario: The fields that no file holds

  • WHEN tests/roadmap/test_roadmap_plan_read.py::test_the_fields_that_no_file_holds runs.
  • THEN The set equals summary, pull_request_body and weakened_checks.

Requirement: Golden plan 3247 reads builds_own

The golden plan 3247 SHALL read back with builds_own true.

Scenario: Golden plan 3247

  • WHEN tests/roadmap/test_roadmap_plan_read.py::test_each_golden_plan_reads_back reads plan 3247.
  • THEN The read proposal has builds_own true.

Requirement: Plan-head fixtures still read

read_change SHALL read each folder in tests/fixtures/roadmap/plan_heads/ with builds_own false and the value 1 for each created path.

Scenario: The plan-head fixtures read as before

  • WHEN A test calls read_change on each folder in tests/fixtures/roadmap/plan_heads/.
  • THEN Each read gives builds_own false and the value 1 for each created path.

Requirement: Affected roadmap suites pass

The stage, plan-check, implement-amend and plan-read suites SHALL pass with the updated snapshots.

Scenario: The affected roadmap tests

  • WHEN uv run devops ci test tests/roadmap/test_roadmap_plan_read.py tests/roadmap/implement/test_roadmap_implement_amend.py tests/roadmap/stage tests/roadmap/test_roadmap_plan_check.py runs.
  • THEN The command exits 0.

Requirement: New reader tests fail on the base

The new reader tests SHALL fail on origin/main and pass on the branch.

Scenario: The fail-to-pass run

  • WHEN uv run devops ci fail-to-pass --base origin/main runs for test_builds_own_reads_back, test_created_line_estimates_read_back and test_the_fields_that_no_file_holds.
  • THEN The command reports each of the three tests as failed on the base and passed on the branch.

Requirement: Docs check passes

docs/roadmap/plan-check.md SHALL pass uv run devops docs check after it names the New lines: line and the builds-own line.

Scenario: The docs check

  • WHEN uv run devops docs check runs.
  • THEN The command exits 0.

Existing Tool Considered

The alternatives check of 2026-11-22 in the issue body records verdict none and names no tool; the block gives the reason and the Lacks: list. The plan Markdown is this project's own format. The proposal adds the two fields to the plan Markdown in stage_change.py and reads them in plan_read.py. Cost to build: 0.6 M tokens and 2 hours elapsed. Cost to keep: none. Cost to fix: about 0.1 M tokens.

Key questions

  • How does a plan file record that the change builds its own tool?: render_change writes This change builds its own tool. as the last line of ## Existing Tool Considered in proposal.md when builds_own is true. read_change sets builds_own true when the line is present. read_change removes the line from existing_tool. A missing line gives false. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:729, src/devops_cli/roadmap/plan_read.py:496, AGENTS.md]
    • Chosen: A fixed line at the end of the section. The reader already parses that section. The absence of the line gives false with no new marker.
    • Rejected: A hidden HTML comment marker. It adds a second marker and hides the cost mark from the proposal text.
    • Rejected: A key in the .openspec.yaml of the change folder. It changes the schema of the change folder and each reader of that file.
  • How does a plan file record the line estimate of each created path?: render_change writes one New lines: line below the Changes: line of each group that creates a path. The line holds each created path in a code span and its integer line count, separated by , . The writer keeps the (new) mark on the Changes: line. read_change sets creates_lines from that line. (best practice) [sources: src/devops_cli/roadmap/plan_read.py:110, src/devops_cli/roadmap/plan_read.py:387, src/devops_cli/roadmap/planned.py:110, src/devops_cli/roadmap/implement/implement_amend.py:150]
    • Chosen: One New lines: line under Changes:. It keeps the Changes: line and the (new) mark unchanged for the other parsers.
    • Rejected: The count inside the (new) mark. It changes every parser that matches the mark: created_paths, group_files, the amend check and planned.
    • Rejected: A per-group block of front matter. It changes the task format and needs a new parser.
  • What does the reader give for a created path with no New lines: entry?: read_change gives 1 line to each created path that has no New lines: entry. This keeps every plan written before this change readable. refactor(roadmap): end the kind inference of the plan reader #5218 writes 1 into each old plan and then refuses a missing entry. This item leaves the migration to refactor(roadmap): end the kind inference of the plan reader #5218. (best practice) [sources: src/devops_cli/roadmap/plan_read.py:393, src/devops_cli/roadmap/plan_read.py:409]
    • Chosen: Give 1 line now. It keeps every plan written before this change readable and matches the reader today.
    • Rejected: Refuse a missing entry now. It refuses every plan written before this change.
    • Rejected: Write 1 into old plans in this item. It adds the migration that refactor(roadmap): end the kind inference of the plan reader #5218 owns to this item.
  • Does the added New lines: line change the Reads: line that _READS matches?: _READS matches the Reads: line with re.M and $. The added New lines: line does not match it. The reader still finds the Reads: line. [sources: src/devops_cli/roadmap/plan_read.py:110]
  • Do the other parsers of the (new) mark still work?: created_paths, group_files, the amend check and planned read the (new) mark on the Changes: line. This change leaves that line and the mark unchanged. The other parsers still work. [sources: src/devops_cli/roadmap/plan_read.py:387, src/devops_cli/roadmap/planned.py:110, src/devops_cli/roadmap/implement/implement_amend.py:150]
  • Which fields leave FIELDS_NOT_IN_FILES?: builds_own and creates_lines leave FIELDS_NOT_IN_FILES. The set then holds summary, pull_request_body and weakened_checks. (best practice) [sources: src/devops_cli/roadmap/plan_read.py:140, tests/roadmap/test_roadmap_plan_read.py]
    • Chosen: Remove both fields. The plan files now hold both values. The reader reports no loss for them.
    • Rejected: Keep both fields. The reader would still report a loss for values that the plan files hold.
  • How does the pull request show that the stored plan heads still read?: A test reads each folder in tests/fixtures/roadmap/plan_heads/ and asserts builds_own false and the value 1 for each created path. The pull request cites that test run. A read of each open plan pull request head and each plan pull request closed in the last 14 days stays review evidence in the pull request comment. It needs live GitHub data. (best practice) [sources: tests/roadmap/test_roadmap_plan_read.py]
    • Chosen: Read the stored fixtures offline. The test runs offline. The fixtures hold the plan heads that exist.
    • Rejected: Read each open and recently closed plan pull request head. It needs live GitHub data and a person. It cannot be an offline criterion.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5216, #6521

Watched files

A commit on the default branch that changes one of these files starts the next refine round.

  • src/devops_cli/roadmap/plan_read.py
  • src/devops_cli/roadmap/stage/stage_change.py

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/bug
    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. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: Searches found spec-driven planning tools (OpenSpec, GitHub spec-kit) whose proposal/plan files hold prose, structure and task checklists, but none has a field for a "builds own tool" cost flag or per-path created-line estimates. The plan Markdown is this project's own format, and the project's reader/writer is the only thing that can persist these two fields, so no open tool covers the need.

    Tool: none found

    Lacks:

    • No tool persists a builds_own cost flag in a plan document.
    • No tool persists per-created-path line estimates (creates_lines) in a plan document.
    • No tool re-reads those fields to re-run the cost rule and size measure that the stage writer used.

    Tools considered:

    Searches run:

    • OpenSpec spec-driven development proposal.md format fields, results: 5
    • spec-kit plan.md format estimate tokens lines created files, results: 5
    • tool that persists plan cost estimate and line count fields in markdown plan file, results: 5
    • OpenSpec github spec-driven development CLI tool, results: 5
    • "builds_own" OR "creates_lines" plan field, results: 5
    • GitHub spec-kit plan.md template file change estimates, results: 5
    • AI coding plan markdown schema track estimated changed lines per file tool, results: 5

    Sources:

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

  6. 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.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: src/devops_cli/roadmap/stage/stage_change.py, src/devops_cli/roadmap/plan_read.py, src/devops_cli/lang/en/messages.py.

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

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 4d085f1 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.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: src/devops_cli/roadmap/plan_read.py, src/devops_cli/roadmap/stage/stage_change.py, src/devops_cli/lang/en/messages.py.

  8. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Owner question: How does the pull request show that existing plan heads still read? (a person decides)

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  9. 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.

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

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  11. 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.

  12. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files 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/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions