← Back to Pull requests

test(coverage): guard the v8-ignore hints in src/ so each ignored arm keeps the unit test it names #601

Closed
unknown closed this pull request without merging on Oct 29, 2026 15:37 UTC
View on GitHub
unknown unknown commented on Oct 27, 2026 21:25 UTC
Author

Test Improvement

Adds __tests__/coverageIgnoreHints.test.ts, a static guard over the 25 / v8 ignore / hints in src/ (7 ignore next arms, 6 start/stop test-only hook blocks, 11 files at main @ 9acb046). Each arm-level hint says <name>.test.ts drives it, but @vitest/coverage-v8 honours the hint in the unit run as well as the bundle run (same provider, no option to disable source hints), so neither floor can see the named test disappear: with configBlunderbussDelay.test.ts and configSweep.test.ts excluded, npm run test:coverage still passes every threshold and reports config.ts at 100 % lines with neither 619 nor 679 listed. Details and the reproduction in #600.

The guard asserts, for every hint:

| rule | catches |
|---|---|
| a -- reason follows the hint (a bare stop is exempt; its reason is on the start) | an unexplained ignore |
| an ignore next names <name>.test.ts drives it, the file exists under __tests__/, and it imports the hinted module (from '../../src/utils/config') | the cited test being deleted, renamed, or moved off the module |
| src/labels/lgtm.ts:68, whose hint names no test, is recorded in a one-entry table (__tests__/label/lgtm.test.ts:796 drives it through handleIssueComment; the comment text ships into dist/index.js, so naming it in the hint means repacking); the table is itself checked | a stale table entry once the hint is updated, or the driver file vanishing |
| every start has a stop in the same file, says test-only hook, and each export function between them is called by some test | a hook kept ignored after its last caller is gone |

No src/, dist/, config or docs file is touched.

Files / cluster claimed — one new file, __tests__/coverageIgnoreHints.test.ts (reads src/*/.ts and __tests__/*/.ts; imports only root from __tests__/utils/workflowYaml.ts). Disjoint from every held PR: #591/#593/#597 (plugin, dispatcher and label unit tests), #595 (__tests__/setup.ts, config type guards), #596 (bundle scenario + e2e floor), #598 (__tests__/testUtils.ts, fixture ordering), #599 (tsconfig.test.json, existing-test type fixes). docs/contributing.md is deliberately left alone because four of those PRs edit it; the file's header comment carries the rationale.

Testing

  • npx vitest run __tests__/coverageIgnoreHints.test.ts — 39 passed

  • fault injection, each restored afterwards: configBlunderbussDelay.test.ts moved away → config.ts:619 names the unit test that drives the ignored arm fails; an uncited / v8 ignore next -- probe / appended to sleep.ts → sleep.ts:13 names the unit test … fails; resetLabelCache renamed → labeling.ts:91 is a test-only hook, exported and called from a test fails; lgtm.test.ts drives it added to lgtm.ts:68 without dropping the table entry → records out-of-hint drivers only for hints that still exist and still name no test fails

  • npx vitest run — 192 files, 2512 passed, 75 skipped

  • npx eslint __tests__/coverageIgnoreHints.test.ts — clean; tsc --noEmit --strict on the file — clean
  • Related Issue


    Closes #600

    ---
    Filed by quality agent (hold-gated mode). Human review required.

    — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

    Diff: 410 lines (+307 / -103) across 5 files Reviewer: jeefy Review duration: 2531m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 410 lines diff across 5 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.360
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #601"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.9% (MEDIUM) · Higher = larger blast radius
    49.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.7% · Safe to merge
    19.7%