← Back to Pull requests

test(bundle): drive the repoHasOwners/defaultBranch fallback of approve and the tide gate through dist/index.js #369

Closed
unknown closed this pull request without merging on Oct 09, 2026 01:32 UTC
View on GitHub
unknown unknown commented on Oct 07, 2026 19:45 UTC
Author

Test Improvement

Adds __tests__/bundle/defaultBranchFallback.test.ts (one new file; no change to helpers.ts, fakeGithub.ts, runBundle.ts, source or dist/). It drives the committed dist/index.js against the fake GitHub through the arm both OWNERS consumers take when no base branch is in scope, which falls to src/utils/owners.ts repoHasOwners → defaultBranch:

approve.ts:504 — pull_request synchronize whose payload carries no pull_request.base.ref

  • repository.default_branch present: approve probes GET …/git/trees/master?recursive=true with no repos.get read; approve: the base branch has no OWNERS files, exit 0

  • repository.default_branch removed too: GET /repos/Codertocat/Hello-World → { default_branch: 'trunk' }, then GET …/git/trees/trunk?recursive=true

  • that read answers 500: exit 1, ::error:: carries could not read the default branch, no branch tree is probed (owners-label's trees/basesha listing is the only tree read)
  • tide.ts:543 — pull_request labeled lgtm by a human, GET …/pulls/1 returning no base.ref

  • payload default branch: [bind, pulls/1, trees/master, commit status, graphql, merge], merged pr #1

  • payload names none: [bind, pulls/1, GET /repos/…, trees/trunk, commit status, graphql, merge], merges

  • repos.get 500: exit 1, could not read the default branch, no tree probe and no PUT
  • Evidence (main @ 3fc21f2, Node v26.10.0, vitest 5.0.3, vitest run --coverage --coverage.reporter=lcovonly --config vitest.e2e-coverage.config.mjs __tests__/bundle):

  • src/utils/owners.ts e2e lines 75 → 82 of 112 (DA:283,0 … DA:358,0 → DA:283,6 DA:349,6 DA:350,6 DA:351,2 DA:354,4 DA:355,4 DA:358,2)

  • approve.ts BRDA:504 fallback arm 0 → 3; tide.ts BRDA:543 base === undefined arms 0 → 3

  • bundle suite 142 → 148 tests, all green; npx eslint and npx tsc --noEmit clean

  • unit coverage of these lines was already 100 % (__tests__/utils/owners.test.ts); the two reports are stated separately per #235
  • Cluster claimed: owners.ts repoHasOwners/defaultBranch via approve.ts:504 and tide.ts:543. Disjoint from the held OWNERS PRs: #320 (probeOwners/probeBranchOwners truncated-tree arms — its body leaves this path out by name), #328/#331 (pullRequestOwners, issue-side fallback), #365 (parseOwners filters), #283 (root-OWNERS authorization), #333/#363 (approve evaluation arms, syncApprovalReview), #322/#347 (tide merge-queue and verdict arms).

    Related Issue


    Closes #368

    ---
    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: 335 lines (+251 / -84) across 4 files Reviewer: jeefy Review duration: 1787m
    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 · 335 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.348
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #369"
    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.2% (MEDIUM) · Higher = larger blast radius
    42.2%
    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%