Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-08
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Design

## Decisions

- **Add the refusal to `criterion_problems` in `src/devops_cli/roadmap/stage/stage_criteria.py`.**: That function is the one check that the stage job, the implement job and the plan check run on a `criteria` list, and `check_gates` already routes it under `ProposalGate.CRITERIA`, so one function keeps one source of truth for the match.
- **Add the rule under a requirement of its own and leave the base requirement `An unmapped criterion is refused` unmodified.**: The open change `openspec/changes/3391-refuse-criteria-entries-not-in-the/` modifies that requirement, and two active changes never modify one requirement, so each change archives without a conflict in `openspec/specs/roadmap-stage/spec.md`.
- **Give the replay's `paths` gate the issue body of a plan that has a `criteria` list, and no body for a plan that has none.**: `_path_gate` calls `check_proposal`, which runs the criteria rule; with no body every entry is unmatched, and the existing replay assertions would refuse a plan whose entries copy its issue.
- **Normalize an entry and a criterion with `_one_line` before the match.**: A copy that differs only in spacing stays valid, as the missing-criterion check already compares whole texts on one line.
- **Keep the one-line fold and the character-for-character copy of the issue's criterion.**: #3019 and #3180 make the criterion the issue's item as written, and #3262 makes each `## Criteria` line start with a fixed word so a criterion cannot start a heading or a task.

## Rejected alternatives

- **Name the criteria in `## Criteria` with the requirement titles of the spec delta.**: The issue's expected line conflicts with the exact copy that #3019 and #3180 require, and `criterion_problems` matches an entry to a criterion by that text (`src/devops_cli/roadmap/stage/stage_criteria.py:def criterion_problems`), so a requirement title would break the match that the check reads.
- **Render a criterion as markdown, with its heading and scenario lines.**: `src/devops_cli/roadmap/stage/stage_change.py:def criteria_section` folds each criterion with `_one_line` so that a criterion `## 2. X` is no heading of `tasks.md`, and the section is a plain bullet list with no box.
- **Leave the rule to the stage prompt and accept an entry that no person wrote.**: The prompt already states the empty-list rule, and `openspec/changes/3391-refuse-criteria-entries-not-in-the/design.md:16:The plan for #3320 in #3333 copied five refine-block criteria and every gate accepted it, although the prompt already stated the empty-list rule.`
- **Accept a substring of a criterion as a match.**: A partial text can match a different criterion and weaken the check; the missing-criterion rule compares whole texts, and the prompt requires the item copied character for character.
- **Let the replay's `paths` gate judge the criteria rule with no issue body.**: `src/devops_cli/roadmap/stage/stage_eval_gates.py:def _path_gate` passes no `issue_body`, so the new rule would refuse the entries of `tests/roadmap/stage/test_roadmap_stage_eval_gates.py:311:assert not replay_case(_with_criteria(good, both)).refused`, which copies the criteria of its body.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Proposal

## Why

The stage job accepts a `criteria` entry that no person wrote and writes it into `## Criteria` of `tasks.md` as one folded line. #3326 shows the result: a pasted `### Requirement: ... #### Scenario: ...` block, taken from the refine block, reaches the change. The implement job then verifies steps against a criterion that the issue does not hold, and the change hides that the issue gave none. The issue asks for clean requirement names instead; the exact copy of #3019 is the rule, so the check must refuse the entry that no person wrote and name it.

## What Changes

- Refuse each `criteria` entry whose text is not an acceptance criterion that a person wrote in the issue body, in `src/devops_cli/roadmap/stage/stage_criteria.py`.
- Add the message `stage_problem_criterion_unknown` to `src/devops_cli/lang/en/messages.py`; it quotes the entry and says that no person wrote it.
- Give the replay's `paths` gate the issue body of a plan that has a `criteria` list, in `src/devops_cli/roadmap/stage/stage_eval_gates.py`.
- State the refusal in the `criteria` bullet of `src/devops_cli/ai/tasks/roadmap_stage_change.md`.
- Cover the refusal in `tests/roadmap/stage/test_roadmap_stage_criteria.py`, the body in `tests/roadmap/stage/test_roadmap_stage_eval_gates.py` and the prompt sentence in `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`.
- Keep the one-line fold and the character-for-character copy of the issue's criterion that #3019 and #3180 require, so the requirement titles of the spec delta stay out of `## Criteria`.
- The change alters what a `devops` message says and what the stage check refuses, so `skip_specs` is false and the delta adds two requirements to `roadmap-stage`.
- The change fits one pull request.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

- `roadmap-stage`: An unmatched criteria entry is refused, The paths gate reads the body of a plan with a criteria list

## Impact

- Code: `src/devops_cli/roadmap/stage/stage_eval_gates.py`, `src/devops_cli/roadmap/stage/stage_criteria.py`, `src/devops_cli/lang/en/messages.py`
- Documents: `src/devops_cli/ai/tasks/roadmap_stage_change.md`
- Tests: `tests/roadmap/stage/test_roadmap_stage_eval_gates.py`, `tests/roadmap/stage/test_roadmap_stage_criteria.py`, `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`

## Feasibility

- The probes moved the module that the issue cites. The probe says "The path `src/devops_cli/roadmap/stage_criteria.py` is no file at the root of the staging commit. These files of the commit are candidates: `src/devops_cli/roadmap/stage/stage_criteria.py`. Commit bff2f14f 2026-11-06 refactor(roadmap): group the job modules in subpackages (#3897) deleted or renamed it." The plan cites `src/devops_cli/roadmap/stage/stage_criteria.py` and plans no code for the old path.
- The probe moved the plan-check module too. It says "The path `src/devops_cli/roadmap/stage_change.py` is no file at the root of the staging commit. These files of the commit are candidates: `src/devops_cli/roadmap/stage/stage_change.py`." The plan cites the moved path.
- The expected output of the issue, a requirement title in place of the issue's criterion, cannot be built as written. `src/devops_cli/roadmap/stage/stage_change.py:def criteria_section` folds each criterion with `_one_line`, and each line starts with a fixed word: `src/devops_cli/lang/en/messages.py:3670:stage_criteria_line: str = "Group {group}: {criterion}"`. #3019 and #3180 make the criterion the issue's list item copied character for character, which `src/devops_cli/roadmap/stage/stage_criteria.py:def acceptance_criteria` returns, so the plan keeps the copy and the fold and refuses the entry that no person wrote.
- The defect that the refine block names is in the code. `src/devops_cli/roadmap/stage/stage_criteria.py:def criterion_problems` builds `mapped` from the entry texts and refuses only a missing criterion and a group over the count, so no line compares an entry with the person-written list. `src/devops_cli/roadmap/stage/stage_change.py:def check_gates` routes that function under `ProposalGate.CRITERIA`, so one function keeps one source of truth for the match.
- The constants that the plan relies on are staged. `PENDING_PERSON: Final[str] = "pending-person"` is `src/devops_cli/roadmap/stage/stage_criteria.py:41:PENDING_PERSON: Final[str] = "pending-person"`. The refine block is cut off by `src/devops_cli/config/constants.py:3051:CONST_ROADMAP_REFINE_START_MARKER: Final[str] = "<!-- devops-roadmap-refine:start -->"` and `src/devops_cli/config/constants.py:3052:CONST_ROADMAP_REFINE_END_MARKER: Final[str] = "<!-- devops-roadmap-refine:end -->"`.
- The replay's paths gate holds no body today. `src/devops_cli/roadmap/stage/stage_eval_gates.py:def _path_gate` calls `check_proposal` with no `issue_body`, while `src/devops_cli/roadmap/stage/stage_eval_gates.py:def _criteria_gate` gives the criteria rule `plan.issue_body`. The existing assertion `tests/roadmap/stage/test_roadmap_stage_eval_gates.py:311:assert not replay_case(_with_criteria(good, both)).refused` would refuse a plan whose entries copy its body once the refusal exists, so group 1 gives the paths gate the body first.
- The stage prompt holds the rule that the sentence joins. `search_code` of `An issue with no such list gets an empty list` returned the `criteria` bullet, and the file holds `src/devops_cli/ai/tasks/roadmap_stage_change.md:50:An issue with no such list gets an empty list.` beside `The check refuses a reply that leaves one item out.`
- The item repeats the defect of the open item #3391, whose change `openspec/changes/3391-refuse-criteria-entries-not-in-the/` plans the same refusal and modifies the base requirement `An unmapped criterion is refused`. Two active changes never modify one requirement (ADR 0010, `docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md`), so this change adds its rules under names of their own and leaves that requirement alone. The open item #4081 tracks the paths-gate coupling that group 1 repairs, and this change repairs it as part of the rule.
- No function that the change calls needs a client of a service or a network: `criterion_problems` and `acceptance_criteria` take strings, and `src/devops_cli/roadmap/stage/stage_eval_gates.py:def _path_gate` takes a `PlanUnderTest` whose tree and body the replay reads from the recorded case files. `src/devops_cli/roadmap/plan_check.py:def _gate_problems` needs a checkout of the repository and a client of GitHub: it reads the staged tree with git and the issue body through `PlanReads`.
- The first checks against the real system are `uv run devops ci test tests/roadmap/stage/test_roadmap_stage_eval_gates.py`, then `uv run devops ci test tests/roadmap/stage/test_roadmap_stage_criteria.py`, then `uv run devops ci test tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`, then `uv run devops roadmap eval stage --replay` with the score before and after the change.

