Skip to content

[codex] Complete Dash/Plotly migration, parity remediation, and runtime/library stabilization#14

Merged
utkuvibing merged 96 commits into
mainfrom
web-dash-plotly-migration
Apr 24, 2026
Merged

[codex] Complete Dash/Plotly migration, parity remediation, and runtime/library stabilization#14
utkuvibing merged 96 commits into
mainfrom
web-dash-plotly-migration

Conversation

@utkuvibing
Copy link
Copy Markdown
Owner

@utkuvibing utkuvibing commented Apr 24, 2026

Summary

This branch lands the full web-dash-plotly-migration effort against main.

At a high level it replaces the earlier partial Dash surface with a product-grade Dash + Plotly application, brings all six analysis modalities to near-full parity with the existing Streamlit experience, adds the backend and export/reporting support those pages require, and closes the remaining parity/stability gaps that showed up during end-to-end validation.

The last two branch-level follow-ups were:

  • c2d7472 — runtime/library test stabilization
  • 8e9d5a9 — removal of generated test artifacts from git tracking

After the artifact cleanup, the branch-level diff against main is down to 180 changed files.

What Changed

1. Dash application foundation and workflow surfaces

  • Added the combined Dash application shell and Plotly-first UI layer.
  • Added or matured the main workflow pages, including home, project/workspace, compare, export/report center, about, and modality-first import flows.
  • Added shared Dash infrastructure for theme handling, chrome, i18n, guidance, layout composition, page routing, API access, and sample-data/bootstrap behavior.
  • Brought the combined app closer to stable workspace parity so the web surface can act as the primary runtime rather than a thin experiment.

2. Full analysis-page migration across modalities

  • Built or completed product-grade Dash pages for:
    • DSC
    • TGA
    • DTA
    • FTIR
    • Raman
    • XRD
  • Standardized the mature analysis-page shape across modalities: Setup / Processing / Run workflow on the left, richer results surfaces on the right, and backend-driven execution/persistence.
  • Added modality-owned processing drafts, control hydration, undo/redo/reset flows, preset load/save/delete behavior, and result rendering patterns.
  • Improved modality-specific result UX, including validation/quality surfacing, progressive disclosure, raw metadata layout, result hierarchy, and figure readability.

3. Shared UI primitives and figure/report behavior

  • Extracted shared analysis-page helpers and processing-input coercion helpers to reduce cross-page duplication.
  • Standardized figure artifact controls across modalities with Snapshot / Report figure actions while preserving existing result-figure contracts.
  • Added or improved shared literature compare rendering, DOI/URL linking, spectral exploration helpers, plot settings, and raw-quality panels where appropriate.
  • Moved figure persistence toward shared backend save paths so export/report flows do not depend on one page-specific capture callback succeeding.

4. Backend and API support needed for Dash parity

  • Extended backend execution, result serialization, workspace, export, and model layers to support the migrated Dash flows.
  • Added backend support for processing overrides, preset payloads, figure persistence, analysis-state curves, scientific reasoning, literature compare, validation diagnostics, and modality-specific processing/state contracts.
  • Added FTIR- and Raman-specific literature query/reasoning paths instead of relying on generic fallback behavior.
  • Added combined-server library bootstrap/path sanitation logic so Dash + backend split/combined execution uses sane library cloud URLs and ignores malformed Windows-path environment leakage on POSIX hosts.

5. Parity remediation and polish after the core migration

This branch also closes the follow-up parity backlog identified after the initial migration:

  • Completed DSC/DTA baseline-method parity.
  • Fixed DSC/DTA/TGA i18n namespace leakage so modality pages no longer borrow the wrong labels.
  • Cleaned up CSS namespace leakage with shared ms-* structural classes.
  • Added FTIR/Raman similarity-metric selection (cosine / pearson) and propagated the selected metric through local matching and cloud search.
  • Added explicit DSC mass-normalization controls while preserving default-on backward compatibility.
  • Standardized figure capture toolbars across modalities.
  • Added shared UI-only spectral plot settings and missing spectral raw-quality surfaces.
  • Added DSC loaded-preset dirty tracking.

6. Runtime/library stabilization in tests

The final stabilization slice keeps production behavior strict and fixes the tests instead of weakening runtime behavior.

Specifically:

  • tests/test_backend_api.py, tests/test_backend_batch.py, and tests/test_reference_library.py now clear both MaterialScope and legacy ThermoAnalyzer library/runtime environment variables before each test.
  • Those tests use tmp-path-scoped MATERIALSCOPE_HOME values so ambient developer-machine state and .env values cannot leak into expectations.
  • Tests that depend on cloud env re-reads now reset the managed library cloud client singleton explicitly.
  • The FTIR batch no_match regression test now provisions fallback-library state intentionally and uses a deterministic low-similarity FTIR signal instead of depending on incidental local library availability.

7. PR cleanup: generated artifact removal

  • Removed all tracked pytest_temp/ content from the branch.
  • Removed the stray tracked python3 root artifact.
  • Updated .gitignore to cover pytest_temp/, .pytest_temp/, and python3 explicitly.
  • Kept build/reference_library_ingest_live/ because it is an intentional checked-in fixture used by tests/test_reference_library_ingest.py as the seed XRD normalized corpus.

Why

This branch exists to finish the Streamlit-to-Dash migration as an actual product surface rather than a partial prototype.

Before these changes, the Dash app had major modality gaps, repeated page-specific boilerplate, inconsistent result/figure behavior, and several places where the frontend could claim capability that the backend did not yet support end-to-end. After parity cleanup, the remaining failures were mostly in test isolation around runtime/library configuration. A later review also found that generated local test artifacts had been accidentally committed into the branch and needed to be removed before review.

The intent of this PR is therefore threefold:

  1. make Dash/Plotly the complete, credible web UI for MaterialScope workflows,
  2. keep runtime/library behavior strict in production while removing environment-dependent test behavior, and
  3. ensure the PR only contains source, tests, fixtures, and intentional migration assets.

Root Cause for the Final Stabilization Fix

The last failing full-suite cases were not caused by a production logic regression. They came from test contamination:

  • ambient MaterialScope / ThermoAnalyzer env vars could change library/runtime configuration unexpectedly,
  • process-global cloud client state could stay stale across tests even after env changes, and
  • one FTIR fallback test depended on whatever library state happened to exist on the local machine.

The fix in this branch treats those as test-fixture problems first. It does not broaden dev overrides, weaken cloud-auth expectations, or relax scientific matching behavior to make the tests pass.

User / Developer Impact

User-facing

  • Dash now covers the full main workflow surface with much stronger parity across DSC, TGA, DTA, FTIR, Raman, and XRD.
  • Figure capture, report registration, literature compare, preset flows, and result presentation are materially more consistent.
  • FTIR/Raman spectral workflows now expose the missing metric/settings controls and better modality-specific copy.
  • DSC now exposes mass normalization explicitly instead of leaving it as hidden behavior.

Developer-facing

  • Shared Dash components and boilerplate reduce repeated page logic.
  • Backend result/state contracts are clearer and more reusable across modalities.
  • Runtime/library tests are more deterministic because they no longer inherit local machine configuration implicitly.
  • The PR diff is now reviewable without generated pytest_temp/ clutter.
  • Repo documentation and .ai decision/session/task records now reflect the completed parity and stabilization state.

Validation

Recorded validation on this branch includes:

python -m pytest -p no:cacheprovider
  • Result: 1116 passed, 9 skipped
python -m pytest -p no:cacheprovider tests/test_backend_api.py::test_library_status_stays_limited_when_hosted_catalog_is_empty tests/test_backend_api.py::test_runtime_cloud_client_stays_strict_without_dev_override tests/test_backend_api.py::test_runtime_cloud_client_production_error_remains_strict_without_dev_hint tests/test_backend_batch.py::test_batch_run_ftir_similarity_path_returns_no_match_as_saved tests/test_reference_library.py::test_reference_library_manager_reports_not_configured_without_feed_source tests/test_reference_library.py::test_reference_library_manager_requires_explicit_feed_configuration -q
  • Result: 6 passed
python -m pytest tests/test_ftir_dash_page.py tests/test_raman_dash_page.py tests/test_batch_runner.py -q
  • Result: 116 passed
