Skip to content
Merged
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-14
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Design

## Context

`acceptance_criteria` reads each top-level item and removes the task marker with `_TASK_MARK`. A strike through the item leaves the `~~` marks in the text.

## Goals

- Drop a cancelled item.
- Keep an active item that holds an inline strikethrough.

## Decisions

- **The span wraps the text.** The text starts and ends with `~~` only when the span covers the whole item. An inline span leaves other text before or after it.
- **The checked form.** `~~[x] Dropped~~` arrives as `~~Dropped~~` after the task marker is removed, so the same condition drops it.

## Risks

- A criterion that begins and ends with `~~` as literal text is dropped. That text is a strikethrough in Markdown, so the reader treats it as cancelled.

## Tests

- An unchecked struck item and a checked struck item give no criterion.
- A mixed list keeps the active items in order.
- An active item with an inline span keeps its text.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Proposal

## Why

`acceptance_criteria` reads a checklist item under `Acceptance criteria` as an active criterion even when a strikethrough wraps it. A maintainer strikes out a criterion to cancel it, and the planner then plans and validates the dropped text (#4024).

## What Changes

- `acceptance_criteria` omits a list item whose text starts and ends with `~~` and is longer than four characters.
- An active item with an inline `~~` span keeps its text.
- The change fits one pull request.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

- `roadmap-stage/criteria`: A struck-through acceptance criterion is not a criterion.

## Impact

- Code: `src/devops_cli/roadmap/stage/stage_criteria.py`
- Tests: `tests/roadmap/stage/test_roadmap_stage_criteria.py`

## Feasibility

- The parser already builds the text of each item and strips the task marker.
- A strikethrough that wraps the item begins and ends the text; an inline span does not.
- Verification commands: `uv run devops ci test tests/roadmap/stage/test_roadmap_stage_criteria.py` and `uv run devops ci --check --only lint,format,typecheck`.

## Existing Tool Considered

The Markdown parser already gives the inline text. The change adds one condition, and no library.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## ADDED Requirements

### Requirement: A struck-through acceptance criterion is not a criterion
`acceptance_criteria` SHALL omit a top-level checklist item whose text starts and ends with `~~`, whether the task marker is unchecked or checked. It SHALL keep a non-struck item, an inline `~~` span included, in its original order.

#### Scenario: An unchecked struck item
- **WHEN** the section holds `- ~~[ ] Dropped criterion~~`
- **THEN** `acceptance_criteria` returns no item

#### Scenario: A checked struck item
- **WHEN** the section holds `- ~~[x] Dropped criterion~~`
- **THEN** `acceptance_criteria` returns no item

#### Scenario: A mixed list
- **WHEN** the section holds `- ~~[ ] Dropped~~`, `- [ ] Kept one` and `- [x] Kept two`
- **THEN** `acceptance_criteria` returns `["Kept one", "Kept two"]`

#### Scenario: An inline span in an active item
- **WHEN** the section holds `- [ ] Keep ~~this~~ text`
- **THEN** `acceptance_criteria` returns `["Keep ~~this~~ text"]`
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Tasks

## 1. Drop a cancelled criterion

Reads: `src/devops_cli/roadmap/stage/stage_criteria.py`. Changes: the same file and `tests/roadmap/stage/test_roadmap_stage_criteria.py`.

- [x] 1.1 Omit an item whose text starts and ends with `~~`.
- [x] 1.2 Add the four tests.
- Verification: `$ uv run devops ci test tests/roadmap/stage/test_roadmap_stage_criteria.py` passes
19 changes: 19 additions & 0 deletions openspec/specs/roadmap-stage/criteria/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,22 @@ The golden-set replay SHALL run the `criteria` gate on a plan that has a `criter
#### Scenario: A recorded plan has no list
- **WHEN** The replay runs a recorded plan with no `criteria` key
- **THEN** the `criteria` gate finds no problem

### Requirement: A struck-through acceptance criterion is not a criterion
`acceptance_criteria` SHALL omit a top-level checklist item whose text starts and ends with `~~`, whether the task marker is unchecked or checked. It SHALL keep a non-struck item, an inline `~~` span included, in its original order.

#### Scenario: An unchecked struck item
- **WHEN** the section holds `- ~~[ ] Dropped criterion~~`
- **THEN** `acceptance_criteria` returns no item

#### Scenario: A checked struck item
- **WHEN** the section holds `- ~~[x] Dropped criterion~~`
- **THEN** `acceptance_criteria` returns no item

#### Scenario: A mixed list
- **WHEN** the section holds `- ~~[ ] Dropped~~`, `- [ ] Kept one` and `- [x] Kept two`
- **THEN** `acceptance_criteria` returns `["Kept one", "Kept two"]`

#### Scenario: An inline span in an active item
- **WHEN** the section holds `- [ ] Keep ~~this~~ text`
- **THEN** `acceptance_criteria` returns `["Keep ~~this~~ text"]`
4 changes: 4 additions & 0 deletions src/devops_cli/roadmap/stage/stage_criteria.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ def acceptance_criteria(body: str) -> list[str]:
elif level and token.type == "list_item_open" and token.level == _ITEM_LEVEL:
inline = next(t for t in tokens[index + 1 :] if t.type == "inline")
text = _one_line(_TASK_MARK.sub("", inline.content.strip()))
# A strikethrough that wraps the item cancels it (#4024). An inline span in an active
# item does not start or end the text, so it stays.
if text.startswith("~~") and text.endswith("~~") and len(text) > 4:
continue
if text and text not in found:
found.append(text)
return found
Expand Down
24 changes: 24 additions & 0 deletions tests/roadmap/stage/test_roadmap_stage_criteria.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,27 @@ def test_a_pending_person_criterion_that_the_issue_does_not_list_is_reported() -
problems = criterion_problems([entry], body, 1)

assert "Add the label" in " ".join(problems)


def test_a_struck_through_unchecked_item_is_no_criterion() -> None:
body = "## Acceptance criteria\n\n- ~~[ ] Dropped criterion~~\n"

assert acceptance_criteria(body) == []


def test_a_struck_through_checked_item_is_no_criterion() -> None:
body = "## Acceptance criteria\n\n- ~~[x] Dropped criterion~~\n"

assert acceptance_criteria(body) == []


def test_active_items_beside_a_struck_item_keep_their_order() -> None:
body = "## Acceptance criteria\n\n- ~~[ ] Dropped~~\n- [ ] Kept one\n- [x] Kept two\n"

assert acceptance_criteria(body) == ["Kept one", "Kept two"]


def test_an_inline_strikethrough_in_an_active_item_keeps_the_item() -> None:
body = "## Acceptance criteria\n\n- [ ] Keep ~~this~~ text\n"

assert acceptance_criteria(body) == ["Keep ~~this~~ text"]