Skip to content

feat(roadmap): Check finding defect types against DefectType #3343

Closed

Description

@dan-petty

Problem

Finding in src/devops_cli/roadmap/stage_verify.py defines findings from the model verification pass. Its type field is constrained to the DefectType enum in src/devops_cli/roadmap/stage_eval_cases.py.
tests/roadmap/test_roadmap_stage_verify.py::test_a_finding_with_a_type_outside_the_nine_is_refused enforces this strictly.

When planning changes to plan verification (such as #3264 / PR #3305), the planner hallucinated that Finding had a free-text kind field and proposed checking for kind: placeholder, which causes a Pydantic ValidationError because placeholder is not in DefectType.

The stage probe and planner do not currently check proposed defect types against DefectType during plan authoring.

Proposed change

  1. In src/devops_cli/roadmap/stage_specs.py or stage_eval_gates.py, add a probe that checks references to verification finding types against DefectType.
  2. When a plan specifies finding types or classifications that are not members of DefectType, require the plan to either add the enum member or document mapping to existing members (DefectType.OTHER).
  3. Add a test in tests/roadmap/test_roadmap_stage_plan.py asserting that plans proposing unknown defect types are caught during plan staging.

Acceptance criteria

  1. A test asserts that a plan proposing an unlisted finding defect type without updating DefectType is refused.
  2. A plan referencing valid DefectType members passes validation.

Source: #3305

Proposed design

Problem statement

The stage gates never read a plan's finding-type reference, and the model schema refuses a bad one only at validation. The earlier plan added a scan of the plan prose. That scan refuses the sound plan of #3328 and finds no true hit in the 695 recorded plans. This change keeps the plan of pull request #3305 in the golden set and proves that the gates accept a plan which names a DefectType member. No new gate is built, and the model verifier covers the claim as false_premise.

Acceptance criteria

Requirement: The golden set holds the incident plan

The golden set SHALL hold the plan of pull request #3305 as a case whose issue is 3264.

Scenario: The incident case loads

  • WHEN load_cases reads tests/fixtures/roadmap_eval/stage at the commit that holds the case
  • THEN the cases hold a case whose issue is 3264 and whose pull is 3305

Requirement: The case records the claim

The case of pull request #3305 SHALL name the kind: placeholder claim of its authoring run in one note.

Scenario: The note names the claim

Requirement: The replay accepts the incident case

The replay SHALL accept the case of pull request #3305, so a gate that refuses the plan fails the replay.

Scenario: The incident case passes every gate

Requirement: A plan that names a defect type member passes

check_proposal MUST NOT return a problem for a plan that names a DefectType member, including a member that the plan adds.

Scenario: A plan adds a member and names it

  • WHEN check_proposal runs on a valid plan whose group changes src/devops_cli/roadmap/stage_eval_cases.py and whose test text names DefectType.PROMPT_KEY_MISSING
  • THEN check_proposal returns an empty list

Existing Tool Considered

No alternatives check has run. Pydantic is the open, maintained library that covers the runtime enum check of Finding.type in src/devops_cli/roadmap/stage_verify.py, and it lacks a check of a plan's prose during staging. The change builds no check: it records the incident plan in the golden set, which the existing replay uv run devops roadmap eval stage --replay reads. The work costs about 2,000 tokens to write the case and the test, and about 1 hour elapsed.

Key questions

  • Which stage checks run on a plan today?: check_proposal runs thirteen gates, and the replay runs four gates. No gate reads a finding type: the gates judge the spec delta, the content, a citation, the form, the eval replay, a path, a What Changes item, a move, a search, a criterion, a dependency and a created path. [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_eval_gates.py]
  • Should the change add the scan of the plan prose, or record the incident plan in the golden set?: Record the incident plan in the golden set. The scan refuses the sound plan of feat(roadmap): gate a plan that adds a StageProposal field #3328 and finds no true hit in the 695 recorded plans. The verifier now names the claim false_premise. (best practice) [sources: src/devops_cli/roadmap/stage_eval_cases.py, src/devops_cli/roadmap/stage_eval_gates.py, src/devops_cli/roadmap/stage_verify.py, openspec/changes/3328-the-stage-probe-checks-prompt-reply/design.md, openspec/changes/3343-the-stage-probe-checks-defecttype-membership/tasks.md]
    • Chosen: Record the incident plan in the golden set. It uses the existing replay, adds no hand-rolled text check, and keeps the incident on record.
    • Rejected: Add the scan with an exemption for a plan that changes the enum file. It keeps a text check with no measured hit and adds a second rule to keep that check sound.
    • Rejected: Add the scan as the earlier plan wrote it. It refuses the sound plan of feat(roadmap): gate a plan that adds a StageProposal field #3328, which adds a member of DefectType and names it.
  • Which defect type names a claim that the code contradicts?: DefectType.FALSE_PREMISE. The verifier reads the repository with the read tools of the planner, so it can quote the code that contradicts the claim. [sources: src/devops_cli/roadmap/stage_eval_cases.py, src/devops_cli/roadmap/stage_verify.py, src/devops_cli/ai/tasks/roadmap_stage_verify.md]
  • Does the replay fail a case whose defect names the gate none?: No. _status returns UNJUDGED for the gate none, and CaseReplay.failures lists only a missed defect, a stale pending gate and a refused good plan. [sources: src/devops_cli/roadmap/stage_eval_gates.py]
  • What does a case directory hold?: case.json, issue.txt, plan.json and facts.json. facts.json holds the tracked files that the gates need, the capabilities that have a spec, and the paths that each negative-search literal matched. [sources: src/devops_cli/roadmap/stage_eval_cases.py]
  • How does the case record the kind: placeholder claim of the authoring run?: In one note of case.json. The merged plan holds no wrong finding type, so the claim is no defect of the plan. A defect with the gate pending would fail the replay, because PENDING_GATES is empty. (best practice) [sources: src/devops_cli/roadmap/stage_eval_cases.py, src/devops_cli/roadmap/stage_eval_gates.py]
    • Chosen: One note of case.json. The note keeps the incident on record, and the case judges only the plan that the repository holds.
    • Rejected: A defect with the gate none. It marks a plan that merged as defective and adds an unjudged row for no code change.
    • Rejected: A defect with the gate pending. PENDING_GATES is empty, so _status reports the defect stale and the replay fails.
  • Where do the two tests live?: The guard test goes in tests/roadmap/test_roadmap_stage_plan.py, with the other check_proposal tests. The case test goes in tests/roadmap/test_roadmap_stage_eval_gates.py, which replays the golden set. (best practice) [sources: tests/roadmap/test_roadmap_stage_plan.py, tests/roadmap/test_roadmap_stage_eval_gates.py, src/devops_cli/roadmap/stage_eval_gates.py]
    • Chosen: The existing modules. Each module already holds the tests of its check, and no new module needs a mirrored path.
    • Rejected: A new test module. The project mirrors a new test module to its source path, and no source module changes.

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 Pydantic ValidationError from reaching users but does not block a critical path.
    • Value: Medium. It stops invalid plans from causing a crash, improving plan-stage reliability.
    • Effort: Medium. It requires adding a probe, wiring it into staging, and writing one test, all within one module.
    • Related: feat(roadmap): refuse a self-named or untested plan #3321, which asks for a different change. Both add a plan-stage gate that refuses a plan, but #3321 checks for self-referential tasks and missing tests while the candidate checks for invalid DefectType members.
  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 ce4e327 (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Staged: branch feat/3343-the-stage-probe-checks-defecttype-membership, draft pull request #3349. 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. Refuse a finding type outside DefectType: 26426 tokens

    The plan run made 2 model request(s), and used 152892 input tokens and 6765 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 group 1, implementation: The rule needs a new problem text that names the value and lists the members. No existing MESSAGES.roadmap entry holds that text. The plan changes no lang file to add one. Evidence: "Use the existing MESSAGES.roadmap entries for the text"
  7. added 2 commits that reference this issue on Nov 4, 2026
  8. removed
    status/ready
    on Nov 4, 2026
  9. 3 remaining items

  10. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    Returned to New under AGENTS.md rule 2: the item cannot be built as written. Two reviewers read the code of origin/main on 2026-11-06 and agreed.

    Evidence

    The gap exists: stage_change.py has no DefectType check, and the incident is real (PR #3305 plan said Finding.kind: placeholder). But the fix as written cannot work. Its helper (tasks.md 1.2 of the merged plan) matches every DefectType. reference in plan prose, and its problem text tells the planner to 'add the enum member'. The helper cannot see that a plan adds the member. Proof: openspec/changes/3328-the-stage-probe-checks-prompt-reply/tasks.md 1.2 adds PROMPT_KEY_MISSING to DefectType, and design.md line 15-16 names DefectType.PROMPT_KEY_MISSING. The new rule refuses that plan, which does what the rule asks. I measured all 695 plan folders of origin/main (50 open, 645 archived): there is no wrong kind:/DefectType.X reference in any of them except this item's own text and the 3328 false refusal. So the true hits are 0 and the false refusals are 1. The cause of the incident is also gone: #3523 gave the planner its tools back, and #3710 (c1191e2) made the verifier read the repository, where false_premise covers a claim that the code contradicts (src/devops_cli/ai/tasks/roadmap_stage_verify.md).

    Re-scope for refinement

    The rule is a regex over plan prose (hand-rolled string heuristic; owner direction: tools and libraries, not home-grown checks). As written it refuses a sound plan that follows its own advice (#3328), it has 0 true hits over 695 plans, and the model verifier now covers the incident class. Re-scope for a person to pick: drop the prose scan; add the #3305 plan as a golden case in tests/fixtures/roadmap_eval/stage so the replay shows what the verifier or gates miss; build a gate only if the replay shows a miss. If a person still wants the scan, exempt a plan whose group changes src/devops_cli/roadmap/stage_eval_cases.py. That is S work, but it carries no measured benefit.

  11. added
    status/new
    and removed
    status/planned
    on Nov 6, 2026
  12. added
    status/ready
    and removed
    status/new
    on Nov 6, 2026
  13. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

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

  14. added
    status/planned
    and removed
    status/ready
    on Nov 6, 2026
  15. added a commit that references this issue on Nov 8, 2026
    7bb66cc
  16. added
    status/in-review
    and removed
    status/planned
    on Nov 8, 2026
  17. removed
    status/in-review
    on Nov 8, 2026
  18. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor
  19. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 15:26 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