python -m pytest -p no:cacheprovider tests/test_dsc_dash_page.py tests/test_batch_runner.py -q
  • Result: 67 passed
python -m pytest -p no:cacheprovider tests/test_analysis_page_components.py tests/test_xrd_dash_page.py tests/test_dsc_dash_page.py tests/test_dta_dash_page.py tests/test_tga_dash_page.py tests/test_ftir_dash_page.py tests/test_raman_dash_page.py -q
  • Result: 303 passed
python -m pytest -p no:cacheprovider tests/test_analysis_page_components.py tests/test_dsc_dash_page.py tests/test_dta_dash_page.py tests/test_tga_dash_page.py tests/test_ftir_dash_page.py tests/test_raman_dash_page.py tests/test_xrd_dash_page.py -q
  • Result: 309 passed
python -m pytest -p no:cacheprovider tests/test_analysis_page_components.py tests/test_ftir_dash_page.py tests/test_raman_dash_page.py tests/test_tga_dash_page.py tests/test_dsc_dash_page.py -q
  • Result: 189 passed

Artifact cleanup verification:

git status --short
  • Result: clean working tree
python -m pytest -p no:cacheprovider
  • Result after cleanup commit: 1116 passed, 9 skipped

Additional checks recorded in the branch session notes:

  • protected-ID render checks for shared preset/history/quality/raw-metadata surfaces
  • temporary Dash app import checks for all touched modality pages

Review Notes

  • This is still a branch-level PR and remains large, but it is now narrowed to intentional migration files and fixtures.
  • Recommended review order:
    1. Dash app foundation and routing
    2. modality pages (dash_app/pages/*)
    3. shared Dash components
    4. backend support for result/state/export/library behavior
    5. final runtime/library test stabilization
    6. artifact cleanup commit 8e9d5a9

utkuvibing and others added 30 commits April 13, 2026 19:32
Add dash_app/ with combined FastAPI + Dash server, sidebar navigation,
import page (file upload + one-click analysis), project workspace
(save/load), export page (CSV/DOCX), and about page. Backend endpoints
are consumed via httpx API client. No changes to existing backend or
core logic.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Add the missing WSGI bridge dependency required by the Dash server, fix sample-data resolution to use real repo fixtures, and cover the combined app with a minimal startup/import smoke test.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Carry the non-analysis MaterialScope workflow into Dash so import, project, compare, and report tasks can run end-to-end before the analysis-page migration.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…rors

- Add backend-driven DSC analysis page with dataset selection, workflow
  template picker, execution via /analysis/run, and result display with
  Plotly figure, peak table, Tg markers, and processing details
- Enable DSC nav link in sidebar, rename section from 'Analysis (coming soon)'
  to 'Analysis'
- Fix stale project-id after server restart: ensure_project callback now
  validates the stored id against the backend before reusing it
- Fix import 400 Bad Request: validate column mapping values exist in the
  current file's columns before sending to backend; add clear error in
  read_thermal_data when mapped columns are missing from the DataFrame
- Add workspace_result_detail to api_client for fetching result details

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Expose DSC analysis-state curves so result views can show overlays and keep related workspace pages in sync after runs.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…tion

- New TGA Dash page at /tga with dataset selection, unit mode selector
  (auto/percent/absolute_mass), workflow template picker, and run button
- Adds unit_mode passthrough: AnalysisRunRequest -> execution_engine ->
  batch_runner -> _execute_tga_batch, applying set_tga_unit_mode before
  unit resolution
- Extends AnalysisStateCurvesResponse with dtg/has_dtg fields so the
  TGA page can overlay the DTG curve on a secondary y-axis
- Displays result summary cards (step count, total mass loss, residue),
  per-step cards with onset/midpoint/endset, mass vs temperature figure
  with DTG overlay and step markers, step data table, processing details
- Enables TGA nav link in sidebar; auto-refreshes workspace on success

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Extract duplicated patterns into dash_app.components.analysis_page:
- metric_card / metrics_row for KPI rendering
- eligible_datasets / dataset_options / dataset_selector_block for
  dataset selection logic and UI
- dataset_selection_card / workflow_template_card / execute_card /
  result_placeholder_card / analysis_page_stores for layout blocks
- interpret_run_result for run-result status interpretation
- processing_details_section with extra_lines hook
- empty_result_msg / no_data_figure_msg helpers

Refactor DSC and TGA pages to consume shared components; modality-
specific logic (figures, specialised cards, extra selectors) remains
in each page. Add 16 targeted tests for shared behavior.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Add resolve_sample_name() with fallback chain: summary.sample_name
  -> fallback_display_name -> stripped dataset_key -> N/A; prevents
  showing None or raw filenames when metadata has a usable name
- DSC figure: suppress peak/Tg text labels when within 15 C of an
  already-annotated temperature; only show Tg onset/endset labels
  when not overlapping the midpoint; position annotations top-left
- TGA figure: suppress step midpoint labels when within 15 C;
  hide onset/endset vline annotations when >4 steps (thin guide
  lines still drawn); use compact On/End labels
- 7 new tests for resolve_sample_name

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…tion

Add the first Dash DTA analysis page following the established DSC/TGA
backend-driven pattern.  Users can select an eligible DTA dataset, choose
a workflow template (General DTA / Thermal Event Screening), run analysis
through the existing backend, and view result summary cards, DTA curve
figure with raw/smoothed/baseline/corrected overlay, direction-colored
peak markers, detected event cards, event data table, and processing
details.  Workspace/report/compare state auto-refreshes on success.

Also includes prior improvements to api_client error reporting, data_io
spectral source hints and headerless-file handling, and import error
hints for spectral data.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Improve DTA readability by making the figure the primary result surface, deriving event counts from saved result data, and resolving sample labels from dataset metadata. Add a repo rule that keeps future work aligned with the incremental Dash migration architecture.

Made-with: Cursor
Add a backend-driven Dash Raman analysis slice with dataset/template selection, run flow, summary metrics, primary spectrum figure, library match views, and focused page tests. Include a root .cursorignore tuned for faster indexing while keeping migration-critical code visible.

Made-with: Cursor
Deliver a backend-driven XRD Dash slice so users can run qualitative phase screening without leaving the stable analysis surface. This wires XRD routing, result rendering, and focused tests while reusing existing run/detail/state endpoints.

Made-with: Cursor
Add end-to-end API tests for import, analysis run, result detail, analysis-state, workspace context/results, export preparation, compare PUT, project save/load, error paths, and key route smoke. Point dash server smoke test at the new module.

Made-with: Cursor
- Add workspace_batch_run client and compare_curve_utils (axis titles, pick_best_series).
- Compare page: analysis-state overlay with raw fallback, batch UI and persisted summary.
- Tests: compare phase2 module and workflow regression batch path; combined-app overlay data path.

Made-with: Cursor
- Harden react-select and DataTable styling for dark theme (headers, scrollbars, placeholders).
- Add EN/TR i18n for sidebar and shared chrome; locale dropdown and clientside theme hook.
- Apply figure theme tokens across analysis pages and data preview quick plots.
- Align Import Active Dataset row; add chrome i18n tests; adjust page tests for ui_theme.

Made-with: Cursor
Cover both legacy and modern react-select selector paths and keep targeted fallback selectors for locale, compare, and export controls so dark mode no longer leaks white control/menu/search surfaces.

Made-with: Cursor
Remount non-analysis compare/export dropdown components on ui-theme changes so surfaces refresh reliably between light and dark modes, and add dedicated guidance block classes for readable, theme-consistent workflow callouts.

Made-with: Cursor
- Add core/modality_specs.py with per-technique contracts (DSC/TGA/DTA/FTIR/RAMAN/XRD)
  defining allowed units, column aliases, suspicious combos, and spectral flags
- Update guess_columns() to accept modality parameter that restricts signal detection
  to only the selected technique's patterns and locks data_type deterministically
- Update read_thermal_data() to pass data_type through to guess_columns(modality=...)
- Add 4-tier validation status: pass / pass_with_review / warn / fail
- Add modality-specific suspicious unit combo review flags in validation
- Rewrite dash_app/pages/home.py as a 6-step modality-first import wizard:
  Step 1: Technique selection, Step 2: Upload, Step 3: Raw preview,
  Step 4: Modality-aware column mapping, Step 5: Unit/metadata review,
  Step 6: Validation summary + confirm
- Add dash_app/components/stepper.py reusable wizard UI component
- Update import_preview.py to accept modality parameter
- Add 41 new tests covering modality specs, modality-aware parsing,
  4-tier validation, import preview, and backend integration

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
… management

Add a compact recent-history panel to the sidebar, below the Management
nav section and separated by a horizontal rule.  The panel auto-refreshes
on workspace changes (imports, analysis runs, etc.) and shows the last 8
events with timestamp, action and detail.  The duplicate history card is
removed from the Project Workspace page.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Add verified Dash 4 dash-dropdown selector coverage for sidebar locale and non-analysis dropdown surfaces, and theme sidebar scrollbar colors to remove remaining white UI leaks in dark mode.

Made-with: Cursor
Constrain sidebar locale dark-surface overrides to dark theme only and add explicit light-theme trigger/menu/option states so locale dropdown remains readable without leaking dark colors into light mode.

Made-with: Cursor
When render_sidebar rebuilds the theme-toggle button (on locale change
or theme change), Dash fires the toggle callback with n_clicks=0.
Guard against falsy n_clicks with PreventUpdate to avoid unintended
theme flips.
- Unify copy on translate_ui / utils.i18n catalog (dash.home, dash.export, dash.compare).
- Hero and guidance slots plus locale-driven workbench where needed.
- Thread ui-locale through callbacks that emit user-facing strings.
- Thin dash_app.i18n wrapper; optional locale on page guidance helpers.
- Extend test_dash_chrome_i18n for chrome behavior.

Made-with: Cursor
…i-locale

- Extend utils.i18n with dash.analysis.* (shared metrics, figure strings, DSC/TGA/DTA/FTIR/Raman/XRD templates and copy).
- Refactor analysis_page primitives for translate_ui and locale-aware dataset selector, metrics, alerts, processing block, sample name fallback.
- DSC/TGA/DTA/FTIR/Raman/XRD: hero slots, locale chrome callbacks, ui-locale on load/run/display, translated figures and cards where applicable.
- Clear stale dash_app.pages.* PAGE_REGISTRY entries in create_dash_app to avoid duplicate routes after tests import page modules.

Made-with: Cursor
…PDF hint

- Gate export/branding/support actions when commercial mode and license disallows write
- Preview batch summary with totals, filter, and table (parity with Streamlit)
- GET /workspace/{id}/exports/support-snapshot plus Dash prepare/download flow
- Hide PDF format when reportlab missing; i18n strings for new UI
- Test: support snapshot returns valid JSON

Made-with: Cursor
Remove the FTIR Setup Raw Data Quality card and dead explore helpers.
Add ftir_literature_query_builder and _compare_ftir_result_to_literature
with FTIR-specific queries, relevance scoring, and honest context states.
Add _build_ftir_reasoning and FTIR experiment recommendations.
Fix LiteratureContext.executed_queries through normalize_literature_context.
Update tests and .ai SESSION/TASK/DECISIONS.
- Add dash.analysis.ftir.* i18n for presets, processing, baseline (cm^-1),
  quality, raw metadata, and empty-state hint; stop borrowing TGA strings.
- FTIR results: library_unavailable uses info alert and hides match table;
  quieter pre-run placeholders; cards mainly for summary and figure.
- finalized_validation_warning_issue_counts + interpret_run_result uses
  list length so run banner matches the validation panel.
- Tests for count alignment, library-unavailable panels, interpret_saved.
- Update .ai SESSION, TASK, DECISIONS.
…tion

- Defer backend import in dash_app.server; sanitize hosted/mirror env and
  align MATERIALSCOPE_LIBRARY_CLOUD_URL with combined server listen port
  (default 8050 vs docker-style :8000).
- Detect Windows-style path leaks on POSIX in path_env, resolve_hosted_root,
  and mirror feed resolution; reset library cloud client after env changes.
- Add spectral_library_diagnostics and extend ftir_library_diagnostics CLI;
  document in README and .env.example; add tests.
- Lead with MATERIALSCOPE_* and combined local dev (8050); comment optional paths.
- Document split stack (8000) and legacy THERMOANALYZER_* as secondary, commented.
- README: point to .env.example ordering; de-emphasize Windows paths in split snippet.
- Replace XRD Dash page with Setup/Processing/Run plus results surface aligned with other modalities.

- Add figure registration helper, saved-figures panel, GET figure endpoint with optional max_edge (Pillow), and api_client wiring.

- Extend result detail with figure_artifacts; batch_runner XRD context; i18n and tests.

- Remove obsolete .sisyphus planning artifacts from the repo tree.

Made-with: Cursor
- Restructure result figure: toolbar for overlay and snapshot/report; artifacts under Details.

- Collapse plot settings under Processing; default match overlays off; optional smoothed/baseline traces.

- Compact candidate cards and literature compare (compact_toolbar + collapsed reference block).

- Document Slice 7 in TASK and refresh SESSION.

Made-with: Cursor
Normalize results-column spacing, compact figure toolbar with ButtonGroup,
quieter artifacts and evidence bands, denser processing-tab cards, lighter
candidate cards and literature chrome. Soften XRD-visible strings. Update
.ai SESSION/TASK and XRD dash page test for registry summary translation.

Made-with: Cursor
P0-2 + P0-3 from the repo-wide parity audit. DSC/DTA processing history labels borrowed TGA i18n keys; TGA quality/metadata/summary labels borrowed DSC keys. Added 28 modality-native keys (TR+EN), swapped 32 references, added 6 regression tests (source-grep + monkeypatch) to prevent recurrence.

Made-with: Cursor
- Rename shared result-surface/structural classes from modality-specific dsc-*/dta-*
  to generic ms-* prefix across all 6 Dash pages + CSS:
  ms-results-surface, ms-result-section, ms-result-{context,hero,support,secondary},
  ms-result-figure-shell, ms-result-graph, ms-meta-{term,def,value}
- Add per-modality root page hooks (dsc-page, dta-page, tga-page, ftir-page,
  raman-page, xrd-page) for future per-modality styling flexibility
- Fix TGA derivative class leakage: dsc-derivative-graph/helper -> tga-derivative-*
- Preserve DTA-only debug classes (dta-figure-stack, dta-result-debug, dta-debug-shell,
  dta-debug-graph) untouched
- Merge duplicate DSC CSS section into shared generic rules
- Update 6 test files to assert new generic class names
- Update .ai/SESSION.md and .ai/TASK.md

Verification: 260 passed, 1 pre-existing unrelated failure
@utkuvibing utkuvibing closed this Apr 24, 2026
@utkuvibing utkuvibing reopened this Apr 24, 2026
@utkuvibing utkuvibing marked this pull request as ready for review April 24, 2026 13:33
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e9d5a9eb3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread backend/app.py
_merge_result_artifacts(state, result_id, record, artifacts_update=artifacts)
return {"figure_key": key, "reused": True, "status": "captured"}

label = f"{str(analysis_type or '').upper()} Analysis - {dataset_key}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make auto-captured figure keys unique per result

Generate the auto snapshot label with only analysis_type + dataset_key here, and then store PNG bytes under that key in state["figures"]. If a user saves multiple results for the same dataset/modality (e.g., different processing templates), later runs overwrite the same figure key, while older result records still reference that key; exporting or viewing older results then shows the newest plot, corrupting historical result fidelity.

Useful? React with 👍 / 👎.

Comment thread backend/app.py
Comment on lines +914 to +915
a = np.where(np.isfinite(a), a, None)
return a.tolist()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Return finite floats from analysis-state curves

This conversion replaces non-finite values with None, but the response model fields are typed as list[float]. When analysis state contains NaN/Inf (which can occur in derived curves), FastAPI/Pydantic response validation can fail and turn the request into a 500 instead of returning a usable payload. The sanitizer should emit only valid floats (or filter invalid entries consistently with axis length handling) rather than None.

Useful? React with 👍 / 👎.

@utkuvibing utkuvibing merged commit af01335 into main Apr 24, 2026
4 checks passed
@utkuvibing utkuvibing deleted the web-dash-plotly-migration branch April 25, 2026 20:05
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