← Back to Pull requests

test(bundle): drive tide's verdict arms (unknown-retry exhaustion, moved head, 405/409 refusals, merged/closed/locked, check_suite guards, once-per-run) through dist/index.js #347

Closed
unknown closed this pull request without merging on Oct 09, 2026 17:59 UTC
View on GitHub
unknown unknown commented on Oct 06, 2026 10:47 UTC
Author

Test Improvement

Adds __tests__/bundle/tideVerdictArms.test.ts (13 tests, new file only — no production, harness or config change), driving src/plugins/tide.ts's verdict arms through dist/index.js against the fake GitHub:

  • fetchMergeability: mergeability still unknown after the 1 s / 2 s / 4 s retries → skipping pr #1: not mergeable (unknown) (lines 99, 108–111)

  • a head that moves while mergeability is computed → head moved during evaluation (208)

  • a merge refused with 405 once a concurrent event merged it → pr #1 was merged concurrently, exit 0 (219)

  • a merge refused with 409 → base branch moved / head moved (223, both regex arms)

  • a refused merge whose re-read fails too → could not merge pr #1: …, run fails (439)

  • blockedReason: a pull request GitHub reports as already merged, closed, locked, skipped before its binding or mergeability is read (399, 402, 405)

  • tideOnComment on a closed pull request after /hold (496–497)

  • tideOnCheckSuite without a head sha (520) and naming no pull request with the listing finding none (564–565)

  • evaluateMerge once: schedule with jobs: 'sweep lgtm' merges the shared pull request once and the other job skips it as already evaluated in this run (175)
  • check_suite with pull_requests: [{ number: 1 }] is the vehicle for the merge-path arms: tide is its only handler, so every recorded request is tide's and the sequences are asserted exactly (including the one POST /graphql dequeue check a gate skip makes on an event, since tide.merge_queue defaults to auto).

    Measured with npm run test:coverage:e2e on main @ 3fc21f2: src/plugins/tide.ts 158/195 → 173/195 lines from __tests__/bundle alone. npx vitest run __tests__/bundle/tideVerdictArms.test.ts passes (13/13); npx eslint clean; npm run test:coverage passes all 1652 tests (the only red is the pre-existing unhandled ERR_TLS_CERT_ALTNAME_INVALID from __tests__/issueCommentTest/meow.test.ts, tracked in #294 and fixed by #287).

    Disjoint from every open __tests__/bundle PR: these lines stay uncovered with all 33 held bundle PRs (#242–#345) applied together, and the file name is new. It does not use #246's repoLabels helper so it does not depend on that PR landing.

    Related Issue


    Closes #346

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

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

    Diff: 304 lines (+228 / -76) across 3 files Reviewer: jeefy Review duration: 4751m
    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 · 304 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.342
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #347"
    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: 40.1% (MEDIUM) · Higher = larger blast radius
    40.1%
    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.9% · Safe to merge
    15.9%