Skip to content

fix(roadmap): Check a class claim against the staged source #3407

Closed

Description

@dan-petty

Problem or Motivation

A stage plan can build on a false claim about an internal class and pass every check. The plan of PR #3350 says in its design: "StagedTree holds the file text of the staged commit." StagedTree.read runs git ls-files and keeps paths only (src/devops_cli/roadmap/stage_paths.py:79). The plan passed devops openspec check and the stage checks, and an implementation step would have failed on the text that does not exist.

check_proposal tests the paths, the spec delta, the criteria, the form and the content of a plan. It does not test a claim that a plan makes about a class of the staged source. The verification pass can find it, but it keeps the draft and does not return the plan to the planner.

Proposed Solution & Architectural Design

  • Add a rule to check_proposal in src/devops_cli/roadmap/stage_change.py: when a design decision, a rejected alternative or a Feasibility line names an internal class under src/, it must quote a code span of that class at the staged commit.
  • Compare each quoted span with the module text that git show reads at the staged commit, so a plan cannot quote text that the source does not hold.
  • Add the problem texts to src/devops_cli/lang/en/messages.py, and add an offline test in tests/roadmap/test_roadmap_stage_plan.py for a false claim and a true claim.
  • Add a golden case whose plan holds the false StagedTree claim, and record the defect with the paths gate so the replay judges it.

Target Subsystem

SDLC, Git & PR Governance

Existing Tool Considered

No open, maintained tool compares a plan claim about an internal class with the source of a commit. The change extends check_proposal and reuses the git show reader and the standard library ast; it adds no dependency. Cost: about 7,000 output tokens to build and test, about 2,000 tokens for each later fix, and about 1 day elapsed.

Proposed design

Problem statement

A stage plan can make a false claim about an internal class and pass every check. The plan of PR #3350 claimed that StagedTree holds file text, but StagedTree.read keeps paths only. The stage job must reject such a plan and return it to the planner.

Acceptance criteria

Requirement: Reject a class claim with no source quote

check_proposal SHALL return a problem when a design decision, a rejected alternative, or a Feasibility line names an internal class under src/ and gives no code span whose text occurs in that class at the staged commit.

Scenario: False StagedTree claim

  • WHEN A plan's design decision names StagedTree and quotes no text from the StagedTree class at the staged commit.
  • THEN check_proposal returns the class-claim problem for that decision.

Requirement: Accept a class claim with a source quote

check_proposal SHALL accept a plan line that names an internal class under src/ when it also gives a code span whose text occurs in that class at the staged commit.

Scenario: True StagedTree claim

  • WHEN A plan's design decision names StagedTree and quotes git ls-files from the StagedTree source at the staged commit.
  • THEN check_proposal returns no class-claim problem for that decision.

Requirement: Compare quotes at the staged commit

The check MUST read each internal class from the staged commit with git show and compare the quoted span with that text.

Scenario: Quote absent from staged source

  • WHEN A plan quotes text that the class source at the staged commit does not hold.
  • THEN check_proposal returns the class-claim problem.

Requirement: Message in the catalog

The new problem text MUST be a message in src/devops_cli/lang/en/messages.py.

Scenario: Problem text resolves

  • WHEN The class-claim rule returns a problem.
  • THEN The problem uses the RoadmapMessages entry and names the class and the plan section.

Requirement: Replay judges the false claim

The stage replay MUST include a golden case whose plan holds the false StagedTree claim, and the paths gate MUST record the defect.

Scenario: Golden case fails the paths gate

  • WHEN The stage replay runs the golden case with the false StagedTree claim.
  • THEN The replay records the class-claim defect under the paths gate.

Existing Tool Considered

No alternatives check has run. No open, maintained tool compares a plan claim about an internal class with the source of a commit. The change extends check_proposal and reuses the git show reader and the standard library ast; it adds no dependency. Cost: about 7,000 output tokens to build and test, about 2,000 tokens for each later fix, and about 1 day elapsed.

Key questions

  • Which plan sections must obey the class-claim rule?: The design decisions, the rejected alternatives and the Feasibility lines. The rule does not scan every plan text. (best practice) [sources: src/devops_cli/roadmap/stage_change.py]
    • Chosen: Design, rejected alternatives and feasibility. These sections make design claims about source code, and the issue names them.
    • Rejected: Every plan text. It would reject ordinary prose and broaden the rule beyond the defect.
    • Rejected: Model verification only. The verification pass keeps the draft and does not return the plan.
  • How does the check find an internal class under src/?: It builds an index of ClassDef nodes under src/ at the staged commit with the standard library ast. It treats a code span that starts with the class name, such as StagedTree or StagedTree.read, as a claim about that class. (best practice) [sources: src/devops_cli/roadmap/stage_change.py]
    • Chosen: AST index. It finds class definitions and their source segments, not a word in a comment or a string.
    • Rejected: Regex over source text. It can match a comment, a string or a local name.
    • Rejected: Model verification. It is not deterministic and does not return the plan.
  • How does the check compare a quoted span with the class source?: It reads the module text at the staged commit with git show. It normalizes whitespace in the class source and the quote, and it requires the quote to occur in that class's source segment. (best practice) [sources: src/devops_cli/roadmap/stage_paths.py:79, src/devops_cli/roadmap/stage_change.py]
    • Chosen: Whitespace-normalized substring of the class source. It accepts a quote folded to one line and still rejects text that the class does not hold.
    • Rejected: Exact raw substring. A plan line folds whitespace, so a valid multi-line quote would fail.
    • Rejected: Compare with the working tree. The plan and the paths are checked at the staged commit.
  • Where does the rule run?: In check_proposal, so the stage job and the replay use the same rule set. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_eval_gates.py, src/devops_cli/roadmap/stage.py]
    • Chosen: check_proposal. The stage job and the replay already call it.
    • Rejected: Only the model verification pass. The pass keeps the draft and does not return the plan.
    • Rejected: A new command. It adds a path that no job calls.
  • Where does the problem text live?: Add one RoadmapMessages entry in src/devops_cli/lang/en/messages.py and format it with the class name and the plan section. (best practice) [sources: src/devops_cli/lang/en/messages.py, src/devops_cli/roadmap/stage_change.py]
    • Chosen: Message catalog. Every plan problem uses the catalog, and tests can assert one text.
    • Rejected: Inline string. It breaks the message convention and is harder to test.
  • How does the golden case record the defect?: Add the false StagedTree plan to the stage eval cases and set the paths gate to expect the class-claim defect. (best practice) [sources: src/devops_cli/roadmap/stage_eval_cases.py, src/devops_cli/roadmap/stage_eval_gates.py, tests/roadmap/test_roadmap_stage_plan.py]
    • Chosen: Golden case with paths gate. The replay judges the same rule that the stage job uses.
    • Rejected: Unit test only. The issue asks the replay to judge the defect.
    • Rejected: Model verification case. The defect must fail a deterministic gate.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-06: none.
Tool: none found.

Activity

  1. added
    type/bug
    source/agent
    status/new
    on Nov 4, 2026
  2. added
    scope/roadmap
    value/medium
    effort/medium
    on Nov 4, 2026
  3. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. A false class claim can pass all gates and cause a failed implementation step, but it is a quality gap, not a data-loss or security defect.
    • Value: Medium. It closes a gap where a plan can assert a wrong class behaviour and still pass every check.
    • Effort: Medium. The body estimates about 1 day to add the rule, the comparison logic, messages, tests, and a golden case.
    • Related: feat(roadmap): the stage plan states constant claims in a structured field #3388, which asks for a different change. Both extend the plan check to validate claims about source code, but #3388 targets constant values in a structured field while the candidate targets class behaviour claims verified against git show output.
  4. added
    priority/p2-medium
    status/ready
    and removed
    status/new
    on Nov 4, 2026
  5. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at ecfc9b8 (see proposed design in issue body).

  6. changed the title [-]fix(roadmap): the stage plan checks a claim about a class against the staged source[/-] [+]fix(roadmap): Check a class claim against the staged source[/+] on Nov 6, 2026
  7. 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.

    • Before: fix(roadmap): the stage plan checks a claim about a class against the staged source
    • After: fix(roadmap): Check a class claim against the staged source
    • Source of the summary: the background model
  8. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Tool: none found

    Lacks:

    • No open, maintained tool checks a stage-plan claim about an internal class against the class source at a staged commit; the closest class of tools only formats or lints code examples in documentation.
    • The check must run inside the project's own plan checker (check_proposal) and reuse the git show reader, so the stage job and the replay share the rule; a separate docs or lint tool would not be called by those paths.
    • The rule must index ClassDef nodes under src/ at the staged commit and match whitespace-normalized quotes against the class source segment, which no general-purpose tool does.
    • The problem text must come from the project's own message catalog and the defect must be judged by a golden replay case under the paths gate, which no external tool provides.

    Searches run:

    • tool that verifies documentation claims about source code symbols against a git commit
    • python library check code quotes in docs match source code at commit
    • verify code snippets in documentation match source code
    • pytest-codeblocks check code examples match source
    • myst docs code check source quote verification
    • sphinx linkcode
    • lint documentation claims about source code functions signatures
    • keep documentation code snippets in sync with source code tool
    • semgrep validate documentation code examples against repository

    Sources:

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

  9. added
    owner/service
    on Nov 14, 2026
  10. 46 remaining items

  11. added
    status/in-review
    and removed
    status/blocked
    on Nov 16, 2026
  12. removed
    status/in-review
    on Nov 16, 2026
  13. devops-cli-service commented on Nov 16, 2026

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

    @devops-cli-service
    Contributor

    Live since 2026-11-16 13:55 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/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions