Skip to content

investigation(qa): recalibrate the #1067 seeded-defect grader before #1068 (identifier choice, precision definition, heading noise) #1313

Closed

Description

@admarble

Tier: judgment Found: 2026-10-04, #1067 calibration (AC-6/7)

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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

  • AC-1: Each planted defect's identifier is a token a reviewer must write to describe it (the defect site, e.g. the comparison literal or a new function name), not a pre-existing helper name. Evidence: re-grading the five stored 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 reviews gives grader-vs-human disagreement ≤ 2 of 25, or the fixture is changed and re-run.
  • 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.

Non-Goals

  • Changing /qa.

Graph metadata

Activity

  1. added
    qa
    on Oct 5, 2026
  2. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    Upstream research note

    Where the four causes come from. They are #1067's design, and #1067 AC-7 existed to find them:

    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.

  3. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    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 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:

    jq -r 'select(.type=="assistant") | .message.content[]? | select(.type=="text") | .text' <file> | awk '/^## QA Review/{p=1} p'
    

    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.
    • export.ts:25: 3, 4, 5, 2, 3.
    • catch {: 1, 0, 0, 0, 1. Bare catch: 5, 5, 5, 6, 7.
    • 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):

  4. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (3 ACs, 3 directories)

    AC Quality Check

    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

    1. 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).
    2. 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.
    3. 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.

    Phase 2: Grader

    1. ISSUE_HEADING must not match ## QA Review for Issue #N: drop the bare issues? from heading-level matching or exclude headings containing QA 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).
    2. 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.
    3. 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

    1. 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.
    2. Update the grader section of the dataset doc (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

    1. Where does this belong? scripts/analytics/qa-seeded-grade.ts and its fixture. No /qa change.
    2. 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).
    3. Existing pattern / re-patch count? This grader was first written in 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 (PR feat(#1067): 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 #1308) and has not been patched since. git log -S namesIdentifier shows only that PR, so this is its first fix, not a recurring class.
    4. Reviewer challenge: "Aliases make the grader lenient, so isn't it tuned to these five reviews?" Answer: aliases are defect-site tokens plus file:line; document that the 0/25 result is in-sample and that investigation(qa): section leave-one-out ablation of /qa SKILL.md — which of 3,754 lines are load-bearing, measured on the seeded-defect fixture #1068 should hold out new runs.
    5. 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

    1. 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.
    2. 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.

    Label Review

    Current: qa. Recommended: qa, planned. Quality Loop: won't auto-enable.

  5. added
    planned
    on Oct 5, 2026
  6. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    Runner note for QA (after exec, before /qa)

    • The PR body was written by the runner from exec's final ## 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 four SEQUANT_MUTATION markers parse as valid with parseMutationMarkers.
    • 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.
  7. admarble commented on Oct 5, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

    AC coverage: 3/3 met

    Gaps:

    Suggestions:

    • 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.
  8. added a commit that references this issue on Oct 5, 2026
  9. added a commit that references this issue on Oct 5, 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

    plannedqa

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions