Skip to content

fix: clamp the history pane frame index in the frontend - #2228

Draft
AKjangid99 wants to merge 1 commit into
fossasia:devfrom
AKjangid99:fix/history-frame-clamp
Draft

AKjangid99 wants to merge 1 commit into
fossasia:devfrom
AKjangid99:fix/history-frame-clamp

Conversation

@AKjangid99

@AKjangid99 AKjangid99 commented Dec 4, 2026 •

Copy link
Copy Markdown

Description

  • Image and plot history panes now make sure the selected frame actually exists before drawing it (new clampFrame helper).
  • image_select() now uses the same index check as update_image_slider().
  • Clicking a pane no longer draws a blue outline around it. It just gets a slightly deeper shadow.

Motivation and Context

If a saved env or an uploaded dashboard has a bad selected value (like 0.5, -1 or missing), the pane tries to draw a frame that doesn't exist and the whole dashboard goes blank. Old envs saved before the server checked this, and any uploaded dashboard, can hit it.

image_select() only had an assert, so it let True through, rejected numpy integers, and stopped checking at all under python -O. Its errors are now TypeError/ValueError instead of AssertionError.

How Has This Been Tested?

  • New Playwright test (history_slider.spec.js): uploads a dashboard with bad selected values and checks every pane shows the right frame. Without the fix the page renders blank.
  • New unit tests for image_select(). Full unit suite passes (3288 passed).

Screenshots (if appropriate):

Without the fix, loading such a dashboard leaves a completely blank page.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactor or cleanup (changes to existing code for improved readability or performance)

Checklist:

  • I adapted the version number under py/visdom/VERSION according to Semantic Versioning
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Summary by Sourcery

Keep dashboards rendering when history panes contain invalid stored frame selections.

Bug Fixes:

  • Prevent image and plot history panes from failing to render when saved frame selections are missing, invalid, or out of range by displaying a valid frame instead.
  • Validate image_select() inputs consistently with update_image_slider(), including accepting integral floats and NumPy integer values while rejecting invalid values with TypeError or ValueError.
  • Remove the blue focus outline from panes and indicate focus with a deeper shadow.

Documentation:

  • Document the accepted input types and validation errors for image_select().

Tests:

  • Add browser coverage for history panes with invalid saved selections and unit tests for image_select() input validation.

@coderabbitai

coderabbitai Bot commented Dec 4, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sourcery-ai

sourcery-ai Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

API

Update the public Python image_select() contract to accept and normalize the same index values as slider updates, with explicit errors for malformed values.

  • py/visdom/__init__.py L2955-2962
  • py/visdom/__init__.pyi L260

Implementation

Add shared frame-index clamping and use the valid frame consistently throughout image and plot history rendering and updates.

  • js/panes/ImagePane.js L20-399 (5 small edits)
  • js/panes/PlotPane.js L64-69 (+9 small edits)
  • js/panes/utils/historyFrame.js L1-28

UI

Remove the focused pane's accent outline while retaining its shadow treatment.

  • py/visdom/static/css/style.css L228-232

Tests

Cover uploaded dashboards with invalid history selections and verify the panes display the expected valid frames without page errors.

  • playwright/tests/history_slider.spec.js L1-106

Test image_select() validation, including supported NumPy and integral-float inputs and explicit rejection of malformed values.

  • py/tests/unit/client_payloads_media.py L739-771

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@AKjangid99

Copy link
Copy Markdown
Author

@mariobehling,
I am not able to create a pr seeing "Author has reached the open pull request limit" can you help me with this

Screenshot 2026-12-05 at 1 22 52 PM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant