← Back to Pull requests

[History Server] Replace private getter assertions with BuildSnapshot() in history server unit tests #4949

Open
dalaoqi opened this pull request with 38 lines diff across 1 files
View on GitHub
dalaoqi dalaoqi commented on Jun 24, 2026 17:08 UTC
Author

Why are these changes needed?


The unit tests asserted on internal state via the private getters getActorsMap, getJobsMap, and getNodeMap, coupling the tests to implementation details. Since BuildSnapshot() is the only exported accessor and is the single source of truth for what we serve, the tests now assert on the snapshot's Actors, Jobs, and Nodes fields instead.

Related issue number

Closes #4937

Checks

  • I've made sure the tests are passing.

  • Testing Strategy

  • - [x] Unit tests
    - [ ] Manual tests
    - [ ] This PR is not tested :(

    Diff: 38 lines (+21 / -17) across 1 files Reviewer: JiangJiaWei1103 Review duration: 149749m
    All Vouch review confidence checks passed
    Residual risk 0.06 = Change Risk (0.32) × (1 − Review Confidence (0.82)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.32 · 38 lines diff across 1 files
    0.32
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.77 · 2 substantive comment(s)
    0.77
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    82%
    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.219
    Real PR Conversation Timeline
    6 items
    JiangJiaWei1103 JiangJiaWei1103 approved these changes on Jun 28, 2026 05:10 UTC
    Approved Reviewer

    LGTM, thanks for contribution!

    nit (non-blocking): Could bind snap := h.BuildSnapshot(clusterInfo) once and read snap.Actors[id] / snap.Jobs[id] / snap.Nodes off it?

    chiayi chiayi approved these changes on Jun 29, 2026 17:41 UTC
    Approved Reviewer

    Approved these changes.

    dalaoqi dalaoqi commented on Jun 29, 2026 17:45 UTC
    Author

    @JiangJiaWei1103 Done, bound to snap and read fields off it. Thanks!

    JiangJiaWei1103 JiangJiaWei1103 approved these changes on Jun 30, 2026 01:30 UTC
    Approved Reviewer

    LGTM. Thank you!

    chiayi chiayi commented on Aug 18, 2026 22:40 UTC
    Contributor

    @andrewsykim PTAL! It LGTM and can be merged.

    Assignees
    dalaoqi dalaoqi
    Labels
    risk: low confidence: 82.3% 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: 31.9% (LOW) · Higher = larger blast radius
    31.9%
    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: 82.3% · Lower = rushed or shallow review
    82.3%
    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: 5.7% · Safe to merge
    5.7%