Skip to content

fix(ac-parser): fenced code-block AC examples get parsed as real ACs (#947) - #951

Merged
admarble merged 4 commits into
mainfrom
feature/947-fix-ac-parser-fenced-code-block-ac-examples-ge
Aug 20, 2026
Merged

admarble merged 4 commits into
mainfrom
feature/947-fix-ac-parser-fenced-code-block-ac-examples-ge

Conversation

@admarble

@admarble admarble commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • parseAcceptanceCriteria now tracks fenced-code-block state (computeFenceMask) and excludes fenced lines from both the main AC scan and the explicitIds pre-scan — an AC-authoring example shown inside a fence (``` or ~~~) is no longer parsed as a real AC.
  • Reproduces and fixes the bug live: feat(spec/qa): explicit Evidence: clause on ACs — declared verification replaces keyword inference #938's own issue body had a fenced Evidence:-clause example that shadowed its real AC-1 under the parser's first-occurrence dedupe.
  • A #-prefixed line inside a fenced shell block no longer closes the AC section early (fixed alongside the primary bug — same fence-boundary root cause).
  • Sibling gap fix (flagged during QA, not a formal issue AC): scope/analyzer.ts's parseNonGoals had the identical fence-blindness bug — a fenced example under ## Non-Goals was read as a real non-goal item. Fence-tracking is now extracted into shared src/lib/markdown-fence.ts (computeFenceMask / stripFencedLines) and used by both ac-parser.ts and parseNonGoals, so the two scanners can't independently drift on fence-boundary rules.

Pre-PR AC Verification

AC Source Description Status Evidence
AC-1 Original Fenced AC-pattern lines not parsed as real ACs (before/after AC section) ✅ Implemented src/lib/ac-parser.ts computeFenceMask + 6 new tests in ac-parser.test.ts; npm test -- ac-parser → 83 passed
AC-2 Original All existing fixtures (#686/#703/#745/#750) parse identically — zero diffs ✅ Implemented npm test -- ac-parser → 83 passed, no fixture-expectation changes
AC-3 Original Re-parsing #938's verbatim body extracts the real AC-1 ✅ Implemented src/lib/__fixtures__/ac-parser/issue-938.md (verbatim) + regression test asserting criteria[0].description starts with `parseACLine`
AC-4 Gap fix (not in issue) parseNonGoals excludes fenced example lines, same as AC-1 ✅ Implemented src/lib/markdown-fence.test.ts (6 tests) + 2 new tests in scope/scope.test.ts; npx vitest run src/lib/scope/scope.test.ts → 42 passed

Mutation Verification

Mutation-verified: AC-1 — computeFenceMask stubbed to unconditionally return false (fence tracking disabled); exactly the 6 new fenced-code-block tests failed (nothing else), including the AC-1 synthetic-fence tests and the AC-3 #938 regression test; restored and re-confirmed 83/83 passing.

Mutation-verified: AC-4 — parseNonGoals's stripFencedLines(issueBody) call replaced with the raw issueBody (fence-stripping disabled); exactly the 2 new fenced-Non-Goals tests failed (nothing else); restored and re-confirmed 42/42 passing in scope.test.ts.

Test plan

  • npm test -- ac-parser — 83/83 passed
  • npx vitest run src/lib/scope/scope.test.ts src/lib/markdown-fence.test.ts src/lib/ac-parser.test.ts — 131/131 passed
  • Full suite: npm test — 267 test files, 5491 passed, 1 expected fail, 2 skipped (zero regressions)
  • npm run build — passes
  • npm run lint — passes (0 errors)

Closes #947

)

Extracts fence-tracking into shared src/lib/markdown-fence.ts, used by
both ac-parser.ts and scope/analyzer.ts's parseNonGoals, which had the
same fence-blindness bug flagged as a follow-up during #947's QA.
@admarble
admarble merged commit 64970ce into main Aug 20, 2026
5 checks passed
@admarble
admarble deleted the feature/947-fix-ac-parser-fenced-code-block-ac-examples-ge branch August 20, 2026 05:01
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.

fix(ac-parser): fenced code-block AC examples get parsed as real ACs, silently shadowing the real one

1 participant