Skip to content

feat(spec): ac-linter title/body tension — coverage tightening #597

Closed

Description

@admarble

Summary

The title-body-tension linter rule from #571 / #586 ships with intentionally tight coverage. Post-merge adversarial audit (/fullsolve 571 → "any gaps?") surfaced three real false-negative classes that should be tightened before relying on the rule for production /spec runs.

All gaps confirmed by running the detector at src/lib/ac-linter.ts against constructed AcceptanceCriterion fixtures.

Confirmed False Negatives

1. Separator narrowness

detectTitleBodyTension splits on description.search(/[.\n]/) only. Common AC styles using colon or em-dash separators are silently passed.

Input Should warn? Detector
"Documentation note: trigger /fullsolve and capture output" yes ❌ no
"Doc snippet — trigger workflow and capture output" yes ❌ no
"Smoke test note in PR description. Manually trigger ..." (#562 AC-5 verbatim) yes ✅ yes

2. Paraphrased motivating-example test fixture

src/lib/ac-linter.test.ts:228-240 uses a one-line paraphrase as the "motivating example from #562 AC-5". The detector fires on the verbatim multi-line text only because line 1 happens to contain trigger — a regression that broke either parser or linter on the verbatim string would still pass this paraphrased test. Memory feedback_motivating_example_regression.md and feedback_synthetic_test_fixture_trap.md cover this anti-pattern.

3. Inflected runtime-imperative forms

RUNTIME_IMPERATIVES items like trigger and capture are matched as \b<word>\b, missing past-tense and gerund forms common in AC body prose:

Input Detector
"Add note to PR description. Output is captured and workflow triggered automatically." ❌ no

Acceptance Criteria

  • AC-1: Widen separator regex. detectTitleBodyTension in src/lib/ac-linter.ts splits on /[.\n:—]/ (period, newline, colon, em-dash). Existing \bnote\b/\btrigger\b etc. lookups remain unchanged.
  • AC-2: Replace paraphrased fixture with verbatim bug(fullsolve): unqualified Skill("loop") resolves to recurring-prompt skill, breaking quality loop #562 AC-5 source. The "motivating example from bug(fullsolve): unqualified Skill("loop") resolves to recurring-prompt skill, breaking quality loop #562 AC-5" test in src/lib/ac-linter.test.ts uses the literal multi-line description string as it appears in the issue body, not the current paraphrase.
  • AC-3: Suffix-tolerant runtime-imperative matching. Update the runtime-imperative regex construction so that trigger, triggers, triggered, triggering all match (and likewise for capture, execute, reproduce). E.g., \b<verb>(?:s|ed|ing|d)?\b or stem-aware list.
  • AC-4: Test fixtures for each fixed gap. Three new fixtures in src/lib/ac-linter.test.ts covering: colon separator, em-dash separator, inflected captured/triggered. Each asserts tension is detected.
  • AC-5: 3-mirror SKILL.md update. /spec's AC Quality Check table row for title/body tension reflects the broadened pattern (mention separators and inflections briefly). Sync across .claude/skills/spec/SKILL.md, skills/spec/SKILL.md, templates/skills/spec/SKILL.md.

Non-Goals

  • Not widening DOC_NOUNS beyond the original 7. False-negative volume in that list isn't yet observed; word-list creep is a known concern (see feat(spec): ac-linter — detect title/body verification-method tension #571 Risks).
  • Not fixing parseAcceptanceCriteria multi-line drop. When the AC body wraps across markdown source lines, the parser only captures line 1; lines 2+ are dropped before the linter sees them. This is a pre-existing limitation that materially caps the linter's coverage on the exact class of multi-line ACs it targets, but is parser-layer concern, not linter-layer. File a separate issue if and when it surfaces in practice.

Risks / Open Questions

  • False positives from broadened separator. Colon is also used in identifier prefixes (AC-3:, feat:) — but parseAcceptanceCriteria strips the AC ID prefix before the linter sees the description, so the first colon in the parsed description is genuinely a body separator. Verify with a unit test on Implementation: trigger workflow (should warn).
  • Inflection greediness. \btrigger(?:s|ed|ing|d)?\b could match triggers in unrelated contexts. Mitigation: warning-only (per AC-2 of feat(spec): ac-linter — detect title/body verification-method tension #571).

Complexity

small — ~20 LOC change in ac-linter.ts + ~30 LOC of tests + 3-mirror SKILL.md row tweak. No new files.

Self-Assessed Workflow

spec → exec → qa — small surface, no UI; testgen optional.

Related

Activity

  1. added
    enhancement
    on May 7, 2026
  2. admarble commented on May 8, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (5 ACs, 1 logical directory + 3 SKILL.md mirrors)

    AC Quality Check

    ⚠️ AC-1: "Widen separator regex. ... Existing \bnote\b/\btrigger\b etc. lookups remain unchanged."
    → Open-ended: "etc." leaves scope undefined
    → Suggest: trivial — "etc." here references the existing word-list which is unchanged by this AC. Acceptable as-is; flagged for transparency.

    ✅ AC-2, AC-3, AC-4, AC-5: Clear and testable.

    Summary: 1/5 flagged (false positive — "etc." refers to unchanged code, not new scope).


    Scope Assessment

    Non-Goals: Present in issue body (not widening DOC_NOUNS; not fixing parser multi-line drop). ✅

    Metric Value Status
    Feature count 2 ⚠️
    AC items 5 ✅
    Directory spread 3 (reported) → effectively 1 ⚠️ → ✅

    Verdict: ✅ SCOPE_OK (analyzer reports SCOPE_WARNING; the "3 directories" are src/lib/ plus 3 SKILL.md mirrors that must stay byte-identical, so logically a single change site. Feature-count "2" is a false split between linter code and SKILL.md doc — both serve one feature: tightened tension detection.)


    Acceptance Criteria

    AC-1: Widen separator regex

    Verification: Unit Test
    Scenario: Given an AC description "Documentation note: trigger /fullsolve and capture output" → When lintAcceptanceCriterion(ac) runs → Then result includes a title-body-tension issue. Same for em-dash separator.
    Assumptions: Confirmed — parseAcceptanceCriteria strips the AC-N: prefix before the linter sees the description (regex captures (.+) after the : in patterns 1/2/4 and inside **...** for pattern 3, ac-parser.ts:45-54). So the first colon in the parsed description is genuinely a body separator, not an AC ID delimiter.

    AC-2: Replace paraphrased fixture with verbatim #562 AC-5 source

    Verification: Unit Test
    Scenario: Given the literal multi-line description from #562 AC-5 (verbatim, including Smoke test note in PR description.** Manually trigger \/fullsolve` ...) → When lintAcceptanceCriterion(ac)runs → Thentitle-body-tensionis detected. **Assumptions:** The fixture bypassesparseAcceptanceCriteria(which would drop lines 2+ per the Non-Goal in #597) and constructs theAcceptanceCriteriondirectly with the multi-line string. Verbatim source fromgh issue view 562 --json body`.

    AC-3: Suffix-tolerant runtime-imperative matching

    Verification: Unit Test
    Scenario: Given "Add doc note. Output is captured and workflow triggered automatically." → When linter runs → Then tension detected via inflected triggered/captured.
    Assumptions: Multi-word entry "verify by running" cannot use (?:s|ed|ing|d)? blindly (would produce verify by runnings/runninged). Implementation must apply suffixes only to single-word stems — either (a) split the list into single-word verbs (build with suffix regex) and multi-word phrases (literal \b<phrase>\b), or (b) maintain a single list of objects {stem, allowSuffix}.

    AC-4: Test fixtures for each fixed gap

    Verification: Unit Test
    Scenario: src/lib/ac-linter.test.ts adds three new it(...) blocks under describe("title-body-tension patterns"): (i) colon separator, (ii) em-dash separator, (iii) inflected runtime imperative. Each asserts result.issues.find(i => i.type === "title-body-tension") is defined.

    AC-5: 3-mirror SKILL.md update

    Verification: Manual Test (diff)
    Scenario: The Title/body tension row at line 89 of all three SKILL.md mirrors mentions the broadened pattern (separators and inflections, briefly). diff .claude/skills/spec/SKILL.md skills/spec/SKILL.md and diff .claude/skills/spec/SKILL.md templates/skills/spec/SKILL.md produce no output.
    Assumptions: Suggested wording: replace "doc-noun title (...) + runtime-imperative body (..., `run /`)" with "doc-noun title (...) + runtime-imperative body (matches inflections like triggered/captured and separators ./\n/:/—)" — keep concise.


    Implementation Plan

    Phase 1: Linter changes (src/lib/ac-linter.ts)

    1. AC-1 — separator widening. Change line 318 from description.search(/[.\n]/) to description.search(/[.\n:—]/). No other change to detectTitleBodyTension.
    2. AC-3 — suffix tolerance. Refactor the runtime-imperative loop (lines 333-335). Recommended approach: keep RUNTIME_IMPERATIVES as-is (mixed single-word + multi-word), inside the .find() callback build the regex as: imp.includes(" ") ? new RegExp("\\b" + imp + "\\b", "i") : new RegExp("\\b" + imp + "(?:s|ed|ing|d)?\\b", "i"). Trivial heuristic — multi-word entries get literal match, single-word entries get inflected match.

    Phase 2: Tests (src/lib/ac-linter.test.ts)

    1. AC-2 — verbatim fixture. Replace the test at lines 228-240. Use a multi-line string literal containing the exact body of bug(fullsolve): unqualified Skill("loop") resolves to recurring-prompt skill, breaking quality loop #562 AC-5 as it appears in the issue body. Source via gh issue view 562 --json body --jq .body | sed -n '/AC-5/,/AC-6\|^## /p' and embed with template literal.
    2. AC-4 — three new fixtures. Add three it(...) blocks to the describe("title-body-tension patterns") group covering colon separator, em-dash separator, and inflected triggered/captured. Each constructs an AcceptanceCriterion directly and asserts tension issue is present.

    Phase 3: SKILL.md mirror sync (3 files)

    1. AC-5 — update Title/body tension row. Edit line 89 in all three mirrors with the same one-liner (suggested wording in AC-5 above). After editing, run diff pairs to confirm byte-identical.

    Phase 4: Verify

    1. npx vitest run src/lib/ac-linter.test.ts — all tests pass, including new fixtures.
    2. diff .claude/skills/spec/SKILL.md skills/spec/SKILL.md && diff .claude/skills/spec/SKILL.md templates/skills/spec/SKILL.md — empty output.
    3. Re-run the detector against the three "❌ no" rows in the issue body's tables — all should now warn.

    Design Review

    1. Where does this logic belong? detectTitleBodyTension in src/lib/ac-linter.ts. The fix is local — same function, same file. No new abstraction warranted.
    2. What's the simplest correct approach? Modify the regex character class (1 char added: :—) and add per-entry inflection branching (1 ternary in the existing .find() callback). Reject: building a stems-tagged data structure ({stem, allowSuffix}) — overkill for ~5 entries with a clean single-word/multi-word split.
    3. What existing pattern does this follow? Mirrors DEFAULT_LINT_PATTERNS style (per-entry regex), but built dynamically from string lists. Same warning-only contract.
    4. What would a senior reviewer challenge? "Why the em-dash literal — (U+2014) and not also en-dash – (U+2013)?" → Defensible answer: issue feat(spec): ac-linter title/body tension — coverage tightening #597 only enumerates em-dash; en-dash is rare in AC prose; if it surfaces, file-and-add. Avoid scope creep. Flag in Open Questions below.

    Feature Quality Planning

    All standard checks pass. Notable items:

    • No parser changes. Issue explicitly defers parseAcceptanceCriteria multi-line drop. AC-2 fixture must bypass the parser — call out in test comment so future readers don't "fix" it by routing through the parser.
    • Sibling-site scan: I read ac-linter.ts adversarially for sibling code sharing the same root cause. detectTitleBodyTension is the only function with title/body split logic; the \b<word>\b pattern in DEFAULT_LINT_PATTERNS is for word-list matching (vague/unmeasurable/etc.) where suffix tolerance is not desired (e.g., flagging "fast" should not also flag "faster"… actually the existing patterns do hand-roll suffixes — /\bwork(?:s|ing)?/, /\bfast(?:er)?\b/. So the codebase already has the inflection pattern; AC-3 just brings runtime-imperatives in line. No additional sibling work.

    Open Questions

    1. En-dash separator (–, U+2013) — include alongside em-dash? Recommendation: skip — issue feat(spec): ac-linter title/body tension — coverage tightening #597 only enumerates em-dash, en-dash is rare in AC prose, file follow-up if observed. Impact if wrong: occasional false-negative on an exotic separator (low).
    2. Suggested SKILL.md wording for AC-5. The current row is one tightly-packed line; adding "separators and inflections" risks bloat. Recommendation in AC-5 above is one option; final wording is implementer's call as long as both concepts are mentioned.

    Recommended Workflow

    Phases: spec → exec → qa
    Quality Loop: disabled (small surface, all ACs unit-testable)
    Reasoning: Pure code + test + 3-mirror doc edit. No UI. ACs all map to Unit Test or trivial diff verification. No testgen phase — the test file already exists with established describe structure, AC-4 is "add 3 it(...) blocks", which is faster to author directly than via stub generation. Matches issuer's own self-assessed workflow.


    Label Review

    Current: enhancement
    Recommended: enhancement, simple-fix (optional — borderline; ~50 LOC across 5 files)
    Reason: Standard tier with clean ACs. No quality-loop trigger.
    Quality Loop: Will not auto-enable (scope is logically green; analyzer's SCOPE_WARNING is a false positive driven by directory-spread heuristic counting src/test/spec substring matches).

    → Optional: gh issue edit 597 --add-label simple-fix

  3. added
    planned
    on May 8, 2026
  4. admarble commented on May 8, 2026

    @admarble
    ContributorAuthor

    Exec Phase — Progress Update

    PR: #600

    AC Coverage Summary

    AC Status Evidence
    AC-1: Widen separator regex ✅ Implemented src/lib/ac-linter.ts:318 — split on /[.\n:—]/
    AC-2: Verbatim #562 AC-5 fixture ✅ Implemented src/lib/ac-linter.test.ts:228-243 — literal multi-line description, parser bypass commented
    AC-3: Suffix-tolerant runtime imperatives ✅ Implemented src/lib/ac-linter.ts:333-342 — stem-aware: \b<stem>(?:s|ed|ing)?\b for non-e verbs, \b<stem>(?:e|es|ed|ing)\b for e-ending verbs (handles gerunds like capturing/reproducing too)
    AC-4: Three new fixtures ✅ Implemented src/lib/ac-linter.test.ts:246-282 — colon, em-dash, inflected
    AC-5: 3-mirror SKILL.md update ✅ Implemented .claude/skills/spec/SKILL.md:89 + 2 mirrors (verified byte-identical)

    Files Changed

    • src/lib/ac-linter.ts (+15/-9): widened separator class, stem-aware suffix construction, JSDoc updated
    • src/lib/ac-linter.test.ts (+41/-1): replaced paraphrase fixture, added 3 new tests
    • .claude/skills/spec/SKILL.md (+1/-1), skills/spec/SKILL.md (+1/-1), templates/skills/spec/SKILL.md (+1/-1): broadened pattern row
    • CHANGELOG.md (+1): ### Fixed entry under [Unreleased]

    Test/Build/Lint Results

    Check Status Notes
    npx vitest run src/lib/ac-linter.test.ts ✅ 42 passed Was 39; +3 new fixtures (colon, em-dash, inflected)
    npx vitest run src/lib/ac-parser.test.ts ✅ 20 passed No regressions in adjacent module
    npm run build ✅ Clean tsc, no errors
    npm run lint ✅ Clean eslint --max-warnings 0

    Quality Plan Alignment

    N/A — no Feature Quality Planning section in issue body. Spec comment's quality notes were honored:

    • AC-2 fixture has inline comment calling out parser bypass intent (// Verbatim source from #562 AC-5 issue body (bypasses parser per #597 Non-Goals))
    • Sibling-site scan confirmed detectTitleBodyTension is the only function with title/body split logic; no other call sites needed changes

    Live Detection Verification

    Ran the updated linter against the three "❌ no" rows from the issue body's confirmed-false-negatives table, plus an extra gerund case to confirm the stem-aware approach exceeds the spec's (?:s\|ed\|ing\|d)? recommendation:

    ✅ colon separator -> title="note" + body="trigger"
    ✅ em-dash separator -> title="snippet" + body="trigger"
    ✅ verbatim #562 AC-5 -> title="note" + body="trigger"
    ✅ inflected captured/triggered -> title="note" + body="trigger"
    ✅ inflected capturing/triggering (gerund) -> title="note" + body="trigger"
    

    All five cases now warn.

    Pre-PR Confidence Check

    • Weakest part: The stem-aware approach for e-ending verbs (\b<stem>(?:e|es|ed|ing)\b) is slightly more aggressive than the spec comment's recommendation ((?:s|ed|ing|d)?). I chose the broader pattern because AC-3 wording explicitly requires "trigger, triggers, triggered, triggering all match (and likewise for capture, execute, reproduce)" — capturing/executing/reproducing need the e-drop handling that simple suffixing can't do. The broader regex could in principle match capturer etc., but those don't appear in the runtime-imperative semantic field, and the rule is warning-only per feat(spec): ac-linter — detect title/body verification-method tension #571 AC-2.
    • Coverage gaps: All five ACs have direct unit-test coverage. The non-trivial change in ac-linter.ts (the stem-aware ternary) is exercised by both the existing bug(fullsolve): unqualified Skill("loop") resolves to recurring-prompt skill, breaking quality loop #562 AC-5 verbatim fixture and the new inflected fixture. SKILL.md byte-identity is verified by diff rather than test, but the diff check is part of every CI run via lint:skill-calls precedent.

    Next Steps

    • /qa 597 to validate AC coverage and run final review.

    Documentation Reminder

    CHANGELOG entry added under [Unreleased] → ### Fixed. No docs/ updates required (the user-facing surface is the existing /spec AC Quality Check table, which is already mirrored across the three SKILL.md copies updated in AC-5).

  5. admarble commented on May 8, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #597 (Simple Fix)

    Size Gate

    Check Value
    Diff size 73 lines (threshold: 100)
    package.json changed No
    Security-sensitive paths No
    Decision Inline checks

    AC Coverage

    AC Description Status Notes
    AC-1 Widen separator regex /[.\n:—]/ ✅ MET src/lib/ac-linter.ts:319 matches AC text literally
    AC-2 Verbatim #562 AC-5 fixture ✅ MET src/lib/ac-linter.test.ts:228-232 includes the trailing ** markdown artifact (parser strips ID prefix, leaves bold-close); cross-checked against gh issue view 562 body
    AC-3 Suffix-tolerant runtime-imperative matching ✅ MET ac-linter.ts:334-343 chose stem-aware path (\b<stem>(?:e|es|ed|ing)\b for e-ending verbs, \b<imp>(?:s|ed|ing)?\b otherwise) — AC explicitly allows "or stem-aware list". Multi-word phrases keep literal matching
    AC-4 3 new fixtures (colon, em-dash, inflected) ✅ MET ac-linter.test.ts:243-280 adds three tests, each asserting tension is detected
    AC-5 3-mirror SKILL.md update ✅ MET All three mirrors (.claude/skills/spec/, skills/spec/, templates/skills/spec/) updated identically with broadened pattern + separator note

    Coverage: 5/5 AC items fully met


    Quality Metrics

    Metric Value Status
    Type issues (any) 0 in diff OK
    Deleted tests 0 OK
    Files changed 6 OK
    Lines added +61 -
    Lines deleted -12 -
    Tests 42/42 passing OK
    Build Clean (tsc exit 0) OK

    CI Status

    Check State Conclusion
    build (20.x) COMPLETED SUCCESS
    build (22.x) COMPLETED SUCCESS
    typecheck COMPLETED SUCCESS
    validate-skills COMPLETED SUCCESS
    validate-plugin COMPLETED SUCCESS
    Plugin Structure Validation COMPLETED SUCCESS
    Hooks Validation COMPLETED SUCCESS
    Setup Directory Creation COMPLETED SUCCESS

    CI Summary: All checks passing on PR #600. Mergeable: MERGEABLE.


    Code Review

    Strengths:

    • Stem-aware regex construction (ac-linter.ts:334-343) is more linguistically correct than the AC-suggested (?:s|ed|ing|d)? — handles capture/captures/captured/capturing cleanly without false-positive surface from a bare trailing d.
    • Multi-word phrase branch (if (imp.includes(" "))) preserved literal matching for verify by running / confirm at runtime — correctly avoids applying inflection to phrases.
    • Verbatim test fixture from bug(fullsolve): unqualified Skill("loop") resolves to recurring-prompt skill, breaking quality loop #562 AC-5 matches feedback_motivating_example_regression.md and feedback_synthetic_test_fixture_trap.md.
    • All three SKILL.md mirrors are byte-identical.
    • CHANGELOG entry under ### Fixed is detailed and references the issue.

    Issues:

    • None blocking.

    Suggestions (non-blocking):

    • Risks/Open Questions in the issue body listed Implementation: trigger workflow (should warn) as a verification target, but Implementation is not in DOC_NOUNS — this is in Risks (not an AC), so not blocking. If the intent was Documentation: trigger workflow, that case is already covered by the documentation doc-noun + colon split.

    Test Coverage Analysis

    Changed File Tier Has Tests? Test File
    src/lib/ac-linter.ts Standard ✅ Yes src/lib/ac-linter.test.ts (42 tests, +3 new)

    Coverage: 1/1 changed source files have corresponding tests


    Anti-Pattern Detection

    No anti-patterns detected:

    • No any types added
    • No hardcoded secrets
    • No empty catch blocks
    • No N+1 query patterns
    • Regex changes use anchored \b word boundaries (no over-greedy matching)

    Risk Assessment

    • Likely failure mode: Em-dash (— U+2014) in non-AC contexts (e.g., numeric ranges) could split incorrectly, but the doc-noun gate prevents false-positive warnings since ranges don't contain note/comment/etc. in the title slice. En-dash (– U+2013) and ASCII hyphens are intentionally NOT included per AC text.
    • Not tested: The Risks/Open-Questions sanity check (Implementation: trigger workflow) isn't a unit test, but it's not in ACs either. The order-of-separator behavior (which separator wins when multiple are present) isn't explicitly tested but is correctly handled by String.prototype.search returning the first match index.
    • Sibling sites considered: Only one occurrence of description.search(/[.\n:—]/) in src/; no cross-file siblings using the same separator-split + inflection-regex pattern.
    • Sibling-line audit: detectTitleBodyTension is the sole detector function in ac-linter.ts using this pattern; the regex-based DEFAULT_LINT_PATTERNS use a different approach (literal regex match) so no intra-file siblings share the root cause.

    Verdict: READY_FOR_MERGE

    All 5 ACs met literally. 42/42 tests pass. Build clean. All CI checks green. Three SKILL.md mirrors are byte-identical. CHANGELOG entry present. Implementation is small, focused, and well-tested with verbatim motivating-example fixtures.

    Documentation

    • CHANGELOG entry added under [Unreleased] / ### Fixed
    • All three SKILL.md mirrors updated (AC-5)
    • N/A — No README change needed (internal detector tightening)

    Next Steps

    1. Merge PR feat(#597): /spec ac-linter title/body tension — coverage tightening #600 when convenient.
    2. Optional follow-up: consider the Implementation: Risks-section edge case as a potential future tightening (not blocking).
  6. added
    ready-for-review
    and removed
    planned
    on May 8, 2026
  7. added 2 commits that reference this issue on May 8, 2026
  8. added 2 commits that reference this issue on May 9, 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

    enhancementready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions