Skip to content

test(skills): convert execute-class prose gates to run the skill's command; delete checksum-class gates per the F-11 table and D-3 #1512

Closed

Description

@admarble

Epic: graph-2026-10-fundamentals Tier: judgment Execution: sequant_run Blocked by: #1511, D-3 on #1501

Problem

F-11's table names which of the 76 prose-gate files test behaviour (execute), which guard a parsed contract (keep), and which only check that words are present (checksum). This node converts the execute class to run the command the row names and deletes the checksum class, subject to D-3. Tests live under src/, scripts/, __tests__/; no skill file is edited, so the plugin freeze is not touched. The CLAUDE.md rule still binds: a converted gate is a test that gates a claim and ships with its mutation record.

Acceptance Criteria

  • AC-1: The prose-gate count falls to keep + execute. Evidence: k=$(grep -oE '^\*\*Totals:\*\* execute ([0-9]+), checksum ([0-9]+), keep ([0-9]+)' docs/internal/graph-2026-10-fundamentals/prose-gates.md | grep -oE '[0-9]+' | awk 'NR==1{e=$1} NR==3{k=$1} END{print e+k}'); n=$(npx tsx scripts/qa/health-report.ts --json | jq .proseGate.files); [ "$n" -le "$k" ] && echo "ok $n<=$k" → ok N<=K
  • AC-2: Every execute-class file now spawns the command it names. Evidence: grep -E '^\| (src|scripts|__tests__)/.*\| execute \|' docs/internal/graph-2026-10-fundamentals/prose-gates.md | awk -F'|' '{gsub(/ /,"",$2); print $2}' | xargs grep -LE 'execSync|spawnSync|execFileSync' | wc -l | tr -d ' ' → 0
  • AC-3: No skill directory is touched (I-1). Evidence: git diff --name-only $(git merge-base origin/main HEAD)..HEAD | grep -cE '^(plugin/|\.claude/skills/|templates/skills/)' → 0
  • AC-4: Every converted gate carries a mutation record. Evidence: gh pr view --json body --jq .body | grep -c 'SEQUANT_MUTATION' → ≥ <execute total>
  • AC-5: The suite is green. Evidence: gh pr checks --json name,state --jq '[.[] | select(.name=="test") | .state] | unique' → ["SUCCESS"]
  • AC-6: The baseline moves down with the PR. Evidence: jq '.proseGate.lines < 30461' scripts/qa/health-baseline.json → true

Prior fixes / producers

Class tracked in #1511 and #1068. Producers of the gates: skill PRs under the mutation rule; this node changes tests only.

May touch

The test files F-11 lists (convert or delete), fixtures they need under __tests__/fixtures/, scripts/qa/health-baseline.json (I-4), CHANGELOG entry.

Non-Goals

  • Any file under plugin/, .claude/skills/, templates/skills/ (I-1).
  • Deleting any keep-class gate.
  • Changing the CLAUDE.md mutation rule (D-3 scopes which tests it binds; it does not edit the rule).

Done when

Every remaining prose gate either runs the skill's command or guards a parsed contract, and the suite is green.

Activity

  1. added
    graph-2026-10-fundamentals
    on Oct 18, 2026
  2. admarble commented on Oct 19, 2026

    @admarble
    ContributorAuthor

    Runner context, 2026-10-19, before launch (fundamentals W2, beside #1504 and #1509; judgment tier, all phases on Opus; stop-at-PR). main = 23a60b3.

    Inputs:

    Watch AC-6:

    For every phase, and the qa phase by name: run the full suite at most once, in the foreground, under timeout, after a WIP commit. Each MCP-dispatched phase has a 30-minute wall. Prefer the targeted npx vitest run <files> for the ACs.
    CHANGELOG: add [Unreleased] lines under the existing ### Added / ### Changed headings, not changelog.d/ fragments, and never add a second heading of the same name.
    Lint: #1503 made no-unused-vars, no-empty-object-type and prefer-const errors, and knip counts unused exports. Don't export what nothing imports.
    Health baseline: regenerate scripts/qa/health-baseline.json (npx tsx scripts/qa/health-report.ts --write-baseline) only to record a metric that went down. If npm run lint:health reports a rise, restructure so it holds. Otherwise leave the baseline alone and name the rise in the PR body. Owner ruling: a proseGate.lines rise caused by tests in files that mention SKILL.md only as a path may be absorbed, and must be said so.
    Freeze: nothing under plugin/, .claude/skills/ or templates/skills/.

  3. admarble commented on Oct 19, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (6 ACs, 5 directories)

    AC Quality Check

    I ran each Evidence command against main (23a60b3):

    • AC-1 fails today as it should (n=76, k=65).
    • AC-6 fails today as it should (false, baseline 30,751).
    • AC-2 passes vacuously for 4 of the 12 files. behavior-rule-qa-wiring, behavior-rule-spec-wiring, qa-markdown-only-ci-snippet and stacks.no-npm-fallback-gate already contain execSync/execFileSync. They run a hand-copied snippet, not the skill's own text. The grep also accepts the token inside a comment. Tightening: each AC-4 mutation must edit the SKILL.md fence (not the test). That record is what proves the test runs the skill's own text, so AC-4 carries the real weight for these 4 files.
    • AC-4 names ≥ <execute total>. Read this as ≥ 12.

    Scope Assessment

    Non-Goals: present (no skill dirs, no keep-class deletion, no CLAUDE.md rule change).

    Metric Value Status
    Feature count 2 (convert 12, delete 11) ⚠️
    AC items 6 ✅
    Files touched ~25 tests + 1 helper + baseline + CHANGELOG ⚠️

    Verdict: ⚠️ SCOPE_WARNING. The work is wide but mechanical, so the quality loop is on.

    AC-6 projection: the 11 checksum files total 1,182 lines, so deleting them gives 30,751 − 1,182 = 29,569 < 30,461. That leaves ~890 lines of headroom for net growth in the 12 converted files. Keep the shared harness out of *.test.ts files and the headroom holds.


    Acceptance Criteria

    AC-1: prose-gate count ≤ keep + execute (65). Verification: Integration (health-report). Scenario: after deleting the 11 files → proseGate.files = 65.
    AC-2: each of the 12 execute files spawns the command its row names. Verification: Integration. Assumptions: the spawn token is in the test file itself, because a helper-only spawn fails the grep (see Plan).
    AC-3: zero files changed under plugin/, .claude/skills/, templates/skills/. Verification: git diff. Mutations edit the skill and then restore it, so nothing reaches a commit.
    AC-4: ≥ 12 SEQUANT_MUTATION markers, one per converted file. failedTest starts with the file path. Each mutation edits the extracted fence in SKILL.md. Under D-3, deletions need no record.
    AC-5: the test check is SUCCESS. Verification: CI.
    AC-6: baseline proseGate.lines < 30461. Regenerate the baseline with --write-baseline only once the metric has gone down. If it misses, report the number and do not pad the deletions.


    Implementation Plan

    Phase 1: Delete the checksum class (11 files, src/lib/__tests__/)

    1. Before each delete, open the skill section the file reads (F-11 Re-read finding). Delete these 11: adr-convention, evidence-clause-skill, exec-pr-body-edit-skill, improve-tech-debt-scoring-skill, merger-named-set-boundary-skill, qa-review-dimensions-skill, qa-sibling-scan-skill, qa-verdict-comment-skill, release-skill-soak, testgen-skill, testgen-testing-pyramid-skill. adr-convention also checks docs/adr. Keep the non-skill ADR checks by moving them to a small test that has no SKILL.md mention. Delete only the spec-skill span.

    Phase 2: Shared fence extractor

    1. Add __tests__/helpers/skill-fence.ts (not a test file, so the metric does not count it). Its one export is skillFence(skill, headingOrAnchor, contains). It returns the fenced block's text from .claude/skills/<skill>/SKILL.md and throws when no block or more than one block matches. A missing fence must fail loudly, not skip. Tests call spawnSync/execFileSync themselves on the text it returns. That keeps the spawn in the test file for AC-2, and the helper does no spawning.
    2. Rewrite exactly one thing in the extracted text: npx sequant → node <repo>/dist/bin/cli.js, matching locks-cli.integration.test.ts. Do not rewrite anything else, or the test runs a copy again.

    Phase 3: Convert the 12 execute files (three groups, per the F-11 findings)

    1. Checkout lock (fullsolve-, merger-, release-checkout-lock): run the extracted acquire, then release, in a temp git repo with SEQUANT_LOCKS_DIR set to a temp dir. Assert exit 0 and that the lock file appears and is then removed.
    2. Hand-copied tsx -e (behavior-rule-qa-wiring, behavior-rule-spec-wiring, qa-markdown-only-ci-snippet): replace the copied snippet constant with skillFence(...). Keep the existing fixtures and assertions.
    3. Single commands:
      • worktree-contract: worktree verify <missing> --issue N → exit 1.
      • assess-skill: run <N> --dry-run (see OQ-2).
      • stacks: the lockfile [ -f ... ] chain in temp dirs, one per lockfile.
      • exec-foreground: the perl alarm with 1 on sleep 5 → killed.
      • loop-context-source: the extracted jq select on a sample comments JSON.
      • release-security-table: the extracted grep -qE on a fixture SECURITY.md and package.json, run both positive and negative.
    4. In these 12 files, delete the checksum assertions that the executed fence now covers (D-3). Leave unrelated phrase checks alone.

    Phase 4: Records and metrics

    1. WIP commit. For each converted file: break its fence in .claude/skills/<skill>/SKILL.md, run npx vitest run <file>, confirm only that file fails, run git checkout -- .claude/skills. Record the marker in the PR body.
    2. Run the full suite once, in the foreground, under timeout. Run npm run lint:health, regenerate the baseline (the metric went down), then npm run lint and knip. Add a CHANGELOG [Unreleased] → ### Changed line.

    Design Review

    1. Where does this logic belong? In the test layer only. The extractor is a test helper under __tests__/helpers/, not src/lib, because nothing in production reads skill fences.
    2. What's the simplest correct approach? One extractor plus a per-file spawnSync. Rejected: a helper that both extracts and spawns. It would fail AC-2's grep and hide each command behind a wrapper. Rejected: fixing the 4 vacuous files with only a grep tweak, which leaves the copy drift in place.
    3. What pattern does this follow, and how often has it been re-patched? It follows the fix(#1276): /qa §6i counts changed CI workflow files as gate-test files #1290 pattern (extract from the skill, run real tools), which in-place-checkout-skill (entryBlock), release-plugin-validate-skill and verify-skill-guard already use. Each of those three has its own private extractor. This PR adds a shared one, and those three keep theirs (out of scope; follow-up candidate). Class tracked in investigation(test): classify the 76 prose-gate test files — execute, checksum or keep — with the command each execute-class gate should run #1511 and 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. No prior re-patches of this extraction.
    4. What would a senior reviewer challenge? "npx sequant rewritten = still a copy?" It is one documented token substitution, and the mutation record proves a SKILL.md edit fails the test. "Lock test touching the real checkout lock?" No: SEQUANT_LOCKS_DIR plus a temp repo.
    5. Producers and consumers.
      • Fence text: produced by the three mirrored skill dirs (parity enforced by check-skill-sync). Consumed by the new tests, which read .claude/skills only.
      • proseGate metric: produced by collectMetrics (scripts/qa/health-report.ts). Consumed by lint:health, the baseline, and AC-1/AC-6.
      • The F-11 table: consumed by the AC-1/AC-2 evidence. It must not be edited, or the evidence drifts.

    No ADR needed: there is no design fork beyond the rejected alternatives above.


    Feature Quality Planning


    Open Questions

    1. Trim checksum phrases inside the mixed keep files (fullsolve-merge-gate ~20, spec-design-review ~18, …)? Recommendation: no. It is not required, and the Non-Goals protect keep files. Impact if wrong: a follow-up issue.
    2. assess-skill run --dry-run: if dry-run calls gh (CI has no auth for this), use a non-network form of the same extracted line, or report that the file cannot be converted. Recommendation: confirm first with node dist/bin/cli.js run 1 --dry-run offline. Do not reclassify silently, since AC-2 counts all 12.
    3. Which mirror to read? Recommendation: .claude/skills only. Mirror parity is check-skill-sync's job.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: enabled
    Reasoning: The work is tests only, so testgen has nothing to stub ahead of time. ~25 files and 12 mutation records justify the loop.

    Label Review

    Current: graph-2026-10-fundamentals. Recommended: add planned. The quality loop is enabled through the marker, not a label.

  4. added
    planned
    on Oct 19, 2026
  5. admarble commented on Oct 19, 2026

    @admarble
    ContributorAuthor

    QA Verdict: NEEDS_VERIFICATION

    AC coverage: 5/6 met

    Gaps:

    • PR conflicts with main in health-baseline.json so CI never ran; AC-5 cannot be verified
    • Helper header comment is inaccurate about spawning

    Suggestions:

    • skill-fence.ts says in its header that "This module never spawns anything", but makeDiffRepo spawns git. The comment should say only the skill command is spawned in the test file.
    • The baseline's commit field points at the WIP commit 3fb2041, not HEAD. It gets regenerated during the conflict fix anyway.

    Pending ACs:

    • AC-5
  6. added 2 commits that reference this issue on Oct 19, 2026
  7. admarble commented on Oct 19, 2026

    @admarble
    ContributorAuthor

    Execution Verification (runner, 2026-10-19), PR #1565 @ f038400

    After merging main (through #1558), the runner re-ran the ACs verbatim:

    • AC-1: ok 63<=65
    • AC-2: 0
    • AC-3: 0
    • AC-4: 12
    • AC-6: true (proseGate.lines 29,533)
    • Lint green. All 15 test files the PR adds or changes pass (238 tests).

    AC-5 (CI) is pending.

    Mutation repeated (one of the 12): dropping --issue=<issue-number> from fullsolve's release fence at line 389 fails release site 1 frees both locks taken by the Phase 0.3 acquire fences. The skill edit was restored and never committed.

    QA's doc finding is fixed: the skill-fence.ts header names the git spawn in makeDiffRepo.

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

    graph-2026-10-fundamentalsplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions