fix(profiler): recover the results panel when a threshold input is rejected - #613
Merged
yakew7 merged 1 commit intoSep 13, 2026
Conversation
…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
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.
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 example1.5into "Min share") makes the engine'svalidateOpts()throw insidereprofile(), which callsshowError()and setsresults.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-inputinputhandler now remembers that opt's last-known-good value before applying the typed one. Ifreprofile()fails, it reverts that single opt (or deletes it when it was never set, so the engine default applies), restores the input'soverriddenstate, 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:
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).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 onassert '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