You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
investigation(qa): recalibrate the #1067 seeded-defect grader before #1068 (identifier choice, precision definition, heading noise) #1313
Problem. In five /qa runs on the #1067 seeded fixture, a human reader marks all 5 planted defects caught in every run (25/25). The literal-identifier grader scores recall 0.40–0.80 (mean 0.60) and precision 0.27–0.42 (mean 0.36), and disagrees with the human on 10 of 25 cases. #1068's ablation would measure the grader's blind spots, not /qa. Four causes, each seen in the run outputs:
Two identifiers name helpers that are not the defect site.formatNotes and readNotesFile are existing store.ts helpers. The defects are the "markdown" comparison and the empty catch in export.ts, and reviewers cite those (src/export.ts:25, catch { notes = [] }). readNotesFile scored 0/5. All 3 formatNotes hits were wrong-reason: they came from a sentence about the vi.mock test, not the format bug.
Restatements without an identifier count against precision. Each review states every defect 2–3 times: in the AC table row, the Issues list and Next steps. Only some of those statements carry the identifier.
Real, non-planted findings count as imprecision. Examples: the serve handler with no try/catch, --port going unvalidated, and a PR body claiming a test it doesn't have. Precision as defined is "share of findings that name a planted defect", not a false-positive rate. By human reading, there were 0 false positives across the five runs.
Heading match noise.ISSUE_HEADING matches "Issue" in ## QA Review for Issue #N, so a review's intro bullets (Mode, Branch) become findings. ❌ rows in the build/test status tables count as not-met AC rows.
AC-2: Precision is redefined or renamed so a real non-planted finding is not counted as a false positive. A planted-defect restatement is deduplicated, or the metric is documented as "planted share". Evidence: the doc's definition and a grader test.
AC-3: ## QA Review for Issue #N intro bullets and ❌ rows outside the AC table are not findings. Evidence: a grader test over a template-shaped verdict.
AC-1 trap. "The comparison literal" as the identifier does not work as written. markdown is on two lines of defects.patch (85: opts.format === "markdown", and 100: text/markdown). namesIdentifier accepts text/markdown, because / is not a word character or .. The fixture-integrity test in scripts/analytics/qa-seeded-grade.test.ts needs each identifier on exactly one patch line, so it rejects markdown. Options:
Change line 100 of the fixture (AC-1 allows a fixture change).
Use a site token that occurs once, e.g. === "markdown".
Allow a defect to have several accepted identifiers, scored as caught if any one appears.
The same check applies to readNotesFile's replacement: catch { must occur once in the patch.
Where the five reviews are. Each run's full QA review is the last assistant text block that starts with ## QA Review in the single .jsonl under ~/.claude/projects/-Users-tony-Projects-notes-fixture-worktrees-feature-N-add-notes-export-and-notes-serve/, where feature-N is run N (N = 1..5). Extract them with:
The human label is "caught" for all 25 cases (5 defects × 5 runs).
Exec cannot re-run /qa on the fixture. That is five opus sequant run calls on a private repo. So AC-1 must be met by the first branch: re-grading the five existing reviews gives disagreement ≤ 2/25. The new identifiers must be tokens those reviews already contain. If no choice reaches ≤ 2/25, stop and say so; a fixture re-run is an owner decision.
Token counts in the five reviews (runner's grep, runs 1..5):
"markdown" (with quotes): 2, 3, 3, 2, 2. === "markdown": 0, 1, 0, 1, 0. text/markdown: 0 in all five.
vi.mock: 0, 2, 2, 0, 1. So the unmet-ac misses in runs 1 and 4 are an identifier problem too, not only formatNotes/readNotesFile.
A single literal per defect looks unlikely to work. A list of accepted aliases per defect (caught if any alias appears in a finding) is the third option in the research note above. That changes the fixture-integrity rule: each alias must still occur on exactly one line of defects.patch, or the rule must be restated. The current markdown token is on patch lines 85 and 100.
Committing the reviews as test fixtures is fine if they contain no machine paths or private URLs. The runner found 0 /Users/ hits; also grep for admarble/notes-fixture and strip it. Put them beside the other fixture files under docs/investigations/qa-seeded-fixture/.
Scope. Do not change /qa (Non-Goal). Update the dataset doc's grader section and AC-7 numbers to the re-graded result.
Phase rules (exec and qa):
Run the full suite at most once, in the foreground, with timeout 590, and only after a WIP commit. Otherwise run named vitest files. CI runs the full suite.
Commit every ~10 minutes. Never wait on a background test run.
Do not edit the PR body or title by any means (gh pr edit, gh api PATCH, MCP). Put the AC table and every SEQUANT_MUTATION marker in exec's final ## Summary, which must start with that heading.
All three ACs are single-line, with Evidence:. Two warnings:
AC-1's "≤ 2 of 25" is measurable, but the "or the fixture is changed and re-run" branch is closed by the runner note: exec cannot re-run /qa (five private opus runs). AC-1 must be met on the five existing reviews, or exec stops and says so.
AC-2's "or" lets either a redefinition or a rename satisfy it. I plan to do both: rename to "planted share" and add a real-finding-aware companion.
Vacuity check on the Evidence: today the re-grade gives 10/25 disagreement and no test covers heading noise, so all three fail on unchanged code.
Scope Assessment
Non-Goals: present (don't change /qa).
Metric
Value
Status
Feature count
1
✅
AC items
3
✅
Directory spread
3 (scripts/analytics, docs/investigations)
✅
Verdict: ✅ SCOPE_OK
Feasibility (measured on the five stored reviews)
I re-extracted the five reviews (/tmp, per the runner command; 0 /Users/ or notes-fixture hits) and re-ran the current grader. It reproduces the issue exactly: recall 0.40/0.80/0.80/0.40/0.60, precision 0.27/0.42/0.36/0.36/0.38. Then I tested aliases against the findings the grader extracts (1 = some finding contains it):
Defect
Candidate aliases
Runs 1–5 caught
format
"markdown"
5/5 (also export.ts:25 5/5)
since
parseSinceDate
5/5 (keep)
swallowed error
catch (bare) / notes = []
catch 5/5; notes = [] 2/5
bind
0.0.0.0
5/5 (keep)
mock test
vi.mock
only 3/5 (0 in runs 1, 4)
Defect 5 is the hard one: runs 1 and 4 never write vi.mock, but both name src/export.test.ts in the AC-5 NOT_MET row (a finding). So a defect needs aliases, and the best set is: format ["markdown" quoted, export.ts:25]; error [catch, empty catch]; mock [vi.mock, src/export.test.ts]. Projected: 25/25 caught, disagreement 0/25 (≤ 2 target). Exec must confirm by running the grader, not trust this table. Caveats it must handle: src/export.test.ts and markdown occur on several defects.patch lines, and catch is a common word, so the integrity rule changes (below).
Acceptance Criteria
AC-1: identifiers are tokens a reviewer must write
Verification: Unit Test (grader over committed reviews) + Manual (doc numbers) Scenario: Given the five reviews committed under docs/investigations/qa-seeded-fixture/reviews/ → When graded with the new ground truth → Then disagreement vs the all-caught human label is ≤ 2/25. Assumptions: Aliases above survive; if no alias set reaches ≤ 2/25, stop and report (fixture re-run is an owner decision).
AC-2: precision is not a false-positive rate
Verification: Unit Test Scenario: Given a verdict with one planted-defect finding stated three times plus one real non-planted finding → When graded → Then planted share dedupes the restatements and the non-planted finding is not reported as a false positive. Assumptions: Rename gradePrecision output to planted share (keep the export name or alias it so the existing tests are updated, not skipped).
AC-3: template-shaped verdict
Verification: Unit Test Scenario: Given a verdict with ## QA Review for Issue #N + Mode/Branch bullets and a ❌ row in the build/test table → When extractFindings runs → Then neither becomes a finding, and ❌ rows inside the AC table still count. Assumptions: "AC table" is identified by its header row (an AC first column), not by position.
Implementation Plan
Phase 1: Fixture and ground truth
Copy the five reviews to docs/investigations/qa-seeded-fixture/reviews/run-N.md (extract with the jq/awk command from the runner comment; re-grep for /Users/ and admarble/notes-fixture, strip).
ground-truth.json: replace id with identifiers: string[] (caught if any appears). Update PlantedDefect/loadTruth; accept the old id as a one-element list so sample-verdict.md still grades.
Restate the fixture-integrity test in scripts/analytics/qa-seeded-grade.test.ts: each defect needs at least one alias that occurs on exactly one defects.patch line, or the test documents why not. Mutation-verify it.
NOT_MET_ROW applies only to rows of a table whose header's first cell starts with AC; ❌ rows in build/test tables are ignored.
Dedupe: group findings by the defect they name; report planted share = findings naming a planted defect ÷ findings (deduped per defect), plus unmatched count listed rather than scored as false positives. Update module header comment and CLI output labels.
Phase 3: Tests and docs
Tests: a template-shaped verdict (AC-3), restatement dedupe + non-planted finding (AC-2), and a regression test that grades the five committed reviews (disagreement ≤ 2/25). Include the markdown comparison and the empty-catch cases as motivating fixtures.
Where does this belong?scripts/analytics/qa-seeded-grade.ts and its fixture. No /qa change.
Simplest correct approach? Alias lists in ground truth, not fuzzy matching. Rejected: editing defects.patch line 100 (would invalidate the fixture's recorded runs); a single === "markdown" literal (0–1 hits per run).
Producers/consumers:ground-truth.json is read by loadTruth, the grader tests, the fixture README and the dataset doc. gradePrecision/extractFindings have no other callers (grep before renaming).
Rule Touchpoints
None triggered that bear on runtime code.
Feature Quality Planning
All standard checks pass. Notable:
The reviews end with a SEQUANT_QA_GAPS JSON comment that repeats every defect; extraction must not count it (it is not in a list/table, so it is ignored today — keep a test).
Committed reviews are test data: pin the extraction command in the README.
Open Questions
Alias set for the mock-test defect — Recommendation: vi.mock + src/export.test.ts. Impact: if src/export.test.ts is judged too weak (it also names the file in any test-gap finding), the metric has a false-catch risk; the human label is the check.
Keep the precision name as a deprecated alias? — Recommendation: rename outright (no other callers). Impact: low.
Recommended Workflow
Phases: exec → qa Quality Loop: disabled Reasoning: Contained script and doc change, no UI. testgen skipped: the grader tests are specified above and are the work itself. Tell exec to skip the full npm test (30-min wall) and run the named test files; CI runs the rest.
The aliases were chosen from the five reviews they are scored on. Exec says so. Since AC-1 allows this, 0/25 meets the AC, but it does not show the grader generalises. Check each alias for false catches:
Can export.test.ts or export.ts:25 appear in a finding that is not about that defect? For example, a finding about some other line of the test file. Construct one and see whether it scores.
Does case-insensitive matching widen any alias in a way that matters?
The integrity rule changed: at least one alias per defect must occur on exactly one patch line, not every alias. Check that this still blocks an alias that only matches unrelated patch text.
Same phase rules as before: named vitest files only. Do not edit the PR body. CI runs the full suite.
Integrity rule does not constrain non-anchoring aliases — dropped: matches the restated rule in the README
CI test check had not reported when QA ran — dropped: CI is still running; re-check before merge
An Issues bullet about anything in src/export.test.ts (for example, "a typo in a describe name") is scored as catching the mock-test defect.
"export.ts:25 is fine; the bug is in serve.ts:10" is scored as catching the format defect.
A finding about an "empty catch block" in src/serve.ts is scored as catching the export.ts error defect.
Case-insensitive matching lets "Markdown" (capital M) match the "markdown" alias. The same widening is also what lets run 4's "Empty catch" score as a catch.
The integrity test checks that one alias per defect is anchored to the patch. It does not check the other aliases: a weak extra alias such as export.test.ts, which is on 2 patch lines, passes. That is consistent with the restated rule, but say it in the doc.
The integrity test matches case-sensitively while the grader matches case-insensitively.
The legacy-id test leaves a temp directory behind.
Activity
admarble commentedon Oct 5, 2026
Upstream research note
Where the four causes come from. They are #1067's design, and #1067 AC-7 existed to find them:
grep -cfor each identifier in the fixture diff returns 1") picked identifiers that are unique in the author's diff. That is whyformatNotesandreadNotesFileare helper call sites, not the defect site.sample-verdict.md, a hand-written verdict in the grader's own shape. It has no## QA Review for Issue #Nheading and no build table. The grader first saw a real/qaverdict during calibration.AC-1 trap. "The comparison literal" as the identifier does not work as written.
markdownis on two lines ofdefects.patch(85:opts.format === "markdown", and 100:text/markdown).namesIdentifieracceptstext/markdown, because/is not a word character or.. The fixture-integrity test inscripts/analytics/qa-seeded-grade.test.tsneeds each identifier on exactly one patch line, so it rejectsmarkdown. Options:=== "markdown".The same check applies to
readNotesFile's replacement:catch {must occur once in the patch.admarble commentedon Oct 5, 2026
Runner context (before
sequant run)Where the five reviews are. Each run's full QA review is the last assistant text block that starts with
## QA Reviewin the single.jsonlunder~/.claude/projects/-Users-tony-Projects-notes-fixture-worktrees-feature-N-add-notes-export-and-notes-serve/, where feature-N is run N (N = 1..5). Extract them with:The human label is "caught" for all 25 cases (5 defects × 5 runs).
Exec cannot re-run
/qaon the fixture. That is five opussequant runcalls on a private repo. So AC-1 must be met by the first branch: re-grading the five existing reviews gives disagreement ≤ 2/25. The new identifiers must be tokens those reviews already contain. If no choice reaches ≤ 2/25, stop and say so; a fixture re-run is an owner decision.Token counts in the five reviews (runner's grep, runs 1..5):
"markdown"(with quotes): 2, 3, 3, 2, 2.=== "markdown": 0, 1, 0, 1, 0.text/markdown: 0 in all five.export.ts:25: 3, 4, 5, 2, 3.catch {: 1, 0, 0, 0, 1. Barecatch: 5, 5, 5, 6, 7.vi.mock: 0, 2, 2, 0, 1. So theunmet-acmisses in runs 1 and 4 are an identifier problem too, not onlyformatNotes/readNotesFile.A single literal per defect looks unlikely to work. A list of accepted aliases per defect (caught if any alias appears in a finding) is the third option in the research note above. That changes the fixture-integrity rule: each alias must still occur on exactly one line of
defects.patch, or the rule must be restated. The currentmarkdowntoken is on patch lines 85 and 100.Committing the reviews as test fixtures is fine if they contain no machine paths or private URLs. The runner found 0
/Users/hits; also grep foradmarble/notes-fixtureand strip it. Put them beside the other fixture files underdocs/investigations/qa-seeded-fixture/.Scope. Do not change
/qa(Non-Goal). Update the dataset doc's grader section and AC-7 numbers to the re-graded result.Phase rules (exec and qa):
timeout 590, and only after a WIP commit. Otherwise run named vitest files. CI runs the full suite.gh pr edit,gh apiPATCH, MCP). Put the AC table and everySEQUANT_MUTATIONmarker in exec's final## Summary, which must start with that heading.}anywhere (fix(qa): a SEQUANT_MUTATION marker whose text contains "}" parses to nothing — renderMutationMarker and the parser do not round-trip #1305), andfailedTeststarts with the test file path (src/…/x.test.ts > describe > case).$N; write$(N)(investigation(skills): Claude Code may substitute positional $0 inside qa SKILL.md awk programs when /qa gets an argument #1289 lint).admarble commentedon Oct 5, 2026
Complexity: Standard (3 ACs, 3 directories)
AC Quality Check
All three ACs are single-line, with
Evidence:. Two warnings:/qa(five private opus runs). AC-1 must be met on the five existing reviews, or exec stops and says so.Scope Assessment
Non-Goals: present (don't change
/qa).scripts/analytics,docs/investigations)Verdict: ✅ SCOPE_OK
Feasibility (measured on the five stored reviews)
I re-extracted the five reviews (
/tmp, per the runner command; 0/Users/ornotes-fixturehits) and re-ran the current grader. It reproduces the issue exactly: recall 0.40/0.80/0.80/0.40/0.60, precision 0.27/0.42/0.36/0.36/0.38. Then I tested aliases against the findings the grader extracts (1 = some finding contains it):"markdown"export.ts:255/5)parseSinceDatecatch(bare) /notes = []catch5/5;notes = []2/50.0.0.0vi.mockDefect 5 is the hard one: runs 1 and 4 never write
vi.mock, but both namesrc/export.test.tsin the AC-5 NOT_MET row (a finding). So a defect needs aliases, and the best set is: format["markdown"quoted,export.ts:25]; error[catch, empty catch]; mock[vi.mock, src/export.test.ts]. Projected: 25/25 caught, disagreement 0/25 (≤ 2 target). Exec must confirm by running the grader, not trust this table. Caveats it must handle:src/export.test.tsandmarkdownoccur on severaldefects.patchlines, andcatchis a common word, so the integrity rule changes (below).Acceptance Criteria
AC-1: identifiers are tokens a reviewer must write
Verification: Unit Test (grader over committed reviews) + Manual (doc numbers)
Scenario: Given the five reviews committed under
docs/investigations/qa-seeded-fixture/reviews/→ When graded with the new ground truth → Then disagreement vs the all-caught human label is ≤ 2/25.Assumptions: Aliases above survive; if no alias set reaches ≤ 2/25, stop and report (fixture re-run is an owner decision).
AC-2: precision is not a false-positive rate
Verification: Unit Test
Scenario: Given a verdict with one planted-defect finding stated three times plus one real non-planted finding → When graded → Then planted share dedupes the restatements and the non-planted finding is not reported as a false positive.
Assumptions: Rename
gradePrecisionoutput toplanted share(keep the export name or alias it so the existing tests are updated, not skipped).AC-3: template-shaped verdict
Verification: Unit Test
Scenario: Given a verdict with
## QA Review for Issue #N+ Mode/Branch bullets and a ❌ row in the build/test table → WhenextractFindingsruns → Then neither becomes a finding, and ❌ rows inside the AC table still count.Assumptions: "AC table" is identified by its header row (an
ACfirst column), not by position.Implementation Plan
Phase 1: Fixture and ground truth
docs/investigations/qa-seeded-fixture/reviews/run-N.md(extract with the jq/awk command from the runner comment; re-grep for/Users/andadmarble/notes-fixture, strip).ground-truth.json: replaceidwithidentifiers: string[](caught if any appears). UpdatePlantedDefect/loadTruth; accept the oldidas a one-element list sosample-verdict.mdstill grades.scripts/analytics/qa-seeded-grade.test.ts: each defect needs at least one alias that occurs on exactly onedefects.patchline, or the test documents why not. Mutation-verify it.Phase 2: Grader
ISSUE_HEADINGmust not match## QA Review for Issue #N: drop the bareissues?from heading-level matching or exclude headings containingQA Review. Check against the five real reviews, not only a synthetic one (investigation(qa): seeded-defect ground truth — reconstruct the n=27 second-look study as data, build a planted-defect fixture, add recall AND precision graders #1067 hid this behind a hand-written sample).NOT_MET_ROWapplies only to rows of a table whose header's first cell starts withAC; ❌ rows in build/test tables are ignored.unmatchedcount listed rather than scored as false positives. Update module header comment and CLI output labels.Phase 3: Tests and docs
docs/investigations/qa-second-look-dataset.md) and the investigation(qa): seeded-defect ground truth — reconstruct the n=27 second-look study as data, build a planted-defect fixture, add recall AND precision graders #1067 AC-7 numbers to the re-graded result; define the new metric there (AC-2 Evidence).Design Review
scripts/analytics/qa-seeded-grade.tsand its fixture. No/qachange.defects.patchline 100 (would invalidate the fixture's recorded runs); a single=== "markdown"literal (0–1 hits per run).git log -S namesIdentifiershows only that PR, so this is its first fix, not a recurring class.ground-truth.jsonis read byloadTruth, the grader tests, the fixture README and the dataset doc.gradePrecision/extractFindingshave no other callers (grep before renaming).Rule Touchpoints
None triggered that bear on runtime code.
Feature Quality Planning
All standard checks pass. Notable:
SEQUANT_QA_GAPSJSON comment that repeats every defect; extraction must not count it (it is not in a list/table, so it is ignored today — keep a test).Open Questions
vi.mock+src/export.test.ts. Impact: ifsrc/export.test.tsis judged too weak (it also names the file in any test-gap finding), the metric has a false-catch risk; the human label is the check.precisionname as a deprecated alias? — Recommendation: rename outright (no other callers). Impact: low.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: Contained script and doc change, no UI. testgen skipped: the grader tests are specified above and are the work itself. Tell exec to skip the full
npm test(30-min wall) and run the named test files; CI runs the rest.Label Review
Current: qa. Recommended: qa, planned. Quality Loop: won't auto-enable.
admarble commentedon Oct 5, 2026
Runner note for QA (after exec, before
/qa)## Summary, because of investigation(run): the exec output handed to createPR was not exec's final message — PR #1310 got the placeholder body although exec ended with a full ## Summary #1311. All fourSEQUANT_MUTATIONmarkers parse asvalidwithparseMutationMarkers.export.test.tsorexport.ts:25appear in a finding that is not about that defect? For example, a finding about some other line of the test file. Construct one and see whether it scores.admarble commentedon Oct 5, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 3/3 met
Gaps:
src/export.test.ts(for example, "a typo in a describe name") is scored as catching the mock-test defect.export.ts:25is fine; the bug is in serve.ts:10" is scored as catching the format defect.src/serve.tsis scored as catching theexport.tserror defect."Markdown"(capital M) match the"markdown"alias. The same widening is also what lets run 4's "Empty catch" score as a catch.Suggestions:
export.test.ts, which is on 2 patch lines, passes. That is consistent with the restated rule, but say it in the doc.docs(#1313): name the alias false-catch modes QA's probes found; #1068 …
feat(#1313): investigation(qa): recalibrate the #1067 seeded-defect g…