Skip to content

feat(roadmap): refine criteria as requirement, when and then with the existing-tool question #1849

Closed

Description

@dan-petty

Friction

This is step 7 of 8 of the OpenSpec adoption decided in issue #1753 and docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md. After the switch, a plan's behavior is written as spec-delta requirements with scenarios (WHEN and THEN), but the in-cluster refine job still proposes acceptance criteria as {description, verification}. A person or agent has to translate every refined proposal into the shape the change folder takes, and refine says nothing about the question the project now asks of every plan.

Evidence

The ADR's Design (Readiness, closing and the roadmap jobs) assigns both changes to this step. The criteria shape is the one OpenSpec's spec delta takes (### Requirement: with #### Scenario: and WHEN/THEN lines), and the project's openspec/config.yaml (scaffold item) tells authors to write only scenarios a test under tests/ can assert offline. The existing-tool wording is the one in AGENTS.md and .github/ISSUE_TEMPLATE/feature_request.yml ("Existing Tool Considered": the tool and what it lacks, or the cost of building, which is the tokens to implement, maintain and fix until it matches the tool, plus the elapsed time).

Feasibility to confirm in the change's proposal: where the builder and reviewer briefs that #1833 names live (they are not under src/devops_cli/ai/tasks/ at the time of writing), and that the reply schema change reaches every reader of RefinementProposal.

Existing tool considered

The change reshapes an existing Pydantic reply model and prompts; no new machinery is built. Reading the reply back through OpenSpec (openspec validate --strict) is the next item. Nothing here duplicates an open tool.

The change

  • src/devops_cli/roadmap/refine.py: AcceptanceCriterion becomes {requirement, when, then} (extra="forbid" kept), and check_ready requires all three to be non-empty. The reply gains a field that carries the answer to the existing-tool question (the open tool and what it lacks, or the written cost of building), named in the proposal; whether an empty answer makes the item not ready is decided there, consistent with the feature request form, which requires the field.
  • The renderer of ## Proposed design writes each criterion with OpenSpec's requirement, scenario, WHEN and THEN headings and wording, so the plan has the shape agents write into a spec delta, and renders the existing-tool answer under its own heading.
  • src/devops_cli/ai/tasks/roadmap_refine_proposal.md: the reply keys are requirement, when and then and the new field, in plain Markdown as the project requires for prompts. The existing-tool question is added to the refine prompts (roadmap_refine_proposal.md and roadmap_refine_research.md, so research looks for the tool) and to the builder and reviewer briefs.
  • devops docs generate --sync-readme for any generated reference the change touches.

What it deletes

The description and verification keys of the criterion, their prompt text and the renderer's Criterion N and Verification: lines. No parser or alias for the old keys is kept (pre-1.0, no backwards compatibility).

Tests

  • tests/ for refine.py (the existing refine tests, found with grep -rln "AcceptanceCriterion\|check_ready" tests): the model rejects description or verification, accepts {requirement, when, then}, check_ready fails on an empty field, and the rendered proposal contains the OpenSpec headings and WHEN/THEN wording and the existing-tool section.
  • A prompt test (the existing prompt loading tests use load_task_prompt()) asserts the reply keys named in roadmap_refine_proposal.md equal the model's fields, so the prompt and the schema cannot drift.
  • Tests double only process edges: no model call is made; the model's reply is a fixture.

Dependencies

Depends on the item titled "feat(sdlc): replace task files with OpenSpec change folders" (the switch), because the shape it renders is the one the change folder takes only after the switch.

Planning record: this item is planned as a change folder.

Acceptance criteria

  • A refine reply with {requirement, when, then} criteria and the existing-tool answer validates, and a reply with the old keys is rejected.
  • The proposal written into the issue shows requirements, scenarios with WHEN and THEN, and the existing-tool answer.
  • The refine prompts and the builder and reviewer briefs ask the existing-tool question, and the prompt's reply keys equal the model's fields.
  • No reference to description or verification as criterion keys remains in src/, prompts or tests.
  • devops ci passes.

Proposed design

Problem statement

The refine job proposes acceptance criteria as {description, verification}, but after the OpenSpec switch the plan's behavior is written as spec-delta requirements with WHEN and THEN scenarios. A person or agent must translate every refined proposal into the shape the change folder takes. The refine job also does not ask the existing-tool question that AGENTS.md and the feature request form require of every plan. This step changes the criterion shape to {requirement, when, then}, adds the existing-tool answer to the reply, updates the prompts and briefs, and renders OpenSpec headings in the proposal written into the issue.

Acceptance criteria

  • Criterion 1: A refine reply with {requirement, when, then} criteria and the existing-tool answer validates, and a reply with the old description or verification keys is rejected.
    Verification: Run the refine model tests: a fixture reply with {requirement, when, then} passes Pydantic validation; a fixture with description or verification raises a validation error.
  • Criterion 2: The proposal rendered into the issue shows each criterion with OpenSpec Requirement, Scenario, WHEN and THEN headings, and the existing-tool answer under its own heading.
    Verification: Run the renderer test: the output of render_proposal_section contains '### Requirement', '#### Scenario', 'WHEN', 'THEN' and the existing-tool section heading for a valid proposal fixture.
  • Criterion 3: The refine prompts (roadmap_refine_proposal.md and roadmap_refine_research.md) and the builder and reviewer briefs ask the existing-tool question, and the prompt's reply keys equal the model's fields.
    Verification: Run the prompt-loading test: the keys named in roadmap_refine_proposal.md equal the fields of RefinementProposal and AcceptanceCriterion; grep the briefs for the existing-tool question text.
  • Criterion 4: No reference to description or verification as criterion keys remains in src/, prompts or tests.
    Verification: Run grep -rn 'description|verification' src/devops_cli/roadmap/refine.py src/devops_cli/ai/tasks/ tests/ and confirm no hit names them as AcceptanceCriterion fields.
  • Criterion 5: devops ci passes.
    Verification: Run uv run devops ci and confirm all checks report passing status.

Key questions

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    on Oct 22, 2026
  2. dan-petty commented on Oct 22, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Type: type/feature. The candidate introduces a new feature to refine criteria as requirements with WHEN and THEN, and includes the existing tool question.
    • Priority: P2-Medium. This change is part of a larger OpenSpec adoption plan and impacts roadmap refinement but does not address an immediate issue or bug.
    • Value: High. Improves the clarity and structure of roadmap items, aiding in better planning and execution of changes.
    • Effort: Medium. Requires modifications to multiple files including refine logic, prompts, and rendering logic, but no new machinery is built.
  3. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

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

  4. added
    priority/p2-medium
    status/ready
    effort/medium
    value/high
    on Oct 28, 2026
  5. removed
    status/ready
    on Oct 30, 2026
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-mediumsource/agenttype/featurevalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions