← Back to Pull requests

test(bundle): drive parseProwConfig's schema rejections through dist/index.js #339

Closed
unknown closed this pull request without merging on Oct 09, 2026 01:29 UTC
View on GitHub
unknown unknown commented on Oct 06, 2026 02:07 UTC
Author

Test Improvement

Adds __tests__/bundle/configSchemaArms.test.ts (new file only; imports comment, repo, token from ./helpers, start from ./fakeGithub, runBundle) — 28 runs of /kind cleanup through the committed dist/index.js against fakeGithub, each routing a different .github/prow.yaml so that parseProwConfig in src/utils/config.ts rejects it. Arms reached:

  • parseProwConfig / normalizeSection / normalizeValues (L327, 405, 421, 426): a scalar top level, a scalar legacy section, a { exclusive } mapping without values, a numeric value, a color with a leading #

  • normalizeRequireMatchingLabel (L433–468): not a list, non-mapping rule, non-string regexp, non-compiling regexp, empty missing_label, non-boolean prs, non-string missing_comment

  • normalizeTide (L488–506): not a mapping, empty label name in labels, non-string in missing_labels (also reaches isStringList/isLabelList at L692/696), unknown merge_method, non-boolean merge_on_events, unknown merge_queue

  • normalizeBlunderbuss (L532–551): not a mapping, request_count 0, max_request_count below request_count, non-boolean ignore_drafts, non-string in ignore_authors

  • normalizeApprove (L567, 572) and normalizeLgtm (L581, 585): not a mapping, non-boolean flag

  • the unknown-top-level-key debug (L370): one green run where unknown_plugin: sits next to a labels mapping, /kind cleanup still applies
  • Every rejection asserts exit 1, a could not get labels from yaml: Error: Codertocat/Hello-World:.github/prow.yaml: <field> … error annotation (or the <section>: … message for label sections, whose errors do not carry the source), and no POST /issues/1/labels.

    Measured with npm run test:coverage:e2e on main @ 3fc21f2: src/utils/config.ts e2e lines 68.78 % → 82.92 %; all files 77.9 % → 79.21 % lines, 70.82 % → 73.98 % branches. The remap still lists L327, L377–379 and L431–433 as unhit although the asserted messages prove those statements ran — they are multi-line statements, and the tsc+webpack map credits only their first line; noted so nobody chases them. npx eslint and tsc --noEmit clean on the new file; the suite is 28 tests / ~8 s.

    Disjoint from the held PRs touching this file: #314 (__tests__/bundle/explicitConfigSource.test.ts, source tiers L206–282), #293 (holdSweepSettings.test.ts, normalizeHold/normalizeSweep L519–527/592–612). fetchUrl (L288–301) is left out for the reason #314 gives.

    Related Issue


    Closes #338

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

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

    Diff: 332 lines (+249 / -83) across 4 files Reviewer: jeefy Review duration: 4282m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.65) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.65 · 332 lines diff across 4 files
    0.65
    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%
    56%
    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.347
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.065
    Real PR Conversation Timeline
    1 comments
    "Review active on #339"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed sensitive_module
    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: 65.3% (HIGH) · Higher = larger blast radius
    65.3%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 28.2% · Safe to merge
    28.2%