← Back to Pull requests

test(bundle): drive /approve's membership-mode review failures and no-review cancel through dist/index.js #355

Closed
unknown closed this pull request without merging on Oct 09, 2026 01:30 UTC
View on GitHub
unknown unknown commented on Oct 06, 2026 18:47 UTC
Author

Test Improvement

Adds __tests__/bundle/approveMembershipArms.test.ts (new file only; helpers.ts, bundle.test.ts, fakeGithub.ts, source and dist/ untouched). Five issue_comment runs through the committed dist/index.js against the fake GitHub, on a pull request whose repository has no OWNERS files so /approve falls back to org membership and a bot GitHub review — the failure arms of src/issueComment/approve.ts the bundle suite never reached:

| run | GitHub's answer | expected |
|---|---|---|
| /approve by an org member | POST …/pulls/1/reviews 500 | exit 1, could not create review (L82); body {event:'APPROVE', comments:[]} |
| /approve cancel | GET …/pulls/1/reviews 500 | exit 1, could not remove latest review: Error: could not list reviews for PR 1 (L67, L160) |
| /approve cancel | listing with no bot APPROVED review (user review, bot DISMISSED, bot COMMENTED) | exit 1, no latest review found to cancel (L173), no dismissal |
| /approve cancel | PUT …/reviews/12/dismissals 500 | exit 1, could not dismiss review (L185); dismissal message names the commenter |
| /approve by a stranger (members 404, collaborator 404) | POST …/issues/1/comments 500 | exit 1 with three ::error:: lines in order: the refusal, Could not comment with an auth error: Error: could not add comment: HttpError: boom (L131), and the dispatcher's wrap of the refusal |

Each test asserts the exact request sequence via expectCommandThenConfig: the OWNERS/membership reads, the command's own calls, then the post-command sweep (config reads, GET pulls/1, base-branch OWNERS probe, merge-queue query), which still runs after the failure.

Cluster: src/issueComment/approve.ts L67, 82, 131, 160, 173, 185. Disjoint from the held bundle PRs — #343 claims L44 (missing issue number) and #333 claims L96 (require_self_approval); #286 drives approve.github_review, which is the OWNERS-mode mirror, not this path.

Evidence (main @ 3fc21f2, Node v26.10.0, vitest 5.0.3)

| suite | issueComment/approve.ts lines | branches |
|---|---|---|
| unit (npx vitest run --coverage) | 51/51 | — |
| e2e before (npm run test:coverage:e2e) | 43/51 | 19/26 |
| e2e with this PR | 49/51 | 20/26 |

Remaining e2e-missed: L44 (#343) and L96 (#333). Whole-bundle e2e: 77.90 % → 78.24 % lines. npx eslint clean; 5/5 pass in ~1.3 s.

Related Issue


Closes #354

---
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: 319 lines (+239 / -80) across 3 files Reviewer: jeefy Review duration: 3283m
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 · 319 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.345
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #355"
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.4% (MEDIUM) · Higher = larger blast radius
40.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.0% · Safe to merge
16.0%