Skip to content

fix(#850): parse bare-checkbox ACs under an Acceptance Criteria heading - #861

Merged
admarble merged 4 commits into
mainfrom
feature/850-ac-parser-requires-an-id-prefix-so-human-written-i
Jul 30, 2026
Merged

admarble merged 4 commits into
mainfrom
feature/850-ac-parser-requires-an-id-prefix-so-human-written-i

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Human-written issues rarely prefix their ACs with IDs, so every AC_PATTERNS entry requiring an ID prefix (AC-1:, B2:, **AC-1**) meant ordinary hand-authored issues parsed to zero ACs — silently blinding every TS-side AC consumer (scope analyzer, AC linter, /testgen, and the ready gate's Non-Goal classifier, which goes dead the moment parseNonGoals sees an empty AC list).
  • parseAcceptanceCriteria is now section-aware (mirroring parseNonGoals in ready-gate.ts): the existing ID patterns still run unchanged on every line, and a bare-checkbox fallback is layered on top that fires only under an explicit ## Acceptance Criteria heading (case-insensitive), synthesizing stable AC-N IDs that skip any ID already taken by an explicit marker.
  • Four real matcha-maps issue bodies are committed as hermetic fixtures under src/lib/__fixtures__/ac-parser/.

Pre-PR AC Verification

AC Source Description Status Evidence
AC-1 Original Bare checkboxes under ## Acceptance Criteria parse with synthesized stable IDs ✅ Implemented ac-parser.ts bare fallback + bareCount synthesizer; tests "parses bare checkboxes…", "synthesizes IDs deterministically…", "matches the heading case-insensitively", "skips IDs already taken…"
AC-2 Original Bare form honored ONLY under the AC heading ✅ Implemented inAcSection toggles on AC_HEADING_RE, closes at next heading; tests "ignores bare checkboxes when there is no AC heading", "stops honoring… at the next heading", #750 negative fixture
AC-3 Original Issues #745, #686, #703, #750 are fixtures asserting a non-zero parsed-AC count ⚠️ Partial — see note Fixtures committed: #686→4, #703→2, #745→6 (non-zero). #750→0 (see below)
AC-4 Original Existing ID-prefixed parsing unchanged ✅ Implemented ID patterns run on every line regardless of section; all 26 pre-existing tests + #745 fixture (6 via ID path) green

⚠️ AC-3 vs AC-2 contradiction (surfaced in /spec Q2)

#750 has no ## Acceptance Criteria heading — only ## Open questions … bare checkboxes. AC-3 lists it as a non-zero fixture, but AC-2 requires exactly those unrelated checkboxes to parse to 0. The two cannot both hold. AC-2 is the actual requirement of this issue (bare boxes only under the heading); a non-zero result for #750 would re-open the "any checklist is an AC" ambiguity the parser exists to guard against. #750 is therefore committed as the AC-2 negative fixture (asserts 0) — the strongest real-world proof of the guard. Flagging for maintainer confirmation.

Note on #745 (spec Q1): its live body was already rewritten to **AC-N:** IDs as a workaround (see its own <sub> note citing #850), so it parses via the existing patterns and doubles as an AC-4 regression fixture. The new bare-checkbox path is genuinely exercised by the two real bare-checkbox issues, #686 and #703.

Mutation verification (per CLAUDE.md gate-test rule)

Mutation Expected Result
AC_HEADING_RE → never matches (kills bare path) new-path tests fail ✅ exactly 7 #850 positive tests failed; negatives, #745, and all 26 existing tests stayed green
AC_HEADING_RE → matches any heading (breaks AC-2 scoping) guard tests fail ✅ exactly 4 tests failed (#750, "no AC heading", "stops at next heading", pre-existing "empty array")
Strip ## Acceptance Criteria heading from #686 fixture #686 fixture test fails ✅ exactly 1 test failed (#686), proving the fixture gate reads the payload, not file existence

Test plan

  • npm run build — clean (tsc)
  • npm run lint — clean (eslint, 0 warnings)
  • ac-parser.test.ts — 36 passed (26 existing + 10 new)
  • Consumer suites (ac-linter, scope, chain-preflight, state-manager) — 231 passed, no regressions
  • Three mutations verified (table above)

Closes #850

Every AC_PATTERNS entry required an ID prefix, so ordinary human-written
issues (bare `- [ ]` items, no ID) parsed to zero ACs, silently blinding
every TS-side AC consumer including the ready gate's Non-Goal classifier.

parseAcceptanceCriteria is now section-aware (mirroring parseNonGoals):
existing ID patterns run unchanged on every line, plus a bare-checkbox
fallback that fires only under a case-insensitive `## Acceptance Criteria`
heading, synthesizing stable AC-N IDs that skip explicit-marker collisions.

Real matcha-maps issue bodies committed as hermetic fixtures: #686 (4),
#703 (2, lowercase heading), #745 (6, existing ID path), #750 (0, negative
guard resolving the AC-2 vs AC-3 contradiction the spec surfaced).

Entire-Checkpoint: 87d4ea18cbb9
admarble added 3 commits July 29, 2026 21:51
…cannot drop an author's AC

A bare checkbox listed before an explicit **AC-1:** under the same heading
synthesized AC-1 first, and the explicit AC-1 was then silently dropped by
the first-occurrence dedupe. Synthesis now skips IDs owned by explicit
markers anywhere in the body, not just those seen so far.

Mutation-verified: reverting the explicitIds guard fails exactly the new
test 'skips IDs taken by explicit markers that appear after the bare item'
(36 passed, 1 failed); restored, all 37 pass.
…-requires-an-id-prefix-so-human-written-i

# Conflicts:
#	CHANGELOG.md
…-requires-an-id-prefix-so-human-written-i

# Conflicts:
#	CHANGELOG.md
@admarble
admarble merged commit 44a7f1c into main Jul 30, 2026
5 checks passed
@admarble
admarble deleted the feature/850-ac-parser-requires-an-id-prefix-so-human-written-i branch July 30, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ac-parser requires an ID prefix, so human-written issues parse to zero ACs — blinds the ready gate's Non-Goal classifier

1 participant