Skip to content

feat(roadmap): check a plan number against its constant #3308

Closed

Description

@dan-petty

Problem or Motivation

The plan in PR #3260 (for #3200) copied "a bound of 40 characters" for the summary from the issue text. The real system says other things: SUMMARY_MAX_CHARS is 60 in src/devops_cli/roadmap/pull_form.py, StageProposal.summary already has max_length=SUMMARY_MAX_CHARS, and src/devops_cli/ai/tasks/roadmap_stage_change.md tells the model "at most 47 characters". The plan's spec scenario ("41 characters", "the 40-character bound") and its design ("SUMMARY_MAX_CHARS") disagree with each other and with the code. The Feasibility checked the cut titles and did not check the number.

A plan that carries a number from the issue (a bound, a count, a timeout) is a claim that the number holds in the code.

Proposed Solution & Architectural Design

  1. In the plan check, find a number that a requirement, a scenario or a decision gives next to a name of a constant (SUMMARY_MAX_CHARS, ..._MAX_...), and compare it with the value of that constant in the staged tree.
  2. Refuse a plan whose number differs, and name the constant and its value.
  3. Ask the plan stage prompt to cite the value of each constant that the plan relies on, as the probe does for paths.

Target Subsystem

The plan check and the premise probe of devops roadmap (src/devops_cli/roadmap/stage_probe.py, stage_change.py).

Source: #3260

Proposed design

Problem statement

The plan check accepts a plan that copies a number from the issue but names a constant with a different value. PR #3260 shows the fault: a plan said 40 characters while SUMMARY_MAX_CHARS is 60. The change makes the plan check compare each such number with the constant in the staged tree and refuse a mismatch.

Acceptance criteria

Requirement: Mismatched constant claim

The plan check SHALL refuse a plan when a number beside a known integer constant in a requirement, a scenario or a decision differs from the staged value.

Scenario: Summary bound mismatch

  • WHEN A spec scenario says SUMMARY_MAX_CHARS is 40, and the staged tree sets SUMMARY_MAX_CHARS = 60.
  • THEN The check returns one problem that names SUMMARY_MAX_CHARS, 40 and 60.

Requirement: Matching constant claim

The plan check SHALL accept a plan when the number beside a known integer constant equals the staged value of that constant.

Scenario: Summary bound match

  • WHEN A design decision says SUMMARY_MAX_CHARS is 60, and the staged tree sets SUMMARY_MAX_CHARS = 60.
  • THEN The check returns no problem about SUMMARY_MAX_CHARS.

Requirement: Unknown constant ignored

The plan check MUST ignore a constant name that the staged tree does not define as a module-level integer constant.

Scenario: New plan constant

  • WHEN A design decision names PLAN_SUMMARY_MAX_CHARS = 47, and the staged tree does not define PLAN_SUMMARY_MAX_CHARS.
  • THEN The check returns no problem about PLAN_SUMMARY_MAX_CHARS.

Requirement: Task commands not checked

The plan check MUST NOT compare a number in tasks.md with a constant.

Scenario: Task command number

  • WHEN tasks.md holds SUMMARY_MAX_CHARS and 40 in one command, and the staged tree sets SUMMARY_MAX_CHARS = 60.
  • THEN The check returns no problem about SUMMARY_MAX_CHARS.

Requirement: Prompt cites constants

The plan stage prompt SHALL tell the model to cite the staged value of each constant that the plan relies on.

Scenario: Prompt rule

  • WHEN The prompt rules test reads src/devops_cli/ai/tasks/roadmap_stage_change.md.
  • THEN The text holds an instruction to cite each constant value.

Requirement: Constant values read without execution

The plan check MUST read constant values with Python AST and MUST NOT import or execute staged code.

Scenario: Non-literal assignment

  • WHEN A staged module sets SUMMARY_MAX_CHARS from a call, and the plan says SUMMARY_MAX_CHARS is 40.
  • THEN The check returns no problem about SUMMARY_MAX_CHARS.

Existing Tool Considered

No alternatives check has run. No open, maintained tool or library compares a number in a plan with a named Python constant. The change builds on the existing plan check and the Python ast standard library. Estimated cost: 15,000 tokens to build, 4,000 tokens per month to keep and fix, and 1 to 2 elapsed days.

