← Back to Pull requests

feat: limit retained points in live line and scatter plots #2170

Open
unknown opened this pull request with 312 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 29, 2026 18:18 UTC
Author

Description

Line and scatter plots can retain the newest N samples per trace with opts={"max_points": N}. Later appends reuse the limit. The default keeps full history.

Closes #2171.

Motivation and Context

A long training run can keep extending the same trace in server memory, in connected browsers, and in the saved environment. A rolling window lets users choose how much history their dashboard needs.

How Has This Been Tested?

Sent 100,000 samples through the Python client to a running server. With a limit of 1,000, the retained coordinates matched the newest 1,000 exactly. A separate save-and-restart test preserved the expected samples. Chromium verified live appends and reloads over WebSocket and polling. The Python suite passed with 4,308 tests and three platform skips.

Types of changes

  • New feature
  • Checklist:

  • Documented the option for line and scatter plots.

  • Added Python regression tests and a live Playwright test.
  • Summary by Sourcery

    Add rolling point retention for live plots so users can bound per-trace history while preserving consistent rendering and persistence.

    New Features:

  • Add a configurable rolling window that retains only the newest positive number of samples per line, scatter, and 3D scatter trace.

  • Preserve rolling limits across subsequent appends and saved environment reloads.
  • Bug Fixes:

  • Reject invalid rolling-window limits without mutating plot state.
  • Enhancements:

  • Trim associated point attributes, implicit coordinates, multicategory data, and selected-point indices consistently when samples are evicted.
  • Documentation:

  • Document the max_points option for supported line and scatter plots.
  • Tests:

  • Add unit and live browser coverage for rolling retention, validation, appends, reloads, and related trace data.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Scatter and line plots can limit each trace to the newest N samples with max_points. As data arrives, older samples are discarded from the plot and saved environment, and the limit persists after reloading.
    The limit must be a positive integer and defaults to unlimited. When samples are trimmed, associated point values remain aligned.
    Documentation
    * Added README guidance on max_points, including its accepted values and default.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 312 lines (+234 / -78) across 3 files Reviewer: ArnavBallinCode Review duration: 2230m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 312 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.344
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #2170"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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.3% (MEDIUM) · Higher = larger blast radius
    40.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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 21.5% · Safe to merge
    21.5%