Skip to content

feat(qa): mutation-verification becomes a parseable §7 gate instead of honor-system prose #939

Closed

Description

@admarble

Motivation

CLAUDE.md already mandates: "Gate tests ship with a recorded mutation result... delete the thing it asserts, confirm exactly that test fails, restore, and record the result in the commit message or PR body" (added after #830, where deleting an injection fixture's payload left the suite green). But the rule is honor-system prose — nothing parses or checks the recorded result, so compliance is invisible and unenforceable. This is the exact defect class #834 fixed for the qa skill's own §7 gates: "§2h was prose only, and therefore unenforceable, from the day it shipped."

The transcript audit (28 gap-prompt episodes, 2026-07-14 → 08-10) shows tests-that-don't-bind as the single largest deterministic-catchable defect class: #842 (test "cannot fail under any condition — zero regression value"; AC downgraded MET → PARTIALLY_MET), #883 ("the guard fired" as env-coupled proxy), #799 (test regex-matched the symptom it should reject), plus #467 (zero assertions) from the earlier corpus. A test observed to fail when its target is removed is evidence; one that hasn't is a claim. The red-phase discipline is the load-bearing part of TDD for agent workflows — and it is checkable.

Proposal

Promote the mutation-verification record from prose to a parseable PR-body marker checked by a /qa §7 gate.

Marker format (PR body, one line per verified test):

Mutation-verified: AC-3 — removed `payload` fixture block; `injection.test.ts > rejects payload` failed; restored.

Machine-anchored form alongside the prose (same durable-marker idiom as SEQUANT_SPEC):

<!-- SEQUANT_MUTATION: {"ac":"AC-3","mutation":"removed payload fixture block","failedTest":"injection.test.ts > rejects payload"} -->

Gate (/qa §7, new status mutation_verification_status):

  • Applies to ACs that are (a) gate tests per the CLAUDE.md definition (file-reading/section-presence/flag-wiring assertions), or (b) ACs with a declared test-command Evidence: clause once the Evidence-field issue lands.
  • Missing (in-scope AC with no marker) caps the verdict at AC_MET_BUT_NOT_A_PLUS — advisory-shaped statuses that never touch the verdict have a 0% action rate (investigate(metrics): gap-check signal-to-noise — does flagged → action rate justify cumulative QA prompt cost? #608), so this gate must enter the verdict algorithm to exist.
  • Marker present but naming a test that doesn't exist in the diff → Failed, floors to AC_NOT_MET (a fabricated marker is worse than a missing one).

Reachability: the gate is added to the §7 status collection list AND to scripts/lint-skill-gates coverage so it cannot ship unwired (the #834 lesson, mechanically enforced).

Non-Goals

  • No automated mutation-testing framework (Stryker etc.) — the record is of a manual red-phase check the implementer already performed; automation is a separate, much larger investigation.
  • No requirement on ACs whose evidence is manual/human review.
  • No retroactive enforcement on merged PRs.

Tailored caveats

  • The skill guidance for performing the mutation must carry the two standing safety rules: commit before mutating (git checkout <file> to revert a mutation wipes uncommitted edits), and never mutate a variable a finally block passes to rmSync (fix(test): cli.integration flag-surface tests assert on the not-initialized guard, so they fail on any locally init'd clone #883 deleted a worktree this way). Both belong in the marker how-to section.
  • Scope file-reading gate tests to the delimited region they check (whole-file matches let a doc header satisfy the assertion — the CLAUDE.md rule's second half; the gate should spot-check this in review guidance, not regex-enforce it).
  • Marker parsing in TS, single flat-JSON line (nested-JSON breaks the \{[^}]+\} regex family).
  • Skill edits sync three dirs.

Acceptance Criteria

  • AC-1: /qa §7 collects mutation_verification_status from SEQUANT_MUTATION markers in the PR body, with statuses Verified / Missing / Failed / Not-Applicable. Evidence: skill gate test scoped to the §7 collection list, mutation-verified per this issue's own rule.
  • AC-2: Missing caps the verdict at AC_MET_BUT_NOT_A_PLUS and Failed floors to AC_NOT_MET in the verdict algorithm. Evidence: scoped gate test on the verdict-algorithm block asserting both branches, mutation-verified.
  • AC-3: A TS parseMutationMarkers(prBody) exists and rejects markers naming tests absent from the diff's test files. Evidence: unit tests with valid, absent-test, and malformed-JSON markers.
  • AC-4: scripts/lint-skill-gates covers the new gate so it cannot regress to unreachable. Evidence: lint test fails when the §7 entry is deleted (mutation-verified).
  • AC-5: Measurement before enforcement breadth is widened — backtest the gate definition against the last 20 merged PRs and record in the PR body how many would have been Missing, to size the authoring burden honestly. Evidence: counts and method in the PR body.
  • AC-6: CLAUDE.md's testing section is updated to point at the marker format as the required record form. Evidence: doc diff in the PR.

Human decisions required

  • Scope call after AC-5's backtest: gate-tests-only first, or include all declared-test-Evidence ACs from day one?

Context

From the 2026-08-13 strategy review (TDD-shape assessment: red-phase observability is the adoptable core; full test-first is the wrong shape for same-author agent workflows). Extends the #830/#834 family. Complements the Evidence: field issue (declared evidence gives this gate its widest scope) and the structured gap schema (test_gap findings cite missing mutation records as evidence).

Activity

  1. admarble commented on Aug 13, 2026

    @admarble
    ContributorAuthor

    Plan Complete

    AC Checklist

    • AC-1: /qa §7 collects mutation_verification_status from SEQUANT_MUTATION markers, statuses Verified/Missing/Failed/Not-Applicable
    • AC-2: Missing caps at AC_MET_BUT_NOT_A_PLUS, Failed floors to AC_NOT_MET
    • AC-3: parseMutationMarkers(prBody) exists, rejects markers naming absent tests
    • AC-4: scripts/lint-skill-gates covers the new gate (dogfooded via this PR's own mutation-verified record)
    • AC-5: Backtest against last 20 merged PRs, counts recorded in PR body
    • AC-6: CLAUDE.md testing section points at the marker format

    Implementation Plan

    1. src/lib/workflow/mutation-marker.ts — parseMutationMarkers + classifyMutationMarker, flat-JSON idiom mirroring spec-recommendation.ts
    2. isGateTestEvidence keyword heuristic (gate-test classification for §6i applicability)
    3. Wire /qa §6i (Purpose/When/How/Status/Output) + full §7 4-point wiring, across all 3 skill-mirror dirs
    4. Dedicated skill-content test (mutation-verification-skill.test.ts) + confirm lint-skill-gates.ts catches an unwired §6i for free (I1–I4)
    5. Dogfood: delete §7 wiring, confirm lint fails, restore, record as this PR's own mutation-verified evidence
    6. Backtest last 20 merged PRs; update CLAUDE.md

    Key Decisions

    • Marker re-parsed from PR body fresh each /qa pass (no state.json persistence) — matches SEQUANT_SPEC/SEQUANT_PHASE precedent
    • Failed hard-floors (AC_NOT_MET); Missing soft-caps (AC_MET_BUT_NOT_A_PLUS) — matches the issue's explicit wording and §6h's severity precedent
    • Recommending testgen phase despite the mechanical detector saying skip (see Recommended Workflow reasoning)

    Open Questions

    1. Gate-test-only vs. all declared-evidence ACs for v1 scope — recommend gate-test-only, widen after AC-5 backtest (issue flags this as a human decision)
    2. parseMutationMarkers diff-awareness — recommend a separate classifyMutationMarker(marker, diffTestFiles) pass

    Ready to implement.

  2. added
    planned
    on Aug 13, 2026
  3. admarble commented on Aug 13, 2026

    @admarble
    ContributorAuthor

    Test Stubs Generated

    AC Verification Happy Path Failure Paths
    AC-1 Integration 2 tests -
    AC-2 Integration 2 tests 1 error case
    AC-3 Unit Test 2 tests 4 error cases
    AC-4 Integration 2 tests 1 assumption validator (dogfooded mutation check)
    AC-5 Manual Test 1 checklist 3 failure checks
    AC-6 Manual Test 1 checklist 2 failure checks

    Counts explained:

    • Happy Path: Number of positive/success test stubs or scenarios
    • Failure Paths: Number of error handling, edge case, and negative test stubs

    Unit Test Stubs

    • src/lib/workflow/mutation-marker.test.ts (AC-3)
      • Happy path: 2 test cases (parse a valid marker; parse multiple markers in one PR body)
      • Error handling: 4 failure stubs (reject marker naming a test absent from the diff; skip malformed JSON without throwing; ignore a marker inside a fenced code block; later duplicate marker for the same AC wins)

    Integration Test Stubs

    • src/lib/__tests__/mutation-verification-skill.test.ts (AC-1, AC-2, AC-4 — mirrors evidence-clause-skill.test.ts's pattern for §6h)
      • AC-1: 2 test cases (§6i section declares the four statuses; §7 step 2 declares mutation_verification_status attributed to Section 6i)
      • AC-2: 2 test cases (Failed → AC_NOT_MET branch; Missing → AC_MET_BUT_NOT_A_PLUS branch) + 1 error scenario (Failed cannot resolve to READY_FOR_MERGE)
      • AC-4: 2 test cases (lint-skill-gates.ts reports zero violations against the wired skill; §6i present in both-mode checklists/templates) + 1 assumption validator documenting the required manual mutation-verification step (delete §7 wiring → confirm lint fails → restore → record as this PR's own Mutation-verified: evidence)

    Manual Test Checklists

    AC-5 — Backtest against last 20 merged PRs

    ## Manual Test Checklist for AC-5
    
    ### Prerequisites
    - [ ] Gate-test population definition finalized (Open Question 1 from /spec)
    - [ ] `gh` CLI authenticated with read access to the repo's merged PRs
    
    ### Test Steps
    1. **Setup:** `gh pr list --state merged --limit 20 --json number,body,files`
    2. **Action:** Apply the in-scope-AC definition to each PR's declared ACs (via its `/spec` comment or `.sequant/state.json` history) and count how many would be `Missing` under the new gate
    3. **Verify:** Record the method used and the resulting counts in this PR's body
    
    ### Expected Results
    - [ ] Count of in-scope ACs across the 20 PRs is recorded
    - [ ] Count of `Missing` (expected: all of them, since none predate this feature) is recorded
    - [ ] Method (population definition + how "in-scope" was determined) is documented in the PR body
    
    ### Notes
    - 100% Missing is the expected finding — the number that sizes the authoring burden is the *count of in-scope ACs*, not the Missing rate

    AC-6 — CLAUDE.md testing section update

    ## Manual Test Checklist for AC-6
    
    ### Prerequisites
    - [ ] §6i marker format finalized (`Mutation-verified:` prose line + `SEQUANT_MUTATION` HTML-comment marker)
    
    ### Test Steps
    1. **Setup:** Open `CLAUDE.md`'s `## Testing` section
    2. **Action:** Update the single bullet to name the marker format as the required record form, keeping the existing #830 rationale sentence
    3. **Verify:** Read the diff and confirm the new format is named explicitly (not just "commit message or PR body" prose)
    
    ### Expected Results
    - [ ] Diff is a single-bullet edit, no unrelated CLAUDE.md content touched
    - [ ] New wording names both the prose (`Mutation-verified: AC-N — ...`) and machine-anchored (`<!-- SEQUANT_MUTATION: {...} -->`) forms
    
    ### Edge Cases
    - [ ] Existing #830 rationale sentence is preserved, not dropped

    Next steps:

    1. Implement the test stubs (replace throw new Error(...) with actual test logic)
    2. Run /exec 939 to implement the feature
    3. Verify tests pass with npm test

    Generated with Claude Code

  4. admarble commented on Aug 13, 2026

    @admarble
    ContributorAuthor

    Exec Complete

    AC Coverage: 6/6 original + 1/1 derived — all Implemented (see PR's Pre-PR AC Verification table)

    Key files changed:

    • src/lib/workflow/mutation-marker.ts (+ test) — parseMutationMarkers/classifyMutationMarker
    • src/lib/ac-parser.ts (+ test additions) — isGateTestEvidence
    • .claude/skills/qa/SKILL.md (+ skills/, templates/skills/ mirrors) — new §6i, wired into §7
    • src/lib/__tests__/mutation-verification-skill.test.ts — dedicated skill-content pinning test
    • scripts/qa/backtest-mutation-gate.ts (+ test) — AC-5 backtest
    • CLAUDE.md, CHANGELOG.md

    Checks: npm run build ✅ · npm run lint ✅ · npm test ✅ (266 files, 5459 passed, 1 expected fail, 2 skipped) · npx tsx scripts/lint-skill-gates.ts ✅ 0 violations · npx tsx scripts/check-skill-sync.ts ✅ 44 synced, 0 diverged

    Mutation-verified (AC-4): deleted §7's mutation_verification_status wiring, confirmed both lint-skill-gates.ts and the dedicated vitest file fail; restored, suite green. Full record in the PR body.

    Backtest (AC-5): last 20 merged PRs, 7 in-scope gate-test ACs across 3 PRs with a parseable AC table, 100% Missing (expected — pre-dates this feature). Full numbers in the PR body.

    Notable finding during implementation: the first wiring pass used prose ("floors the verdict at") that didn't match lint-skill-gates.ts's exact phrase list, so the generic structural check silently never evaluated the new §6i section. Caught only by actually running the required dogfood mutation test rather than trusting the "no violations" output at face value — fixed and re-verified.

    PR: #949

    Next steps: /qa review.

  5. admarble commented on Aug 13, 2026

    @admarble
    ContributorAuthor

    Execution Verification

    Command: npx tsx scripts/qa/backtest-mutation-gate.ts --limit 20
    Result: Verified — automated confirmation (exit 0, deterministic output matching the count previously reported in the PR body's AC-5 backtest section)

    Execution Output (click to expand)

    Exit code: 0
    Duration: 2s

    ## AC-5 backtest — mutation-verification gate, last N merged PRs
    
    Method: fetched the last 20 merged PRs, extracted each PR's `## Pre-PR AC Verification` table, applied `isGateTestEvidence` to the Evidence column to identify gate-test ACs, and checked for a `SEQUANT_MUTATION` marker naming that AC.
    
    | Metric | Value |
    |--------|-------|
    | PRs scanned | 20 |
    | PRs with a Pre-PR AC Verification table | 3 |
    | Total AC rows found | 18 |
    | In-scope (gate-test) ACs | 7 |
    | Missing (no SEQUANT_MUTATION marker) | 7 |
    | Missing rate among in-scope ACs | 100% |
    
    100% Missing is the expected finding — none of these PRs predate this feature. The authoring-burden signal is the **in-scope AC count**: 7 gate-test AC(s) across 20 PRs.
    
    | PR | In-scope ACs | Missing |
    |----|--------------|---------|
    | #945 | 6 | 6 |
    | #913 | 1 | 1 |
    

    Confirmation:

    Output is correct and matches expectations: real gh data, deterministic re-run producing identical counts to the PR body's AC-5 section, exit 0, no errors. This satisfies §11's execution-evidence requirement for scripts/qa/backtest-mutation-gate.ts.


    Verified by /verify command

  6. admarble commented on Aug 13, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #939

    Precheck Findings

    Precheck Findings: unavailable — inline fallback used.

    CI Status

    No CI checks reported yet on PR #949 (gh pr checks 949 returns "no checks reported"). No CI-related AC items in this issue's checklist.

    AC Coverage

    AC Source Description Status Notes
    AC-1 Original /qa §7 collects mutation_verification_status from SEQUANT_MUTATION markers, statuses Verified/Missing/Failed/Not-Applicable MET Confirmed literally: §6i lists all four statuses; §7 step 2 declares mutation_verification_status = status from Section 6i (Verified/Missing/Failed/Not-Applicable). Dedicated test + mutation-verified (see below)
    AC-2 Original Missing caps at AC_MET_BUT_NOT_A_PLUS, Failed floors to AC_NOT_MET MET Both branches present, correctly ordered (Failed among hard floors, Missing among soft floors), mutation-verified
    AC-3 Original parseMutationMarkers(prBody) exists and rejects markers naming tests absent from the diff's test files MET, with a literal-text note parseMutationMarkers itself only parses — it does not take a diff-test-file list and does not reject anything. Rejection is a paired export, classifyMutationMarker(marker, diffTestFiles). This was a deliberate split, flagged proactively in the /spec plan's Open Question 2 with its own impact analysis, not a silently discovered gap. The underlying requirement (a TS mechanism that rejects a marker naming a test absent from the diff) is fully implemented and tested across both functions together (11 tests in mutation-marker.test.ts). Verified live against the real PR #949 body — see Execution Verification below
    AC-4 Original scripts/lint-skill-gates covers the new gate so it cannot regress to unreachable MET Dogfooded per this issue's own rule — see Mutation Verification section below
    AC-5 Original Backtest against last 20 merged PRs, counts recorded in PR body MET Executed via /verify, real gh data, deterministic re-run matched the PR body's numbers exactly (7 in-scope ACs, 3/20 PRs had a parseable table)
    AC-6 Original CLAUDE.md's testing section points at the marker format MET Read the diff directly — single-bullet edit, names both the Mutation-verified: prose form and the SEQUANT_MUTATION machine-anchored form, preserves the #830 rationale sentence
    Derived
    AC-7 Derived (Feature Quality Planning) isGateTestEvidence heuristic has unit tests covering true-positive and true-negative real evidence text MET ac-parser.test.ts — true positives quote this issue's own AC-1/AC-4 evidence text verbatim; true negatives quote AC-3/AC-5's prose evidence text verbatim

    Coverage: 7/7 AC items fully met (includes 1 derived AC)
    Original ACs: 6/6 met
    Derived ACs: 1/1 met


    Quality Plan Verification

    Quality Plan found: Yes (from /spec's Feature Quality Planning section)

    Dimension Items Planned Items Addressed Status
    Derived AC (AC-7) 1 1 ✅ Complete

    Derived ACs: 1/1 addressed
    Quality Plan Status: Complete


    Quality Metrics

    Metric Value Status
    Type issues (any) 0 OK
    Deleted tests 0 OK
    Files changed 12 OK (2 new modules + paired tests + 3-way skill mirror + docs)
    Lines added +1109 -
    Lines deleted -4 -

    Build Verification

    N/A — build passed (npm run build clean, no TypeScript errors).

    Test Coverage Analysis

    Changed File Tier Has Tests? Test File
    src/lib/workflow/mutation-marker.ts Standard ✅ Yes src/lib/workflow/mutation-marker.test.ts
    src/lib/ac-parser.ts Standard ✅ Yes src/lib/ac-parser.test.ts
    scripts/qa/backtest-mutation-gate.ts Standard ✅ Yes scripts/qa/backtest-mutation-gate.test.ts
    .claude/skills/qa/SKILL.md (+ mirrors) Standard ✅ Yes src/lib/__tests__/mutation-verification-skill.test.ts
    CLAUDE.md, CHANGELOG.md Optional - Docs, no code path

    Coverage: 4/4 changed source modules have corresponding tests. No critical-path (auth/payment/security/middleware/admin) files touched.


    Code Review

    Strengths:

    • Follows the established SEQUANT_SPEC/SEQUANT_PHASE flat-JSON marker idiom precisely, including the stripMarkdownCode() fence-safety reuse — no reinvention.
    • §6i's §7 wiring replicates §6h's exact 4-touchpoint shape (step-2 token, step-4 branch, both-mode checklist, both-mode template), which is what keeps lint-skill-gates.ts's I1–I4 invariants passing.
    • Genuinely dogfooded: the feature was applied to its own PR live during this QA pass (see Execution Verification), and the mutation-verification dogfood for AC-4 caught two real bugs during implementation (a floor-phrase wording mismatch that silently defeated the generic lint check, and a 3-way skill-mirror divergence from an interrupted restore) — both fixed and documented transparently in the PR body rather than hidden.
    • isGateTestEvidence's true-positive/true-negative unit tests use this issue's own real AC evidence text verbatim, not synthetic fixtures — satisfies the derived AC's intent precisely.

    Issues:

    • AC-3's literal text names a single function (parseMutationMarkers) as the thing that "rejects" bad markers; the implementation splits parsing and rejection across two functions. Flagged above — not blocking, but worth a maintainer's explicit sign-off since it's a plan-vs-ship divergence, however well-justified.
    • isGateTestEvidence is a keyword heuristic (fixture/section/flag/wired/exists/present/registered/mutation-verified/mutation test) that could, in principle, misclassify a human-review-only AC whose evidence text happens to use one of these words (e.g. "reviewed manually, fixture exists in the demo env"). Not observed in the real backtest (7/18 rows in-scope, all genuinely gate-test-shaped), but it's a known false-positive surface, already named in the PR's own Pre-PR Confidence Check.

    Suggestions:

    • Consider renaming parseMutationMarkers in a follow-up to parseMutationMarkersRaw or similar if the split becomes a recurring point of confusion, or fold classifyMutationMarker calls into a single parseAndClassifyMutationMarkers(prBody, diffTestFiles) convenience wrapper — not required now, /spec already flagged and accepted the current shape.

    Test Quality Review

    Category Status Notes
    Behavior vs Implementation ✅ OK Tests assert on parsed/classified output, not internals
    Coverage Depth ✅ OK Error paths covered: malformed JSON, missing field, fenced-code false-positive, absent-test rejection, latest-wins
    Mock Hygiene ✅ OK No mocking — pure functions tested with real string/object inputs; skill-content test reads the real file
    Test Reliability ✅ OK No timing dependencies, deterministic string/regex assertions

    Issues Found: None.


    Anti-Pattern Detection

    Dependency Audit: N/A — no package.json changes.

    Code Patterns: Reviewed by sub-agent (type-safety/deleted-tests, scope/size, security) — see Quality Checks below. No hardcoded secrets, no injection risk, no unsafe eval/innerHTML, no N+1 patterns, no uncleared timers.

    Critical Issues: 0
    Warnings: 0

    Quality Checks (sub-agent results)

    Check Status Notes
    Type safety ✅ Pass 0 any/as any occurrences in added lines
    Deleted tests ✅ Pass 0 deleted test files (all test changes are additions)
    Scope/size ✅ Pass 1109/-4 justified by paired tests (117/117 for the marker module) and the mandatory 3-way skill mirror; no unrelated files
    Security ✅ Pass execFileSync uses array-form argv (no shell injection); JSON.parse on PR-body text is try/catch-wrapped and Zod-validated before trust; no eval/DOM sinks/hardcoded secrets

    Call-Site Review

    New exported functions detected: 8 (parseMutationMarkers, latestMutationMarkerPerAc, classifyMutationMarker, isGateTestEvidence, fetchMergedPrs, extractAcTableRows, backtest, formatReport)

    None are called from other production TS modules by direct import — by design, consumed via ad-hoc npx tsx -e snippets embedded in /qa §6i's skill prose (the same integration pattern §6h's resolveVerificationMethod/ac-parser.ts exports use) and via backtest-mutation-gate.ts's own CLI direct-run block. This is not a dead-export smell — verified live during this QA pass: both §6i "How to perform" commands were executed against real data (issue #939's own AC state, PR #949's own body) and produced correct results, including correctly identifying AC-1/AC-2/AC-4 as the gate-test ACs and correctly classifying all three markers as valid.

    Findings: None. Recommendations: None.


    Execution Verification

    Posted separately via /verify — see issue comment. Command: npx tsx scripts/qa/backtest-mutation-gate.ts --limit 20, exit 0, output matches the PR body's AC-5 numbers exactly.

    Additionally, during this QA pass, both §6i skill commands were executed live:

    1. Gate-test AC identification against issue feat(qa): mutation-verification becomes a parseable §7 gate instead of honor-system prose #939's real stored AC state (after populating it via the actual StateManager.initializeIssue/updateAcceptanceCriteria flow, which /spec had skipped in favor of inline analysis) — correctly returned exactly AC-1, AC-2, AC-4.
    2. Marker parsing/classification against PR feat(#939): mutation-verification becomes a parseable /qa §6i gate #949's own real body — correctly parsed and validated all 3 markers, demonstrating mutation_verification_status resolves to Verified for this very PR once all three in-scope ACs' markers were added.

    Skill Command Verification

    Skill files changed: 3 (.claude/skills/qa/SKILL.md, skills/qa/SKILL.md, templates/skills/qa/SKILL.md — identical content, confirmed via check-skill-sync.ts)

    File Commands Found Verification Status
    .claude/skills/qa/SKILL.md 2 (§6i's two npx tsx -e blocks) ✅ Passed

    Commands Verified:

    • Gate-test AC identification (StateManager.getAcceptanceCriteria + isGateTestEvidence filter) → ✅ executed, correct output
    • Marker parsing/classification (parseMutationMarkers/latestMutationMarkerPerAc/classifyMutationMarker) → ✅ executed, correct output

    Verification Status: Passed


    Detection Pattern Verification

    Skill markdown files with pattern changes: 3 (mirrors) — one new grep -E '\.(test|spec)\.' usage inside §6i's "How to perform" block, filtering test files from a diff listing.

    Pattern Corpus Samples Expected Actual Status
    `grep -E '.(test spec).'` this PR's own diff test files + repo-wide git ls-files sample 12 (4 from this diff + 8 repo-wide) match all real test files, exclude non-test files 12/12 correct, 5/5 non-test files correctly excluded

    Note: this is the exact same regex already shipped and in production use elsewhere in the same file (§2b/2c's pre-existing "deleted tests" check, grep -cE '\.(test|spec)\.', line 1183, unmodified by this PR) — a reused, already-proven pattern applied to a new purpose (filtering, not counting deletions), not a novel unverified one.

    Motivating-example fixtures from issue body: N/A — the issue's own marker-format example (Marker format section) was used directly as the basis for MutationMarkerSchema's shape and verified live against PR #949's real body (see Execution Verification); no separate grep/awk/jq fixture is implicated by that example.

    Verification Status: Passed


    CLI Registration Verification

    N/A — no option interfaces (RunOptions, bin/cli.ts) modified.


    Behavior-Rule Survival Check

    AC Triggered? Survivors Status
    AC-1 through AC-7 No — N/A

    Status: N/A — no AC triggers the behavior-rule heuristic (confirmed via detectBehaviorRule run against all 6 original AC texts).


    Declared-Evidence Execution

    Status: N/A — none of this issue's 6 ACs declare evidence naming a backtick-quoted runnable command (all Evidence: clauses are descriptive prose, e.g. "unit tests with valid, absent-test, and malformed-JSON markers." — confirmed via resolveVerificationMethod, all 6 resolve to manual).


    Mutation Verification

    AC Gate Test? Marker Status
    AC-1 Yes mutation-verification-skill.test.ts > §7 step 2 declares mutation_verification_status attributed to Section 6i Verified
    AC-2 Yes mutation-verification-skill.test.ts > §7 step 4 floors 'Failed' at AC_NOT_MET (+ the 'Missing' branch test, same mutation) Verified
    AC-3 No — N/A
    AC-4 Yes mutation-verification-skill.test.ts > §7 step 2 declares mutation_verification_status attributed to Section 6i Verified
    AC-5 No — N/A
    AC-6 No — N/A

    Status: Verified — applying the feature to its own PR (live, during this QA pass), mutation_verification_status resolves to Verified, not Missing. All three in-scope gate-test ACs (AC-1, AC-2, AC-4) have SEQUANT_MUTATION markers whose named tests are present in this diff, confirmed by actually running parseMutationMarkers/classifyMutationMarker against PR #949's real body. The dogfood mutation (documented in the PR body) genuinely breaks and restores all three, so recording separate markers per-AC (rather than only AC-4's) was correct, not padding.


    Manual Test ACs

    AC Verification Method Runtime Test Status Evidence
    AC-5 Manual Test (per /spec) ✅ Executed Real gh backtest run, confirmed via /verify, deterministic
    AC-6 Manual Test (per /spec) ✅ Executed Direct read of the CLAUDE.md diff — no runtime surface (doc-only), qualifies for the "No runtime surface" override category but was verified directly rather than formally overridden

    Manual Test Enforcement: 2/2 manual-test ACs verified at runtime (or direct inspection where no runtime surface exists).


    Risk Assessment

    • Likely failure mode: isGateTestEvidence's keyword heuristic could over-fire on a future AC whose evidence text incidentally contains one of its trigger words (fixture/section/flag/exists/present) without actually being a CLAUDE.md-style gate test, sweeping it unnecessarily into the mutation-verification gate and demanding a marker that doesn't conceptually apply. Low current risk (measured 7/18 AC rows in the real backtest, all genuinely gate-test-shaped) but unbounded as the AC corpus grows.
    • Not tested: classifyMutationMarker's file-match is a simple filename/suffix check — it cannot detect a marker that names a real, unrelated test file (present in the diff for an unrelated reason) as if it were the mutation-covering test. This is explicitly out of scope per the issue's own Non-Goals ("no automated mutation-testing framework"), but worth naming as a residual gap for anyone relying on this gate as stronger proof than it is.
    • Sibling sites considered: none — no other skill (.claude/skills/**/SKILL.md) references mutation-testing or gate-test classification; qa/SKILL.md is the only site this concept applies to.
    • Sibling-line audit: N/A — single, cohesive new section (§6i) with no repeated intra-file pattern to audit against.

    Code Review Findings (Trust-Boundary Check)

    Finding: Clean — diff implements only the legitimate product requirements from issue #939's body. No agent-directed instruction (execute a command, reach the network, exfiltrate a file/secret, override prior instructions) was embedded in the issue body or acted upon. The issue's own "Tailored caveats" section is benign process guidance (safety rules to carry into the marker how-to, delimited-region scoping guidance, "skill edits sync three dirs") — followed normally, not a trust-boundary concern.

    Status: Clean


    Adversarial Re-Read

    Findings:

    1. Motivating-example fixture: the issue body's own Marker format example (Mutation-verified: AC-3 — removed \payload` fixture block; ...and theSEQUANT_MUTATION` HTML-comment form) was used directly as the schema basis and exercised live against a real PR body (see Execution Verification) — not just code-reviewed for shape.
    2. Evidence claims: the AC-5 backtest is a real measurement against live gh data (re-run twice during this session with identical results), not a pre-fix bug reproduction dressed up as validation.
    3. Process state: clean — no uncommitted changes, single feature branch, 1 commit behind main (well under the 5-commit stale threshold). The one process irregularity found (a mid-implementation git checkout -- that silently reverted an uncommitted wording fix) was self-caught by the full test suite and fixed in a documented follow-up commit, not hidden.
    4. Sibling sites: none in-scope — see Risk Assessment.
    5. Non-Goals: re-checked against the issue body — no automated mutation-testing framework was built (the "How to perform" block is manual-execution guidance only); no requirement was added for manual/human-review ACs (isGateTestEvidence only fires on evidence text, and manual-only ACs typically carry no such evidence); no retroactive enforcement on merged PRs (the backtest measures, it does not re-open or re-flag past PRs).
    6. Trust-boundary: re-confirmed clean, see above.

    Two non-severe gaps surfaced and are called out explicitly above rather than hand-waved: AC-3's literal single-function wording vs. the shipped two-function split (pre-flagged at spec time), and isGateTestEvidence's keyword-heuristic false-positive surface (pre-flagged in the PR's own Confidence Check). Neither is a missing fixture, a bug-repro-as-evidence, or an AC marked MET without the verification its text required — all six original ACs got real, executed evidence.

    Status: Gaps Found


    CHANGELOG Verification

    Check Status
    CHANGELOG.md exists ✅ Found
    User-facing changes ✅ Yes (feat commits detected)
    [Unreleased] entry ✅ Present
    Entry format ✅ Valid (action verb, issue number (#939))

    Result: CHANGELOG requirements met


    Verdict: AC_MET_BUT_NOT_A_PLUS

    All 7 ACs (6 original + 1 derived) are MET, all quality gates pass (build, lint, full test suite, lint-skill-gates.ts, check-skill-sync.ts), the feature was genuinely dogfooded end-to-end against its own PR, and both real gaps found during implementation (floor-phrase wording, mirror divergence) were self-caught and fixed rather than shipped silently. The verdict is capped below READY_FOR_MERGE solely by the Adversarial Re-Read's Gaps Found status: AC-3's shipped implementation literally splits across two functions where the AC text names one, and isGateTestEvidence carries an acknowledged keyword-heuristic false-positive surface. Both are minor, both were self-flagged during development (not discovered adversarially for the first time here), and neither blocks merge — but a human maintainer should explicitly sign off on the AC-3 interpretation before this is treated as A+.

    Documentation

    • README/docs — N/A, no user-facing README surface (internal /qa skill behavior + library exports)
    • CHANGELOG entry added

    Next Steps

    1. Maintainer sign-off on AC-3's function-split interpretation (or request a rename/wrapper per the Suggestions above).
    2. Optional follow-up: widen isGateTestEvidence's corpus testing beyond this issue's own text once more real gate-test ACs accumulate (the backtest script is already reusable for this).
    3. Merge when satisfied — no code changes required to reach this verdict; the gaps are documentation/interpretation items, not defects.
  7. added
    needs-improvement
    on Aug 13, 2026
  8. admarble commented on Aug 13, 2026

    @admarble
    ContributorAuthor

    /fullsolve Complete

    Issue: #939
    Status: AC_MET_BUT_NOT_A_PLUS

    Summary

    Promoted CLAUDE.md's honor-system mutation-verification rule to a parseable /qa §6i gate: SEQUANT_MUTATION PR-body markers, parsed by parseMutationMarkers/classifyMutationMarker, wired into the §7 verdict algorithm (Missing caps AC_MET_BUT_NOT_A_PLUS, Failed floors AC_NOT_MET). Gate-test AC classification via isGateTestEvidence. Backtested against the last 20 merged PRs (7 in-scope gate-test ACs). The feature was applied live to its own PR during QA and correctly resolved to Verified once all three in-scope ACs (AC-1, AC-2, AC-4) got their markers.

    • AC: 7/7 met (6 original + 1 derived)
    • Tests: 266 files, 5459 passed, 1 expected fail (pre-existing), 2 skipped
    • QA: AC_MET_BUT_NOT_A_PLUS — two self-flagged, non-blocking gaps (AC-3's function-split vs. its literal wording; isGateTestEvidence's keyword-heuristic false-positive surface), both documented in the QA comment and PR body rather than hidden

    Iterations

    • Spec: 1 (Standard tier, 6 ACs)
    • Testgen: 1
    • Exec: 1 (caught and fixed 2 real bugs during implementation — a lint-skill-gates.ts floor-phrase wording mismatch that silently defeated its own structural check, and a 3-way skill-mirror divergence from an interrupted git checkout -- restore)
    • QA loop: 0 (first-pass AC_MET_BUT_NOT_A_PLUS, not looped per the "good enough, proceed with notes" rule)
    • Post-QA: merged origin/main to resolve a real CHANGELOG.md conflict from a concurrent doc-prep commit; re-ran full suite green, re-pushed

    PR: #949

    Risk Assessment (from QA)

    • Likely failure mode: isGateTestEvidence's keyword heuristic could over-fire on a future AC whose evidence text incidentally contains a trigger word without being a genuine gate test. Low current risk (7/18 real backtest rows, all genuinely gate-test-shaped).
    • Not tested: classifyMutationMarker cannot detect a marker naming a real-but-unrelated test file as if it covered the claimed mutation — explicitly out of scope per the issue's own Non-Goals (no automated mutation-testing framework).

    Next Steps

    1. Maintainer sign-off on AC-3's function-split interpretation (parseMutationMarkers + classifyMutationMarker vs. the AC's single-function wording) — pre-flagged at spec time, not a surprise.
    2. Ready for human review and merge — no code changes required to reach this verdict.

    Ready for human review and merge.

  9. added a commit that references this issue on Aug 14, 2026
  10. admarble commented on Aug 14, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #939 (Re-review after gap fixes)

    Precheck Findings

    Precheck Findings: unavailable — inline fallback used.

    CI Status

    Check State Bucket Impact
    validate-skills SUCCESS pass ✅ MET
    build (22.x) SUCCESS pass ✅ MET
    Plugin Structure Validation SUCCESS pass ✅ MET
    node-floor-guard SUCCESS pass ✅ MET
    Hooks Validation SUCCESS pass ✅ MET
    Setup Directory Creation SUCCESS pass ✅ MET
    typecheck SUCCESS pass ✅ MET
    validate-plugin SUCCESS pass ✅ MET

    CI Summary: 8 passed, 0 pending, 0 failed. build (22.x) finished (SUCCESS) during this review — all gating checks now green.

    AC Coverage

    AC Source Description Status Notes
    AC-1 Original /qa §7 collects mutation_verification_status from SEQUANT_MUTATION markers MET Unchanged from initial review — confirmed still correct
    AC-2 Original Missing caps at AC_MET_BUT_NOT_A_PLUS, Failed floors to AC_NOT_MET MET Unchanged from initial review
    AC-3 Original parseMutationMarkers(prBody) exists and rejects markers naming tests absent from the diff's test files MET (gap closed) parseMutationMarkers now has a (prBody, diffTestFiles) overload that inlines the classification/rejection into the same function named in the AC. Verified: src/lib/workflow/mutation-marker.test.ts (4 new tests for the overload), and re-ran the updated §6i skill command live against PR #949's real body — correctly returned valid for all 3 markers
    AC-4 Original scripts/lint-skill-gates covers the new gate MET Unchanged, mutation-verified in the initial pass
    AC-5 Original Backtest against last 20 merged PRs MET Unchanged
    AC-6 Original CLAUDE.md's testing section points at the marker format MET Unchanged
    Derived
    AC-7 Derived isGateTestEvidence heuristic unit tests (true-positive/true-negative) MET (gap closed) Added MANUAL_REVIEW_NEGATIVE_SIGNALS short-circuit. Mutation-verified: removing the guard makes exactly the 2 new regression tests fail (ac-parser.test.ts), confirmed and restored (see PR body)

    Coverage: 7/7 AC items fully met (includes 1 derived AC)


    Quality Plan Verification

    Quality Plan found: Yes. Derived AC (AC-7): 1/1 addressed. Quality Plan Status: Complete (unchanged from initial review).


    Quality Metrics

    Metric Value Status
    Type issues (any) 0 OK
    Deleted tests 0 OK
    Files changed 12 OK
    Lines added +1230 -
    Lines deleted -4 -

    Test Coverage Analysis

    Changed File Has Tests? Test File
    src/lib/ac-parser.ts ✅ Yes src/lib/ac-parser.test.ts (+3 new tests for the negative-signal guard)
    src/lib/workflow/mutation-marker.ts ✅ Yes src/lib/workflow/mutation-marker.test.ts (+4 new tests for the overload)
    scripts/qa/backtest-mutation-gate.ts ✅ Yes scripts/qa/backtest-mutation-gate.test.ts
    .claude/skills/qa/SKILL.md (+ mirrors) ✅ Yes src/lib/__tests__/mutation-verification-skill.test.ts

    Coverage: 4/4 changed source modules have corresponding tests.


    Code Review

    Strengths:

    • Both fixes are surgical and match exactly what the initial QA asked for — no scope drift, no unrelated changes riding along.
    • The parseMutationMarkers overload is backward-compatible: the one-argument form is byte-identical in behavior (verified by the existing 11 pre-fix tests still passing unmodified), so no existing caller could regress.
    • The negative-signal guard is checked first and short-circuits, keeping the function's control flow easy to read; the phrase list is narrow and specific to the exact QA-named scenario rather than an overbroad "contains 'manual'" match that would risk new false negatives (e.g. it would not incorrectly suppress "npm test -- manual-approval.test.ts, fixture exists").
    • Both fixes were dogfood mutation-tested against the feature's own rule before being reported as done — genuinely practicing what this issue ships.

    Issues: None found in this re-review.

    Suggestions: None beyond what the initial review already noted (optional convenience-wrapper naming, not required).


    Anti-Pattern Detection

    Re-run via sub-agent against the full current diff (see Quality Checks below) — no new findings beyond the initial pass.

    Quality Checks (sub-agent results, re-run against full diff)

    Check Status Notes
    Type safety ✅ Pass 0 any/as any in added lines
    Deleted tests ✅ Pass 0 deleted test files
    Scope/size ✅ Pass Diff composition still reads as one cohesive feature; no unrelated files touched
    Security ✅ Pass Both new fixes reviewed specifically — MANUAL_REVIEW_NEGATIVE_SIGNALS is pure string matching, the parseMutationMarkers overload still validates via Zod before use, no new injection/eval/exfiltration surface

    Call-Site Review

    No new exported functions in this incremental fix beyond what the initial review already covered (parseMutationMarkers's signature changed via overload, not a new export). MANUAL_REVIEW_NEGATIVE_SIGNALS is a private, unexported constant. No findings.


    Execution Evidence

    scripts/qa/backtest-mutation-gate.ts unchanged by this fix — evidence from the initial /verify run still applies (re-running would produce identical output since neither fix touches that script).


    Skill Command Verification

    Skill files changed: 3 (mirrors, identical) — §6i's step-2 command updated to the new single-call form.

    Command Verification Status
    mm.parseMutationMarkers(prBody, diffTestFiles) (new single-call form) ✅ Passed — executed live against PR #949's real body during the initial fix pass, returned correct valid classifications for all 3 markers

    Verification Status: Passed


    Detection Pattern Verification

    No new grep/awk/jq/sed/regex-literal additions to skill markdown in this incremental fix (the step-2 command change replaces JS logic, not a shell pattern). N/A — no pattern changes in this delta.


    CLI Registration Verification

    N/A — no option interfaces modified.


    Behavior-Rule Survival Check

    N/A — re-confirmed no AC (including AC-3 and AC-7's updated evidence text) triggers the behavior-rule heuristic.


    Declared-Evidence Execution

    N/A — unchanged from initial review; no AC declares a backtick-quoted runnable command.


    Mutation Verification

    AC Gate Test? Marker Status
    AC-1 Yes present in PR body Verified
    AC-2 Yes present in PR body Verified
    AC-4 Yes present in PR body Verified
    AC-7 Yes (per isGateTestEvidence — "mutation-verified" keyword) present in PR body (SEQUANT_MUTATION: {"ac":"AC-7",...}) Verified

    Status: Verified — all 4 in-scope gate-test ACs (AC-1, AC-2, AC-4, and now AC-7 for the negative-signal guard fix) carry markers naming tests present in this diff. aggregate mutation_verification_status for this PR is Verified, not Missing.


    Manual Test ACs

    Unchanged from initial review: AC-5 and AC-6 both executed/directly verified. Not re-run since neither fix touches those ACs.


    Risk Assessment

    • Likely failure mode: unchanged from the initial review — isGateTestEvidence's remaining keyword-list nature (now with a negative-signal layer) can still miss an unanticipated phrasing on either side. This is narrower than before (the QA-named scenario is fixed), not eliminated as a class.
    • Not tested: unchanged — classifyMutationMarker's file-match doesn't verify semantic connection between the named test and the claimed mutation (explicit Non-Goal).
    • Sibling sites considered: none — no other file defines a similar keyword-classification function that would need the same negative-signal treatment.
    • Sibling-line audit: N/A — single, localized fix per file.

    Trust-Boundary Check

    Finding: Clean — this incremental fix is a direct, mechanical response to the prior QA comment's own findings (self-authored feedback, not external issue-body content), and touches only the two named functions plus their tests and skill docs. No agent-directed instruction from any external text was acted on.

    Status: Clean


    Adversarial Re-Read

    Findings:

    1. Both previously-named gaps were re-verified as actually closed, not just reworded: AC-3 by running the new overload live against a real PR body and confirming classifications; AC-7 by mutation-testing the negative-signal guard (deletion → 2 tests fail → restore → suite green).
    2. Checked the fix for new false-negative risk (a genuine gate test whose evidence text incidentally contains one of the 5 negative-signal phrases) — the phrase list is specific enough ("reviewed manually", "manual review", "human review", "manually verified", "manually confirmed") that this is unlikely in practice, and no such case appears in the 7-AC real backtest corpus.
    3. Process state: clean — one commit ahead only for the gap-fix work (a6e9caa8), 0 commits behind main, full suite re-verified green (266 files, 5466 passed) after the fixes, before pushing.
    4. No sibling sites apply to either fix.
    5. No Non-Goals affected — both fixes are corrections within the already-agreed scope, not new functionality.
    6. Trust-boundary re-confirmed clean.

    The only residual item — CI's build (22.x) still in progress — is an external/temporal condition, not a code gap, and is captured in CI Status above rather than here.

    Status: Clean


    CHANGELOG Verification

    Unchanged — [Unreleased] entry still present and covers the feature as a whole; the two follow-up fixes are corrections to already-described behavior, not separately changelog-worthy.

    Result: CHANGELOG requirements met


    Verdict: READY_FOR_MERGE

    Both gaps named in the prior QA review are genuinely fixed and mutation-verified: AC-3's implementation now literally matches its text (the named function itself rejects, via an overload), and AC-7's isGateTestEvidence no longer false-positives on the exact scenario QA identified. All 7 ACs are MET, code review is clean, security/type-safety/scope sub-agents all pass, the adversarial re-read found nothing new, and CI is fully green (8/8 checks passed, including build (22.x) which completed during this review).

    Documentation

    • N/A - no new user-facing documentation needed beyond the already-updated CLAUDE.md and CHANGELOG

    Next Steps

    1. Ready to merge.
  11. added
    ready-for-review
    and removed
    needs-improvement
    on Aug 14, 2026
  12. added a commit that references this issue on Aug 15, 2026
  13. added a commit that references this issue on Oct 26, 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

    plannedready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions