Skip to content

fix(profiler): recover the results panel when a threshold input is rejected - #613

Merged
yakew7 merged 1 commit into
yakew7:mainfrom
wangzhengzhuo05:fix/profiler-threshold-panel-recovery
Sep 13, 2026
Merged

yakew7 merged 1 commit into
yakew7:mainfrom
wangzhengzhuo05:fix/profiler-threshold-panel-recovery

Conversation

@wangzhengzhuo05

Copy link
Copy Markdown
Contributor

What: The web profiler's advanced threshold inputs (min_share, intersection_floor, imbalance_flag, missing_flag, min_group_size) can no longer strand the user behind a hidden results panel when an out-of-range value is typed.

Why: The threshold controls are nested inside <section id="results">. Typing an out-of-range value (for example 1.5 into "Min share") makes the engine's validateOpts() throw inside reprofile(), which calls showError() and sets results.hidden = true, hiding the very input the user needs to correct. The only way out was to re-select the file from scratch. Reported in #602.

How: In assets/profiler-ui.js, the threshold-input input handler now remembers that opt's last-known-good value before applying the typed one. If reprofile() fails, it reverts that single opt (or deletes it when it was never set, so the engine default applies), restores the input's overridden state, and retries once. This mirrors the recovery the mapping-select handler already uses for #466, and leaves the panel visible so the number can be fixed.

Tests:

  • New tests/test_js_parity.py::test_threshold_input_recovers_panel_after_invalid_value, a source-level regression test following this repo's existing convention for DOM-coupled handlers (test_compare_card_renderers_special_case_kind_mismatch).
  • Full suite: pytest tests/ -q -> 256 passed, 34 skipped.
  • python3 scripts/check_em_dash.py -> OK.

Mutation check: reverting the handler to the pre-fix single reprofile(false); call makes the new test fail on assert 'if (!reprofile(false))' in handler; restoring the fix makes it pass again.

Note: implemented with AI assistance (OpenCode plus muse-spark), reviewed and verified locally against the full test suite.

Fixes #602

…jected

An out-of-range value typed into the advanced threshold controls made the
engine's validateOpts() throw inside reprofile(); showError() then hid the
whole #results panel, including the input the user needed to correct. Revert
the offending opt to its last-known-good value and retry once, mirroring the
mapping-select recovery added for yakew7#466.

Fixes yakew7#602
@github-actions

Copy link
Copy Markdown

@yakew7 @ahmdkaml - new PR touching a path you own, please review.

@yakew7
yakew7 merged commit 35396af into yakew7:main Sep 13, 2026
17 checks passed
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.

Web profiler: an invalid threshold value permanently hides the results panel with no way back

2 participants