← Back to Pull requests

test(bundle): drive /label-sync's missing-number guard and already-in-sync report through dist/index.js (src/issueComment/labelSync.ts:20-21,32,35) #621

Closed
unknown closed this pull request without merging on Oct 30, 2026 00:05 UTC
View on GitHub
unknown unknown commented on Oct 29, 2026 21:40 UTC
Author

Test Improvement

Two test files under __tests__/bundle/; nothing under src/, dist/, docs or config.

  • __tests__/bundle/missingNumberGuards.test.ts — one matrix row: /label-sync on a comment without an issue number fails naming the guard (src/issueComment/labelSync.ts:20-21). It was the only slash command missing from the 17-row matrix.

  • __tests__/bundle/labelSyncCommandInSync.test.ts — a collaborator's /label-sync against a repository the job already brought into line: the comment is exactly label-sync: created 0, updated 0, unchanged N. with neither Created: nor Updated: line (labelSync.ts:32,35 false arms), stdout reports created 0 [], updated 0 [], unchanged N, failed 0, and nothing is written to the labels API. The repository is seeded from the POST /labels bodies of a first sync run through the same bundle, so the test holds no copy of the built-in label catalog that could drift from the bundle's.
  • Why. Every bundle /label-sync scenario so far starts from a repository missing labels, so the comment always carries a Created: line; the report a maintainer sees when the job has nothing to do was never produced end to end. Unit coverage of the file is 100 %, the bundle run had DA:21,0 and zero-count BRDA records for lines 20, 32 and 35 (CI artifact coverage-e2e-96433268…, run 40928440920).

    Files / cluster claimed — src/issueComment/labelSync.ts's end-to-end coverage only; __tests__/bundle/missingNumberGuards.test.ts and the new file. Disjoint from the cronJobs/labelSync.ts sync-algorithm scenarios (labelSyncCatalog, labelSyncFailureArms, labelSyncNullDescription, labelSyncUnprefixedAllowlist) and from everything else in flight.

    Testing

    At 36aecfa (rebased onto main@4f97e30, after #611 and #619):

  • npx vitest run __tests__/bundle/labelSyncCommandInSync.test.ts __tests__/bundle/missingNumberGuards.test.ts — 2 files, 20 passed

  • npm run test:coverage:e2e (at 9643326, before the rebase) — 92 files, 550 passed; branches 1702/1714 → 1705/1714, lines 2489/2494 → 2490/2494; src/issueComment/labelSync.ts leaves the uncovered table, exit 0

  • npx eslint on both files and npm run typecheck — clean

  • each test fails without its arm, with dist/ rebuilt via tsc && ncc build --no-cache: issueNumber === undefined made unreachable → the matrix row fails (not a collaborator debug line, exit 0 instead of the guard); result.created.length > 0 → >= 0 → the in-sync test fails on the comment body (Created: line appears)
  • Related Issue


    Closes #620 — both boxes of the finding are in this PR.

    ---
    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: 345 lines (+258 / -87) across 4 files Reviewer: jeefy Review duration: 145m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 345 lines diff across 4 files
    0.42
    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.350
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #621"
    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: 42.4% (MEDIUM) · Higher = larger blast radius
    42.4%
    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: 16.7% · Safe to merge
    16.7%