Repository navigation
Conversation
Add detection and enforcement for ACs marked with **Verification:** Manual Test in /spec plans. QA must now execute the runtime test, provide an approved override, or mark the AC PENDING (which forces NEEDS_VERIFICATION verdict via the existing pending_count path). - Detection: scans spec comments for Manual Test, try/confirm, verify by, test that patterns and maps them to AC IDs - Enforcement: manual-test ACs cannot be marked MET from static code review - Override: mirrors Section 11a format with 3 approved categories (no runtime surface, equivalent unit test, tested in sibling issue) - Verdict algorithm: step 3a wires into existing pending_count flow - Output: adds Manual Test ACs section to QA output template + checklist - Synced across .claude/skills/, skills/, templates/skills/ Closes #529
Closed
6 tasks
…ve AC extraction The manual-test detection bash snippet's jq filter used two broad contains() substring checks (`SEQUANT_PHASE` AND `spec`), which matched QA, exec, and spec comments indiscriminately — on issue #529 itself, the filter matched 5 comments and `.last` returned a QA re-verification comment instead of the spec plan, so AC extraction would run against the wrong body. Replace with a single literal match on `"phase":"spec"` so only the spec phase marker qualifies. Verified against issue #529: new filter matches exactly 1 comment (the spec plan). Also add `BEGIN{IGNORECASE=1}` to the AC-extraction awk so it matches the -iE case-insensitivity of the grep above it — prevents mixed-case spec text like "Try X, confirm Y" from being detected but silently failing at the AC-ID extraction step. Applied identically to .claude/skills/, skills/, and templates/skills/ copies of qa/SKILL.md.
Sampled 11 real /spec outputs from past issues. Header styles in use: - `### AC-N` → #540, #534, #529, #452, #451 - `#### AC-N` → #495, #490, #413, #393 - `**AC-N:**` → #363 The prior awk pattern `/^### AC-[0-9]+/` only matched 3-hash headers. On specs using #### or **AC-N:** styles, the grep correctly detected "Manual Test" but `ac` was never set, so AC-ID extraction returned empty — silent detection failure on ~45% of sampled specs. Broaden to `/^(#+ AC-[0-9]+|\*\*AC-[0-9]+)/` so any #-prefixed level and the bold `**AC-N**` form anchor the extraction. Verified live against issue #413's spec: new pattern correctly extracts AC-1, AC-2, AC-4 (the three Manual Test ACs); old pattern returned empty. Applied identically to all three qa/SKILL.md copies.
The motivating bug from issue #529 came from a spec that read: **Verify:** Try saving a Project without media, confirm validation error fires. Prior detection caught this specific example only because "try ..., confirm" also matched — but a spec like `**Verify:** Open /foo and inspect the banner` (no comma/confirm pattern) slipped through. Since `**Verify:**` as an AC prefix is itself a manual-verification indicator in practice (portfolio-2025 uses it verbatim), add it as a first-class alternation in both the grep detector and the awk AC-attribution pattern. Guarded against false positives: `**Verification:** Unit Test` and `**Verification:** Integration Test` do NOT match `\*\*Verify:\*\*` (different suffix after "Verif"). Confirmed with live test. Applied identically to all three qa/SKILL.md copies.
7 tasks
Merged
6 of 9 tasks
admarble
added a commit
that referenced
this pull request
May 4, 2026
… regex/grep/awk changes (#572) * feat(qa): add Section 6c detection-pattern verification for skill regex/grep/awk/jq/sed changes (#551) Adds a new /qa Section 6c "Detection Pattern Verification" that triggers when a PR adds or modifies grep/awk/jq/sed commands or regex literals inside skill markdown (.claude/skills/, templates/skills/, skills/). For each detected pattern, QA must: 1. Identify the intended corpus from surrounding skill prose 2. Sample ≥5 real instances from that corpus 3. Execute the pattern against each 4. Record match/no-match counts in an output table Snippets quoted in the issue body as motivating examples (blockquotes, fenced code blocks under non-Setup headings, **Verify:**/**Verbatim:**/**Example:**/ **AC verification:** prefixed lines) are treated as mandatory test fixtures. Verdict gate is stricter than Section 6a: Failed → AC_NOT_MET (silent detection failures are worse than wrong CLI flags because the pipeline reports success). The verdict algorithm and CRITICAL notes in Section 7 are updated accordingly. Adds the verbatim "Adversarial re-read of core logic — list anything the structured pipeline didn't surface" checkbox to both Simple Fix Mode and Standard QA Output Verification checklists. Synced byte-identically across all 3 skill directories. Closes the gap exposed by PR #547 / issue #529, where 3 silent regex/awk/jq detection bugs shipped through /qa because Section 6a only verified command syntax, not whether patterns matched their intended corpus. * fix(#551): /qa Section 6c calibration — unified detection regex, Insufficient Samples rung, gh api recipes Three calibration fixes surfaced by adversarial review of PR #572 before merge: 1. Unify Step 1 detection regex Old: \bgrep -[A-Za-z]+ | \bawk [\x27"] | \bjq [\x27"] | \bsed [\x27"] New: \b(grep|awk|jq|sed) [-\x27"] Old form required a flag after grep but a quote after awk/jq/sed, so it missed jq -r ".field", sed -n "...", awk -v VAR=val "..." — the most common modifier-flag forms in this codebase. Unified rule covers both shapes in one expression. Manual-review fallback prose updated to list the long-tail shapes (bare grep "x", non-anchored character classes). 2. Add Insufficient Samples status rung AC-2 mandates >=5 samples per pattern. Old status table had only Passed / Failed / Skipped / Not Required, so a reviewer with 3 matching samples would default to Passed and silently violate the threshold. New rung: - Step 5 status table + SPARSE-CORPUS RULE - Section 6c verdict gating table -> AC_MET_BUT_NOT_A_PLUS - Section 7 algorithm: ELSE IF detection_pattern_status == "Insufficient Samples" -> AC_MET_BUT_NOT_A_PLUS - detection_pattern_status value list updated - Step 3 warning escalated from advisory to actionable - Output template Verification Status enum updated 3. Replace gh search recipes with gh api gh search issues "SEQUANT_PHASE spec" relied on GitHub's full-text index covering HTML-comment markers, which is not reliable. gh search issues "assess:action" parsed ":" as a search qualifier and returned empty. Step 2 corpus table and Step 3 example now use: gh api "repos/{owner}/{repo}/issues/comments?per_page=100" --paginate -q '.[] | select(.body | contains("...")) | .body' which returns raw JSON regardless of search index coverage. Added a "Why gh api over gh search issues" rationale block. 3-dir sync verified by SHA-256 (94c7cc4cc19c0af89d1c3686cb9301f99fdf224adee2c6d7e43d7b6dcd8851c1). Self-application: new regex catches 42 pattern additions in this PR's diff and correctly rejects substring false positives (awkward, my_grep_call).
This was referenced May 9, 2026
admarble
added a commit
that referenced
this pull request
May 11, 2026
Gap 1 — §6c precondition greps diff hunks, not file content. The first cut of this section's precondition shelled out to `xargs grep -lE ...` against the *current* skill-md file content. All 19 sequant SKILL.md files mention `grep|awk|jq|sed` in unrelated example code, so the gate triggered on 100% of skill-md PRs and the cost-saving intent of #608 / #609 evaporated. The fix iterates the diffed skill-md files and only triggers §6c when the **added lines** contain the patterns. On 6 historical merged PRs (#623 #620 #621 #617 #622 #547) the new gate skips §6c on 4/6 (67%) — vs 0/6 under the old content-grep gate. Mirrored across `.claude/skills/`, `templates/skills/`, `skills/`. Gap 2 — `extractIdentifiersFromDiff` skips indented locals. `content = line.slice(1).trimStart()` defeated the comment's claim of "no nested-block decls" by stripping the indent that distinguishes top-level from function-body declarations. The dogfood run on #609 surfaced 24 identifiers (17 of them local `const lines = …` / `let inFence = …` style variables). Dropping `.trimStart()` brings the surface to top-level decls only. New test asserts indented `+ const local = …` is skipped while `+const topLevel = …` matches. Gap 3 — Empirical 5-PR replay for AC-5 / AC-6. New `--base-sha` / `--head-sha` CLI flags let `precheck.ts` replay against historical merged PRs. SHAs validated with `/^[0-9a-f]{4,40}$/` to avoid shell injection. Ran replay against 6 PRs (5 recent + #547 for AC-6 demo): aggregate ≈ −1,002 tok/PR under the new gate; PR #620's replay surfaced `acLiteralDiff.missingInPR.length = 8` — a real catch the inline §1 prose was supposed to make but #608's data shows §1 surfaced silently for years. Investigation doc appended with per-PR table + correction to the prior "true on 0 PRs" calibration claim. Test count: 27 → 30 (indented-skip + 2 parseArgs flag tests). `scripts/check-skill-sync.ts` reports qa/SKILL.md synced 3/3.
admarble
added a commit
that referenced
this pull request
May 11, 2026
…628) * feat(#609): extract deterministic QA gap-checks into precheck script New `scripts/qa/precheck.ts` runs three deterministic gap-checks before the QA agent and emits `.sequant/gap-precheck.json`: - fixtures — verbatim motivating-example extraction from issue body (feeds §6d Q1 / §6c Step 4) - siblingGrep — changed-identifier scan for cross-file sibling sites (feeds §5) - acLiteralDiff — AC checkbox IDs in issue body vs PR body (feeds §1) `qa/SKILL.md` gains Phase 0c that runs the precheck inline and consumes its findings. §6c becomes a file-glob hard precondition (no skill-md diff → emit nothing). §6c Step 4 prefers precheck `fixtures` over the inline `awk` extractor when available. §6d trims to a single adversarial paragraph (per #608's 9/14 / 0-actioned signal). Inline fallback preserved on missing/error/`not_applicable` output. Mirrored across all three `qa/SKILL.md` copies. Exit code always 0. Investigation doc at `docs/investigations/qa-precheck-extraction.md` covers AC-1 (22-row gate classification), AC-2 (per-PR run frequency), AC-5 (section-size delta calibration via #608's 50-PR window: ~−1,585 tok/invoke window-typical), and AC-6 (regression-coverage methodology against PR #547 / PR #533 shapes). Builds on #608's signal-to-noise data which informed Phase A scope. * fix(#609): close three gaps surfaced in post-commit QA Gap 1 — §6c precondition greps diff hunks, not file content. The first cut of this section's precondition shelled out to `xargs grep -lE ...` against the *current* skill-md file content. All 19 sequant SKILL.md files mention `grep|awk|jq|sed` in unrelated example code, so the gate triggered on 100% of skill-md PRs and the cost-saving intent of #608 / #609 evaporated. The fix iterates the diffed skill-md files and only triggers §6c when the **added lines** contain the patterns. On 6 historical merged PRs (#623 #620 #621 #617 #622 #547) the new gate skips §6c on 4/6 (67%) — vs 0/6 under the old content-grep gate. Mirrored across `.claude/skills/`, `templates/skills/`, `skills/`. Gap 2 — `extractIdentifiersFromDiff` skips indented locals. `content = line.slice(1).trimStart()` defeated the comment's claim of "no nested-block decls" by stripping the indent that distinguishes top-level from function-body declarations. The dogfood run on #609 surfaced 24 identifiers (17 of them local `const lines = …` / `let inFence = …` style variables). Dropping `.trimStart()` brings the surface to top-level decls only. New test asserts indented `+ const local = …` is skipped while `+const topLevel = …` matches. Gap 3 — Empirical 5-PR replay for AC-5 / AC-6. New `--base-sha` / `--head-sha` CLI flags let `precheck.ts` replay against historical merged PRs. SHAs validated with `/^[0-9a-f]{4,40}$/` to avoid shell injection. Ran replay against 6 PRs (5 recent + #547 for AC-6 demo): aggregate ≈ −1,002 tok/PR under the new gate; PR #620's replay surfaced `acLiteralDiff.missingInPR.length = 8` — a real catch the inline §1 prose was supposed to make but #608's data shows §1 surfaced silently for years. Investigation doc appended with per-PR table + correction to the prior "true on 0 PRs" calibration claim. Test count: 27 → 30 (indented-skip + 2 parseArgs flag tests). `scripts/check-skill-sync.ts` reports qa/SKILL.md synced 3/3.
3 tasks
admarble
added a commit
that referenced
this pull request
Jul 28, 2026
…was silent Found by running §7's actual shell pipeline against this issue's own spec comment during QA: `grep` matched the evidence-naming line, then `awk` attributed it to NO AC. AC-6 requires evidence-naming ACs to "route to PENDING"; routing needs an AC ID, so the recognition half worked and the routing half could not fire. Cause: the awk anchor was `/^(#+ AC-[0-9]+|\*\*AC-[0-9]+)/` — heading forms only. Measured across a corpus of 18 recent issues (#533–#822): - [ ] **AC-N** 102 #+ AC-N 70 - [ ] AC-N 32 **AC-N 24 The checkbox forms it missed (134) outnumber the heading forms it matched (94), so attribution was silent for ~59% of real AC declarations while detection kept reporting matches. Same class as the #547 awk-anchor bugs §6c documents, and exactly the failure mode #834 exists to eliminate: a half-wired gate that reports success. - Anchor now also matches `- [ ] AC-N` and `- [ ] **AC-N**`. - `parseAcHeaderPattern()` exposes the anchor so it is gate-tested against all five real declaration forms, plus two negatives (prose, indented non-AC checklist item) so a loosened anchor cannot misattribute every later match. End-to-end verified on the real #819 spec-comment AC-4 line ("…corpus check on several recent real issue bodies"): attributes to AC-4 after the fix, to nothing before it. Mutation-verified: reverting the anchor to the heading-only form fails exactly this one test (1 failed | 31 passed). Known residual, fail-safe: the nearest-preceding-declaration heuristic attributes trailing prose to the last AC seen, so an implementation note mentioning "corpus check" after the AC list can produce a spurious PENDING. That errs toward NEEDS_VERIFICATION, never toward a false READY_FOR_MERGE, and the imprecision is pre-existing to the manual-test terms. Left unchanged — tightening it would alter pre-existing detection semantics beyond this issue.
7 tasks
admarble
added a commit
that referenced
this pull request
Jul 29, 2026
…missed it Asking "what would make this A+" turned up the answer the issue itself predicted: "this is a structural seam, not a one-off." I1's phrase list started as the three strings named in the issue, plus a fourth added on noticing §6e's wording. That was hand-picking — the exact mistake §6c exists to prevent and the one #547 made three times — and it was never run against its own corpus. Enumerating every line in qa/SKILL.md that pairs a constraining verb with a verdict constant found §11 Script/CLI Execution Verification saying "Do NOT give `READY_FOR_MERGE` verdict until verification is complete" with no §7 gate. A second §2h, in the same file, shipped straight past the lint built to catch §2h. - Phrase list is now DERIVED from that enumeration, with the method recorded so the next edit re-runs it instead of guessing. - §11 wired: `script_verification_status` in §7 step 2, an `ELSE IF … == "Not Verified" → AC_MET_BUT_NOT_A_PLUS` branch in step 4, explicit status outcomes, and prose pointing at the branch. BEHAVIOR CHANGE: `scripts/` changes with no /verify evidence and no approved §11a override can no longer reach READY_FOR_MERGE. - I1 now recognises the second legitimate wiring mechanism. §1 constrains the verdict with no gate token because its outcome is an AC status, which §7 step 1 counts — step 3a blesses this explicitly. Flagging §1 would have been a false positive (AC-5). It qualifies only by NAMING `pending_count`; an unstated mechanism is indistinguishable from none. - I2 rejects a gate attributed to a duplicated section number. qa/SKILL.md has two `### 1.` sections, so "status from Section 1" would have no single answer. Fires only when a token actually points at one, so no renumbering is forced. - Forward-looking test: the lint's value is stopping the NEXT §2h, and every prior I1 test mutated existing wiring. Now simulates a contributor adding §6g in each of the four shipped declaration styles. - CONTRIBUTING.md documents both wiring mechanisms; `check-skill-sync` was documented and this was not. Mutation-verified: narrowing the phrase list back to the original four fails the forward-looking and AC-routing tests (2 failed | 37 passed); pointing an existing gate at the duplicated §1 produces the I2 violation. 39 tests; full suite 213 files / 4430 passed; build, eslint, all four skill lints, tautology detector clean.
admarble
added a commit
that referenced
this pull request
Jul 29, 2026
…ain (§2h has been unwired since it shipped) (#841) * fix(#834): §7 gates must be reachable — lint /qa's own enforcement chain §2h declared `verdict CANNOT be READY_FOR_MERGE` plus a Maximum Verdict table, but §7's algorithm never evaluated it: no `cli_registration_status` in step 2, no branch in step 4. The gate had been prose-only since the day it shipped, and the #305 bug class it exists to catch is invisible to TypeScript, build, and unit tests. - Wire §2h: `cli_registration_status` in §7 step 2, an `ELSE IF ... == "Failed" → AC_NOT_MET` branch in step 4, and §2h's prose pointing at that branch the way §6f's does. Behavior change: a verdict that would previously have reached READY_FOR_MERGE despite a failed CLI-registration check is now AC_NOT_MET. - Add `scripts/lint-skill-gates.ts` (+ `lint:skill-gates`, CI step) asserting I1 declared floors are reachable from §7 · I2 no orphan gates · I3 every `(REQUIRED` section has an explicit place in both mode checklists · I4 checklists and templates agree both directions. I1 asks §7 which section a token is attributed to rather than deriving names from titles — a `[a-z_]+_status` heuristic would false-positive on §6a's `skill_verification`. Every parser fails loud: a present-but-unparseable region is a violation, never "no findings". - Fix the five further gaps the lint found on main: §6e and §10a were `(REQUIRED` with Simple Fix mode silent about them (added to the required list, not the omitted one — both defect classes are plausibly sub-threshold diffs, so omitting would recreate #819 F2); the Standard checklist never demanded the Precheck Findings or CLI Registration Verification sections its template renders, and demanded a CHANGELOG Verification section the template had no place for. - Extend §7's Manual Test AC Enforcement to evidence-naming ACs (corpus check, against several real …, N samples, sampled) → PENDING → NEEDS_VERIFICATION when the artifact is absent. #819's AC-4 named a corpus check and was marked MET on "unchanged by construction"; when the check was finally run it surfaced a real false-positive surface. Gate tests use the real shipped qa/SKILL.md as the passing fixture and that same content minus one specific piece of wiring as the failing fixture, so fixtures are mutation-derived from the actual §2h / #819 F1 / #819 F2 defects rather than synthesized. Layer 2 of #22's four validation layers (only Layer 1 ever shipped, per #823's post-mortem). Refs #305, #819, #830, #608, #515. Fixes #834 * fix(#834): own the evidence-AC pattern extraction in the lint, not the test The tautology detector flagged 9 of 34 blocks (26.5%) in the new test file: the AC-6 tests compiled §7's evidence-naming detection pattern with a test-local extractor, so nothing validated the extraction itself and no block called production code. That is a real finding, not a detector artifact. - Export `parseEvidenceAcPattern()` from lint-skill-gates.ts as the single owner of that parse, scoped to the `manual_test_acs=` assignment. - Use it in `lintSkillContent`: when §7 declares step-3a manual-test enforcement but the pattern will not compile, emit a PARSE violation. Deleting the shipped pattern is now a build failure rather than a silent downgrade — the same prose-only condition I1 catches, one level down. - Tests call the parser inline per block and assert with toMatch, which also stops `RegExp.prototype.test(...)` reading as a test declaration. Tautology detector: 9 blocks (26.5%) → 0 ("All tests call production code"). 29 tests pass. * test(#834): gate the awk AC-ID extraction line, not just the grep line Found by mutation testing, not review. §7 detects evidence-naming ACs with a `grep -iE` pattern, then attributes matches to AC IDs with a second `awk` pattern carrying the same terms. The AC-6 tests extracted only the grep line, so stripping the four terms from `awk` alone left all 29 tests green while AC-ID attribution silently stopped working — a half-wired feature with a green suite, which is the failure mode this issue exists to eliminate. Adds an assertion scoped to the `manual_ac_ids=` block so the grep line cannot satisfy it. Mutation-verified: stripping the awk terms fails exactly this test (1 failed | 29 passed) and stripping the grep terms still fails only the two pattern-match tests. * fix(#834): gate both halves of §7's evidence-AC detection, behaviorally Follow-up to the previous commit's awk gate, which asserted literal text and so tested the pattern's spelling rather than its behavior. - Add `parseEvidenceAcIdPattern()`, symmetric with `parseEvidenceAcPattern()`, compiling the `awk` program's AC-ID attribution pattern. - `lintSkillContent` now requires BOTH halves to compile and names which one failed. Previously only the grep half was checked, so the awk half could be removed outright with the lint still green — the same failsafe-off hole one level down. - The awk gate now asserts behavior (#819's AC-4 matches, a control does not) instead of literal term presence. Mutation-verified: stripping the terms from awk alone fails exactly the behavioral awk test (1 failed | 30 passed); removing the awk match block outright fails exactly the fail-loud test and reports only the AC-ID attribution half. 31 tests pass; tautology detector reports 0 blocks. * fix(#834): anchor AC attribution on the checkbox form — AC-6 routing was silent Found by running §7's actual shell pipeline against this issue's own spec comment during QA: `grep` matched the evidence-naming line, then `awk` attributed it to NO AC. AC-6 requires evidence-naming ACs to "route to PENDING"; routing needs an AC ID, so the recognition half worked and the routing half could not fire. Cause: the awk anchor was `/^(#+ AC-[0-9]+|\*\*AC-[0-9]+)/` — heading forms only. Measured across a corpus of 18 recent issues (#533–#822): - [ ] **AC-N** 102 #+ AC-N 70 - [ ] AC-N 32 **AC-N 24 The checkbox forms it missed (134) outnumber the heading forms it matched (94), so attribution was silent for ~59% of real AC declarations while detection kept reporting matches. Same class as the #547 awk-anchor bugs §6c documents, and exactly the failure mode #834 exists to eliminate: a half-wired gate that reports success. - Anchor now also matches `- [ ] AC-N` and `- [ ] **AC-N**`. - `parseAcHeaderPattern()` exposes the anchor so it is gate-tested against all five real declaration forms, plus two negatives (prose, indented non-AC checklist item) so a loosened anchor cannot misattribute every later match. End-to-end verified on the real #819 spec-comment AC-4 line ("…corpus check on several recent real issue bodies"): attributes to AC-4 after the fix, to nothing before it. Mutation-verified: reverting the anchor to the heading-only form fails exactly this one test (1 failed | 31 passed). Known residual, fail-safe: the nearest-preceding-declaration heuristic attributes trailing prose to the last AC seen, so an implementation note mentioning "corpus check" after the AC list can produce a spurious PENDING. That errs toward NEEDS_VERIFICATION, never toward a false READY_FOR_MERGE, and the imprecision is pre-existing to the manual-test terms. Left unchanged — tightening it would alter pre-existing detection semantics beyond this issue. * fix(#834): gate the AC-declaration anchor too, and correct a comment/effect gap Two QA follow-ups on the previous commit. 1. `parseAcHeaderPattern` was exported and behaviorally tested but never wired into the fail-loud check, so removing the anchor outright (as opposed to weakening it) still left the lint green. It is now the third checked pattern alongside detection and AC-ID attribution, with its own regression test. Verified: gutting the anchor yields "its AC-declaration anchor half has no compilable pattern". 2. A comment on the RegExp-compile fallback claimed an uncompilable ERE was "worth surfacing, not something to swallow into a silent null" while the code returned null — describing the intent, not the effect, and inviting a future reader to conclude the error was dropped. Reworded to state the actual mechanism: lintSkillContent converts null from any of these parsers into a PARSE violation, which is what makes it fail the build. Claim #1 above is what makes the reworded comment true for all three parsers. 33 tests pass; build, eslint, lint:skill-gates, lint:skill-sync (44/44), tautology detector all clean. * fix(#834): scope AC attribution and drop the gawk-only IGNORECASE Closes the two gaps QA left open. Both were measured against a corpus of 18 real issues (#533–#822) rather than reasoned about. Gap 1 — attribution scope. QA documented trailing-prose misattribution as an acceptable fail-safe. Measuring it showed that was too generous: of 9 attributions the old program produced across the corpus, 5 were WRONG — including a `| AC-7 | … |` coverage row credited to AC-8 and a `| AC-4 | … |` row credited to AC-6. Misattributing a PENDING to the wrong AC is not fail-safe; it points the reader at the wrong requirement. A non-AC heading now clears the current AC. Verified: all 4 true positives survive (including #819's AC-4, the motivating case, and #795's two real Manual Test markers) and all 5 false positives disappear. Gap 2 — `BEGIN{IGNORECASE=1}` is a gawk extension and a silent no-op on macOS's awk, so matching was case-sensitive there. `Manual test` and `Corpus check` both occur in the corpus and were being missed. Replaced with `tolower($0) ~ /…/`, which is POSIX-portable; all awk literals are now lowercase. Both properties are gated, not just fixed: - `parseAcScopeResetClause()` — the lint fails if the scope-reset clause is removed, since its absence is otherwise silent. - `findUppercaseInAwkPattern()` — an uppercase literal in a pattern matched against `tolower($0)` can never fire, so reintroducing `Manual Test` is now a build failure rather than a dead term. Mutation-verified: removing the scope-reset clause and reintroducing an uppercase literal each produce their own named violation. 37 tests pass; full suite 168 files / 3847 passed; tautology detector clean. * fix(#834): wire §11 — the lint's own phrase list was hand-picked and missed it Asking "what would make this A+" turned up the answer the issue itself predicted: "this is a structural seam, not a one-off." I1's phrase list started as the three strings named in the issue, plus a fourth added on noticing §6e's wording. That was hand-picking — the exact mistake §6c exists to prevent and the one #547 made three times — and it was never run against its own corpus. Enumerating every line in qa/SKILL.md that pairs a constraining verb with a verdict constant found §11 Script/CLI Execution Verification saying "Do NOT give `READY_FOR_MERGE` verdict until verification is complete" with no §7 gate. A second §2h, in the same file, shipped straight past the lint built to catch §2h. - Phrase list is now DERIVED from that enumeration, with the method recorded so the next edit re-runs it instead of guessing. - §11 wired: `script_verification_status` in §7 step 2, an `ELSE IF … == "Not Verified" → AC_MET_BUT_NOT_A_PLUS` branch in step 4, explicit status outcomes, and prose pointing at the branch. BEHAVIOR CHANGE: `scripts/` changes with no /verify evidence and no approved §11a override can no longer reach READY_FOR_MERGE. - I1 now recognises the second legitimate wiring mechanism. §1 constrains the verdict with no gate token because its outcome is an AC status, which §7 step 1 counts — step 3a blesses this explicitly. Flagging §1 would have been a false positive (AC-5). It qualifies only by NAMING `pending_count`; an unstated mechanism is indistinguishable from none. - I2 rejects a gate attributed to a duplicated section number. qa/SKILL.md has two `### 1.` sections, so "status from Section 1" would have no single answer. Fires only when a token actually points at one, so no renumbering is forced. - Forward-looking test: the lint's value is stopping the NEXT §2h, and every prior I1 test mutated existing wiring. Now simulates a contributor adding §6g in each of the four shipped declaration styles. - CONTRIBUTING.md documents both wiring mechanisms; `check-skill-sync` was documented and this was not. Mutation-verified: narrowing the phrase list back to the original four fails the forward-looking and AC-routing tests (2 failed | 37 passed); pointing an existing gate at the duplicated §1 produces the I2 violation. 39 tests; full suite 213 files / 4430 passed; build, eslint, all four skill lints, tautology detector clean.
admarble
added a commit
that referenced
this pull request
Aug 10, 2026
… on the gate (#928) * feat(#922): citation grounding checker + Phase A measurement instrument Phase A of #922. Two scripts, deliberately split: - `scripts/spec/ground-check.ts` — read-only, offline existence checker. Extracts path- and symbol-like citations from plan text and resolves them against the tree via `git ls-tree`/`git grep`. Always exits 0; findings live in the JSON, consumers decide gating (the `scripts/qa/precheck.ts` idiom). Safe to wire into `/spec` later because it never writes and never reaches the network — AC-1. - `scripts/spec/measure-corpus.ts` — the measurement instrument. Reaches the network (`gh`) so the checker does not have to. Reports the phantom rate AND the coverage rate, because a phantom rate alone reads as a clean bill of health when the real story is "almost nothing was checkable". Design notes worth keeping: Nonexistent is not phantom. Plans legitimately name code they propose to create. The discriminator is deterministic rather than verb-sniffing: check each citation at the commit contemporaneous with the comment AND at HEAD. Missing-then/exists-now is planned-new; missing at both is a phantom candidate. That is only valid once the work merged, so the headline corpus is restricted to closed issues and open ones are reported separately as un-discriminable. Two false positives found by running against the real corpus, neither of which synthetic fixtures produced (#551/#547): - `commands/ready.ts` is really `src/commands/ready.ts`. Authors elide leading directories constantly, so path resolution needed suffix matching. - `hasDeliverableCommits` came from "export an alias `hasDeliverableCommits`" in the #920 plan — a proposal, not a claim about existing code. Scored as an asserted phantom until `export|alias` joined the creation verbs. Both are now regression tests with verbatim fixture text. Windows/POSIX: all path manipulation goes through `path.posix`, since every path handled originates from git (always `/`-separated) or from citation text. `path.join` would emit `\` on Windows and silently break every comparison against the tracked-file set — AC-4. Tests: 39 unit + 6 CLI integration. The CLI file carries the `.integration.` infix so it lands in the integration project (serialized, 30s floor) rather than the unit project's 5s default (#842). Refs #922 * test(#922): de-tautologise the fence test; correct stripFences' rationale Mutation-testing `stripFences` (return the text unchanged) failed only one test, not two — which exposed the fenced-block extraction test as a tautology. Its fixture used an *unbackticked* path inside a fence, and extraction requires backticks, so the assertion held whether or not fences were stripped. Rewritten with a backticked path; the mutation now fails both tests. Chasing that down produced a measurement worth recording: a backticked path inside a fence occurs **0 times** across the 1.18 MB corpus of 159 real plan comments. Fence-stripping therefore has no effect on citation extraction — the rationale the doc comment previously gave. It is genuinely load-bearing for `measure-corpus.ts`'s claim-line counting, where fenced lines starting `-` or `|` would otherwise inflate the coverage denominator. The comment now states both, and flags the test fixture as constructed rather than captured since the corpus supplies no instance. Also drops a duplicate `docs` entry from SYMBOL_STOPLIST (a Set, so inert — but it read as two different exclusions). Refs #922 * fix(#922): stop the instrument reporting its own errors as plan defects The first full corpus run put the asserted-phantom rate at 3.5% (34 of 976 citations). Reading all 34 showed most were the measurement's fault, not the plans': - **Untracked-but-real paths.** `dist/`, `dist/bin/cli.js`, `.sequant/state.json`, `scripts/dev/` — all real, all gitignored, none in `git ls-tree`. 6 of 34. Now resolved via a filesystem fallback. - **Git and shell idioms.** `origin/`, `fix/`, `./`, `../` matched the directory regex. 4 of 34. Now a stoplist. Both classes are now regression-tested. The filesystem fallback needed care: applied naively it also answers "does this exist now" to the "did it exist then" question, which collapses the planned-new discriminator and *understates* the phantom rate — the opposite error, and a quieter one. Two CLI tests caught it immediately (`--ref` resolving a file that only exists on this branch). It is now passed only for working-tree checks, and `measure-corpus.ts` enables it solely on the "now" leg, with untracked-but-real given its own verdict rather than being folded into planned-new — it was never created by the plan. Corrected rate: 2.8% asserted-phantom, coverage 51.6%, over 39 merged plans and 972 citations. Refs #922 * fix(#922): make the --ref integration test hermetic `build (22.x)` failed on 1 of 5356 tests — mine. The test resolved `origin/main` to get a historical commit, which works locally and not under `actions/checkout`, where no such ref exists. The assertion was sound; the setup depended on ambient repository state. It now builds a two-commit repo in a temp dir: commit one has `src/old.ts`, commit two adds `src/new.ts`. Checking the same input at the first commit must resolve `old.ts` and not `new.ts`, and against the working tree must resolve both — so the difference is attributable to the ref rather than to extraction, which the previous single-assertion version could not show. This is the discriminator `measure-corpus.ts` depends on to separate planned-new from phantom, so it is worth pinning precisely. Refs #922 * fix(#922): close the gaps flagged in Phase A review Three repo-level gaps and one instrument gap, all previously reported as "pre-existing, not fixed here". **`scripts/` was neither typechecked nor linted.** `tsconfig.json` includes only `src/` and `bin/` (what `npm run build` emits), and `npm run lint` ran `eslint src/ bin/`. So every CLI that `/qa` and `/spec` shell out to — `precheck.ts`, `tautology-detector-cli.ts`, the new #922 scripts — was outside both gates, and `npx eslint scripts/...` failed outright with "not found in any of the provided project(s)". - New `tsconfig.scripts.json`: typecheck-only project over `scripts/`, `noEmit` so nothing reaches `dist/`. `allowImportingTsExtensions` is safe precisely because it never emits, and the scripts import each other with explicit `.ts` specifiers that `tsx` resolves at runtime. - `eslint.config.js` points `scripts/**/*.ts` at that project. - `lint` now covers `scripts/`; new `typecheck:scripts`; CI's typecheck job runs it. Turning the gates on surfaced 11 real problems, all fixed: two `no-useless-escape` errors in `ready-backtest.ts`, an unused `catch` binding in `qa-cache-cli.ts`, and eight stale `eslint-disable no-console` directives (`no-console` is not enabled in this config) across `precheck.ts` and the #922 scripts. **`vitest run --project <name>` never worked.** Vitest 4 reads a project's `name` only from inside its `test` block; declared as a sibling it is ignored, and the symptom is "No projects matched the filter" — which reads like a typo in the command, not a config defect. Both projects still ran, so what was lost was the ability to target one: the #842 split between the 5s unit project and the serialized 30s integration project could not be verified from the CLI. Now it can, and it confirms the #922 split — 42 unit, 6 integration. **The untracked-path check was checkout-dependent.** `fs.existsSync` alone means a fresh worktree with no `dist/` and no `.sequant/state.json` scores paths as phantoms that a built checkout resolves — non-reproducibility in a measurement instrument. Now also consults `git check-ignore`, which is checkout- and history-independent, plus an explicit repo-external case (`../worktrees/`) compared on the resolved path rather than by looking for ".." in the string. Effect on the Phase A number: asserted phantoms 34 -> 27 -> **17** (1.7%), instrument noise 24 -> 14. The adjudicated hallucination count is unchanged at 3, so the AC-3 recommendation stands — on a cleaner denominator, with the false-flag ratio down from 8:1 to ~4.7:1. Refs #922 * feat(#922): pin the resolved commit SHA in ground-check output Grounding has a shelf life: a check runs against a tree that keeps moving, and the old output could not say which tree. `ref` echoed the raw CLI string — a moving name like a branch, or null in working-tree mode — so a consumer reading the JSON later had no way to tell whether the confirmation was stale. `GroundCheckResult` now carries `resolvedSha`: the full SHA of `ref` resolved via `git rev-parse --verify`, or of HEAD in working-tree mode (where `ref: null` continues to signal that uncommitted changes may sit on top). An unresolvable ref pins null rather than silently reporting HEAD as if it were the requested ref, mirroring `buildRepoIndex`'s empty-index degrade. This is the Phase-A-safe slice of @zeweihan's shelf-life review point on the issue: no gate is wired (AC-3 recommends against), but the surviving on-demand checker now emits drift-detectable provenance for free, so any future consumer gets "when and against what" without a schema change. Mutation-verified: deleting `resolvedSha` from the result object fails exactly the four new assertions (working-tree pin, historical-ref pin, HEAD-vs-base distinction, unresolvable-ref null); restored. Refs #922
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
**Verification:** Manual Test(and freeform patterns liketry X, confirm Y) from/speccommentsPENDING(forcingNEEDS_VERIFICATIONverdict)no runtime surface,equivalent unit test coverage,tested in sibling issuePre-PR AC Verification
Test plan
npm run buildpassesnpm run lintpasses (0 errors, 0 warnings)npm testpasses (2673 tests, 114 test files)diffCloses #529