Viewer: rebuild tables on experiment switch and keep selections (follow-up to #99) - #101
Open
t0mdavid-m wants to merge 1 commit into
Open
t0mdavid-m wants to merge 1 commit into
t0mdavid-m wants to merge 1 commit into
Conversation
…ction keys Switching to an experiment whose data is byte-identical to the previous one (a re-run of the same file) left the Mass Table, spectra and 3D plot empty until the user clicked the first Scan Table row twice: the payload hash covered only the cell data, so the frontend skipped the render, never rebuilt the Scan Table and never sent the default scan selection. - render/util: payload_hash(data, tracker_id); render_component uses it, so a new experiment always rebuilds every cell while unchanged data is still skipped within an experiment - StateTracker: a None never claims an unknown key (with a bundle that sends null for unset fields the first cell to report owned every key and the default row selection was dropped as a stale conflict), id is not state, rejected stale updates are logged at debug level - tests: three new cases in test_selection_clear.py - docs/viewer-selection-sync.md: how the cells share a selection, invariants - js-component/dist: rebuilt from openms-streamlit-vue-component fix/viewer-selection-sync (no hash skip on tracker change, a click never deselects, old Tabulator instances destroyed, spectra clear on empty data and no longer push massIndex null to Python, 3D plot follows the data) Refs #100. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wda4mDs1DSWJuU1beJJKvL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #99, stacked on
fix/viewer-rerun-cascade. Addresses the "table contents only load when I select the first element" report and the selection-protocol part of #100 (§2). Companion Vue PR: t0mdavid-m/openms-streamlit-vue-component#31 (this PR ships its bundle).Problem
Switching the Viewer's experiment dropdown to a run whose data is byte-identical to the previous one (re-run of the same mzML with the same parameters) left the Mass Table, both spectra and the 3D plot empty, kept the previous experiment's spectra on screen, and needed two clicks on the still-highlighted first Scan Table row before anything loaded. Reproduced deterministically on
developand onfix/viewer-rerun-cascade.Root cause chain:
render_gridinstalls a freshStateTracker(new id, empty selection) when the dataset changes, butrender_componenthashed only the cell data, so identical runs produced identical hashes.scanIndex.scanIndex,filter_datasliced the dependent cells to zero rows; the spectrum component kept its stale plot; Tabulator's click toggling deselected the highlighted row on the first click.Separately,
StateTracker.updateStateadopted any unknown key unconditionally, so with a bundle that sendsnullfor unset fields (every CI-built bundle since t0mdavid-m/openms-streamlit-vue-component#29) the first cell to report claimed every key and a later first-time value with the same counter was dropped as a stale conflict.Changes
src/render/util.py,src/render/render.py:payload_hash(data, tracker_id); the hash now changes with theStateTracker, so a new experiment rebuilds every cell with any bundle while the per-rerun skip for unchanged data (heatmap Arrow payload) is preserved.src/render/StateTracker.py: aNonenever claims an unknown key (andidis not treated as state); the conflict check is guarded so skipped keys cannot raise; rejected stale updates are logged at debug level so lost clicks can be diagnosed from the server log.tests/test_selection_clear.py: three new tests (hash changes with the tracker; an all-Nonefirst message does not block the default row selection;Nonefor a never-set key is a no-op).docs/viewer-selection-sync.md: how the cells share a selection and the invariants above.js-component/dist: rebuilt from the companion Vue PR (tracker-aware hash skip, click never deselects, old Tabulator instances destroyed, spectra clear on empty data and no longer pushmassIndex = nullto Python, 3D plot follows the data).Verification
pytest tests/ -v: 55 passed.streamlit run app.py local(fresh session per trial), before → after:Not covered here (tracked in #100): the counter-based rejection of a click sent while another cell's update is in flight, and the residual polars access violation.
Note for maintainers: the "Selection linking" bullet in
CLAUDE.mdshould mention that the payload hash includes the tracker id and thatNonenever claims a key;CLAUDE.mdis not touched by this PR because the local checkout carries an unrelated uncommitted rewrite of it.🤖 Generated with Claude Code
https://claude.ai/code/session_01Wda4mDs1DSWJuU1beJJKvL