← Back to Pull requests

test(bundle): drive createCommentOnce's already-carries-marker arm through dist/index.js #349

Closed
unknown closed this pull request without merging on Oct 08, 2026 01:58 UTC
View on GitHub
unknown unknown commented on Oct 06, 2026 12:35 UTC
Author

Test Improvement

Adds __tests__/bundle/commentOnce.test.ts (3 tests, new file only — no production, dist/, helpers.ts, fakeGithub.ts or config change), driving src/utils/comments.ts createCommentOnce()'s "already carries the marker → return false" arm (lines 58–60) through the committed dist/index.js via both of its callers:

  • pull_request labeled lgtm by a bot, lgtm not bound (src/plugins/lgtmBinding.ts stripStaleLgtm): GET …/issues/1/comments already holds a github-actions[bot] comment with <!-- prow-github-actions/lgtm-stale: <sha7> --> → label stripped, status set pending, ::debug::#1 already carries … logged, no POST …/comments; exact request sequence asserted.

  • counter-case: the same marker quoted by a type: User comment, plus a bot marker for a different head → neither counts, the explanation is posted once with the marker.

  • lgtm cron, fork pr refused 403 over workflow files (src/plugins/tide.ts explainForkWorkflows): GET …/issues/2/comments already carries <!-- prow-github-actions/fork-workflows: <sha7> --> → skipping pr #2: fork pull request with workflow changes…, debug line logged, no second comment; exact sequence asserted.
  • Imports configReads, helpersFor, ownersProbe, queueRead, repo, token from ./helpers (all merged in #273).

    Coverage (npm run test:coverage:e2e, main @ 3fc21f2, Node v26.10.0, vitest 5.0.3)

    | file | before | after |
    |---|---|---|
    | src/utils/comments.ts | 70 % lines (uncovered 34, 59–60) | only 34 uncovered (that is createComment's throw, driven by held #244) |

    Unit coverage of the file was already 100 %; this is end-to-end-only evidence.

    Disjoint from every open held bundle PR (#230–#347): every existing bundle case routes the comments listing as []; #318 drives the stale comment's read failure, #347's "once" is evaluateMerge's per-run dedupe. npx vitest run __tests__/bundle/commentOnce.test.ts → 3/3; npx eslint clean; npx tsc --noEmit clean.

    Related Issue


    Closes #348

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

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

    Diff: 273 lines (+204 / -69) across 3 files Reviewer: jeefy Review duration: 2242m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 273 lines diff across 3 files
    0.40
    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.336
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #349"
    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: 39.5% (MEDIUM) · Higher = larger blast radius
    39.5%
    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: 15.6% · Safe to merge
    15.6%