## Existing Tool Considered

OpenSpec (Fission-AI/OpenSpec, MIT, last activity 2026-11-05, maintained) is the project's spec and change-proposal layer by `docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md`. It owns the spec delta with the requirement titles and the `#### Scenario:` blocks and validates them. It does not build `## Criteria`, map a criterion to a group, or refuse an entry that no person wrote, so the rule stays in `criterion_problems`. The change builds about 4k tokens of code to keep and fix, in about 1 hour, and deletes no internal code: `acceptance_criteria`, `criterion_problems` and `_path_gate` stay.

## Dependencies

None.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## ADDED Requirements

### Requirement: An unmatched criteria entry is refused
`criterion_problems` SHALL refuse each `criteria` entry whose text is not an acceptance criterion that a person wrote in the issue body, and SHALL match an entry to a criterion by its text with the whitespace collapsed. The problem MUST hold the text of the entry, and `check_gates` SHALL report it under `ProposalGate.CRITERIA`.

#### Scenario: Pasted requirement heading
- **WHEN** The refine block gives a `criteria` entry that is a pasted `### Requirement: ...` block, and no acceptance criterion of the issue has that text
- **THEN** `criterion_problems` returns one problem, and `check_gates` reports it under `ProposalGate.CRITERIA`

#### Scenario: Criterion copied from the issue
- **WHEN** A `criteria` entry copies one acceptance criterion of the issue character for character
- **THEN** `criterion_problems` returns no problem for that entry

#### Scenario: Problem names the entry
- **WHEN** `criterion_problems` refuses an unmatched `criteria` entry
- **THEN** the problem text holds the text of that entry

#### Scenario: An issue with no person-written list takes an empty list
- **WHEN** The issue body has no `Acceptance criteria` heading outside the refine block and the reply's `criteria` list is empty
- **THEN** `criterion_problems` returns no problem for the criteria mapping

### Requirement: The paths gate reads the body of a plan with a criteria list
The replay's `paths` gate SHALL give `check_proposal` the issue body of a plan that has a `criteria` list, and SHALL give no body for a plan that has none, so the criteria rule reads the same body as the stage job.