Key questions

  • Does the repository already hold a plan check in the staging path?: Yes. src/devops_cli/roadmap/stage_change.py is the plan check of the staging path. It already reads SUMMARY_MAX_CHARS. [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/pull_form.py]
  • What is the value of SUMMARY_MAX_CHARS in the staged tree?: SUMMARY_MAX_CHARS is 60 in src/devops_cli/roadmap/pull_form.py. [sources: src/devops_cli/roadmap/pull_form.py]
  • What does the plan stage prompt currently say about the summary bound?: src/devops_cli/ai/tasks/roadmap_stage_change.md tells the model "at most 47 characters". [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md]
  • How does the plan check obtain a constant value from the staged tree?: Parse the staged Python files with ast and read module-level integer assignments. Resolve a simple alias to another integer constant in the same module. Do not import or execute staged code. (best practice) [sources: src/devops_cli/roadmap/pull_form.py, src/devops_cli/roadmap/stage_probe.py]
    • Chosen: AST integer assignments. Reads values without running staged code and handles the literal form of SUMMARY_MAX_CHARS.
    • Rejected: Import the staged modules. Executes untrusted plan code and can cause side effects.
    • Rejected: Regex over source text. Matches comments, strings and annotated values that are not the constant.
  • Which plan files does the check scan for a number beside a constant?: Scan proposal.md, design.md and every specs/**/*.md in the change folder. Do not scan tasks.md. (best practice) [sources: openspec/changes/3200-refuse-a-plan-with-placeholder-or/design.md:12, openspec/changes/3200-refuse-a-plan-with-placeholder-or/proposal.md:49]
    • Chosen: Proposal, design and spec deltas. The issue names requirements, scenarios and decisions, and these files hold them.
    • Rejected: All change files including tasks.md. Task commands and paths carry numbers that are not claims about a constant.
    • Rejected: Only spec deltas. Design decisions also name constants and bounds.
  • How does the check pair a constant name with a number?: Use a sentence as the unit. A pair is a known constant name and a decimal integer in the same sentence, in either order. Compare each pair. (best practice) [sources: openspec/changes/3200-refuse-a-plan-with-placeholder-or/design.md:12, openspec/changes/3200-refuse-a-plan-with-placeholder-or/proposal.md:49]
    • Chosen: Same sentence. Keeps the claim local and catches 40 characters next to SUMMARY_MAX_CHARS.
    • Rejected: Same line. A wrapped Markdown sentence breaks the pair.
    • Rejected: Whole file. Pairs unrelated numbers with a constant and refuses valid plans.
  • What does the check do when a plan names a constant that the staged tree does not define as an integer?: Skip the name. Report a problem only for a known integer constant with a nearby number that differs. (best practice) [sources: src/devops_cli/roadmap/stage_probe.py, src/devops_cli/roadmap/stage_change.py]
    • Chosen: Skip unknown and non-integer constants. A new constant in a plan is not a claim about the staged value.
    • Rejected: Refuse every unknown constant. A plan may introduce a new constant, and the check has no value to compare.
    • Rejected: Treat a missing value as zero. A false value refuses valid plans.
  • What does the plan stage prompt tell the model about constants?: Tell the model to cite the staged value of each constant that the plan relies on, with the constant name and the value, as feasibility quotes probe lines. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md, src/devops_cli/roadmap/stage_probe.py]
    • Chosen: Add the citation rule to the prompt. The model has the read tools, and the probe already asks it to quote paths.
    • Rejected: Rely on the check alone. The model needs the rule before it writes the plan, so the reply passes on the first try.
    • Rejected: Add a new constant probe command. The read tools already give the value, and a new probe expands the command budget.
  • What error text does a mismatch produce?: One problem line names the constant, the number in the plan and the staged value. For example: SUMMARY_MAX_CHARS is 60 in the staged tree, but the plan says 40. (best practice) [sources: src/devops_cli/roadmap/pull_form.py]
    • Chosen: Name all three values. The model can correct the number in one turn.
    • Rejected: Name only the constant. The model does not know the right value.
    • Rejected: Name only the staged value. The model cannot find the wrong text.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

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. It prevents a specific class of plan errors but does not block delivery or expose a defect.
    • Value: Medium. It catches a real and recurring mismatch between a plan's number and the code's constant.
    • Effort: Medium. It needs number extraction, constant lookup in the staged tree, and a refusal path.
    • Related: feat(roadmap): add a plan-check command for a plan pull request #3201, which asks for a different change. Both work in the plan check, but 3201 adds the plan-check command while the candidate adds a specific numeric-constant-consistency check within it.
  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 d895bae (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Staged: branch feat/3308-the-plan-check-compares-a-number, draft pull request #3329. 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. Read the staged integer constants and pair them with a plan number: 24917 tokens
    2. Refuse the plan in check_proposal: 27987 tokens
    3. Ask the plan stage prompt for the staged value of a constant: 21104 tokens
    4. Check the OpenSpec change against the base specs: 8064 tokens

    The plan run made 3 model request(s), and used 211011 input tokens and 12483 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:

    • other at rejected, alternative 5: The evidence does not reject the alternative. It says the prompt already carries a rule, yet the plan adds a new prompt rule in group 3. The reason to reject relying on the check alone is missing. Evidence: "so the prompt already carries the rule that makes a reply pass on the first try."
  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 compares a number in a plan with the constant it names[/-] [+]feat(roadmap): check a plan number against its constant[/+] 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 69 characters, and the limit is 60. The type and the scope stay.

  11. added
    status/in-progress
    and removed
    status/planned
    on Nov 7, 2026
  12. removed
    status/in-progress
    on Nov 7, 2026
  13. devops-cli-service commented on Nov 7, 2026

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

    @devops-cli-service
    Contributor

    Live since 2026-11-07 22:00 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