← Back to Pull requests

test(adapters/app): pin receiveWebhook's refusal texts and header guard, dedupe's capacity boundary and settings' unset-input omission (webhook.ts:35-56, dedupe.ts:15, settings.ts:37) #612

Closed
unknown closed this pull request without merging on Oct 29, 2026 15:36 UTC
View on GitHub
unknown unknown commented on Oct 29, 2026 06:38 UTC
Author

Test Improvement

One new file, __tests__/adapters/app/webhookGuards.test.ts (11 cases), for the GitHub App adapter #608 added. Nothing under src/, dist/, config or docs is touched.

Why. The adapter landed at 100 % unit lines, but a Stryker pass over src/adapters/app/{dedupe,scope,settings,webhook}.ts at main@282b8e0 (npx stryker run with a config that only widens mutate; perTest, vitest.mutation.config.mjs) scored 81.08 % — 21 of 111 mutants survived. Four of them change behaviour:

  • webhook.ts:35 — !id || !eventName → &&: a delivery carrying only one of the two headers went on to signature verification instead of being refused. The existing case removes both headers, where || and && agree.

  • webhook.ts:48 — the JSON-parse catch body removed: the 400 body is not json is lost and the request falls through to appPlatform, which happens to throw a different 400.

  • dedupe.ts:15 — ids.size > capacity → >=: the store forgets an id at exactly capacity. The existing case fills past capacity, where both comparisons evict.

  • settings.ts:37 — value !== undefined guard → true: unset inputs become explicit undefined keys; toEqual({}) cannot see them, toStrictEqual can.
  • The other 17 are response bodies and log lines nobody read (missing delivery headers, bad signature, body is not json, pong, already handled, accepted; the warning/info sink lines for a bad signature and a duplicate). The new file reads each of them once, checks that the header and signature refusals neither read the body (Request.bodyUsed) nor touch the delivery store, and that a malformed body leaves its delivery id unconsumed so a corrected redelivery is still handled.

    Re-run: 95.50 %, dedupe.ts / scope.ts / settings.ts at 100 %. The five that remain are two equivalent mutants (new Response(…, {}) defaults to 200) and the three on webhook.ts:65-66, which #611 claims — left alone.

    Files / cluster claimed — __tests__/adapters/app/webhookGuards.test.ts; src/adapters/app/dedupe.ts:15, settings.ts:37, webhook.ts:35-56,79. Disjoint from every held PR: #609 (src/platform/index.ts), #611 (src/server/*, webhook.ts:65, its own webhookNonErrorThrow.test.ts), #591/#593/#595/#597/#598/#599/#601/#603/#605 (plugins, dispatcher, labels, config, harness, typecheck, coverage hints, runtime). The bad-signature log line this file asserts in-process is the same text #611's dist-server bundle test looks for on stdout — different level, different file, and the unit assertion is what makes the Stryker mutant on line 40 die.

    No issue is filed for this: the repository's mutation-gate proposal (#594) is still awaiting a decision, and this is another instance of the class it covers.

    Testing

  • npx vitest run __tests__/adapters/app — 4 files, 42 passed

  • npx eslint __tests__/adapters/app/webhookGuards.test.ts — clean

  • npx stryker run over the four adapter files: 81.08 % → 95.50 %; each of the four behavioural mutants above is killed by the case named for it

  • npm run test:coverage at the base commit — 2525 passed, 99.88 % lines; the only branch misses are the four documented V8 await phantoms (close.ts:37, reopen.ts:34, approve.ts:502, auth.ts:224, negative BRDA counts) and the arms #609/#611 claim
  • ---
    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: 435 lines (+326 / -109) across 5 files Reviewer: jeefy Review duration: 537m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 435 lines diff across 5 files
    0.45
    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.364
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #612"
    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: 45.2% (MEDIUM) · Higher = larger blast radius
    45.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: 17.9% · Safe to merge
    17.9%