#### Scenario: A plan copies its issue's criteria
- **WHEN** The replay runs a plan whose `criteria` entries copy the criteria of its issue
- **THEN** the `paths` gate returns no problem for those entries

#### Scenario: A recorded plan has no list
- **WHEN** The replay runs a recorded plan with no `criteria` key
- **THEN** the `paths` gate judges no entry
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Tasks

## 1. Give the paths gate the issue body of a mapped plan

Reads: `src/devops_cli/roadmap/stage/stage_eval_gates.py`, `src/devops_cli/roadmap/stage/stage_change.py`, `src/devops_cli/roadmap/stage/stage_criteria.py`, `tests/roadmap/stage/test_roadmap_stage_eval_gates.py`. Changes: `src/devops_cli/roadmap/stage/stage_eval_gates.py`, `tests/roadmap/stage/test_roadmap_stage_eval_gates.py`.

- [ ] 1.1 In `tests/roadmap/stage/test_roadmap_stage_eval_gates.py`, run the gates on `_with_criteria(good, [])`: the `paths` gate names the criteria `First.` and `Second.` of `ACCEPTANCE_BODY`. With both entries mapped it names no criterion, and a case with no `criteria` key and the same body names none
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_eval_gates.py` fails on the base
- [ ] 1.2 In `src/devops_cli/roadmap/stage/stage_eval_gates.py`, pass `issue_body=plan.issue_body if plan.mapped else ""` to `check_proposal` in `_path_gate`, and state that rule in its docstring
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_eval_gates.py` passes

## 2. Refuse a criteria entry that no person wrote

Reads: `src/devops_cli/roadmap/stage/stage_criteria.py`, `src/devops_cli/lang/en/messages.py`, `tests/roadmap/stage/test_roadmap_stage_criteria.py`. Changes: `src/devops_cli/roadmap/stage/stage_criteria.py`, `src/devops_cli/lang/en/messages.py`, `tests/roadmap/stage/test_roadmap_stage_criteria.py`.

- [ ] 2.1 In `tests/roadmap/stage/test_roadmap_stage_criteria.py`, give a body whose only `Acceptance criteria` heading sits in the refine block and one entry copied from that block: `criterion_problems` returns one problem that quotes the entry. The same body with an empty list returns no problem
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_criteria.py` fails on the base
- [ ] 2.2 In `src/devops_cli/roadmap/stage/stage_criteria.py`, make `criterion_problems` add `MESSAGES.roadmap.stage_problem_criterion_unknown` for each entry whose `_one_line` text is not in `acceptance_criteria(issue_body)`, after the problems for a missing criterion. Add `stage_problem_criterion_unknown` to `src/devops_cli/lang/en/messages.py`: it quotes the entry, says that no person wrote it in the issue body, and says to copy a top-level item under the heading `Acceptance criteria` or to give an empty list
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_criteria.py` passes

## 3. State the refusal in the stage prompt

Reads: `src/devops_cli/ai/tasks/roadmap_stage_change.md`, `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`. Changes: `src/devops_cli/ai/tasks/roadmap_stage_change.md`, `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`.

- [ ] 3.1 In `tests/roadmap/stage/test_roadmap_stage_prompt_rules.py`, assert that the `criteria` bullet of the stage prompt states that the check refuses an entry whose text is not one of the criteria that a person wrote, beside the rule that an issue with no such list gets an empty list
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_prompt_rules.py` fails on the base
- [ ] 3.2 Add one sentence to the `criteria` bullet of `src/devops_cli/ai/tasks/roadmap_stage_change.md`: the check refuses an entry whose text is not one of the criteria that a person wrote in the issue body. Run `uv run devops roadmap eval stage --replay` and state the score before and after the change
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_prompt_rules.py` passes

## Workflow follow-up

- Pending a person: review the diff in tuicr (tuicr -r <base>..HEAD).