-
Notifications
You must be signed in to change notification settings - Fork 30
[WIP] Dashboard: add input error tracking #985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
[WIP] Dashboard: add input error tracking #985
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds dynamic input error tracking to the dashboard, introduces a centralized SimulationValidation class to manage error state per section, and suppresses unnecessary ResizeObserver console errors.
- Add an error banner in the Inputs toolbar showing total and detailed input errors.
- Introduce
SimulationValidationto replace piecemeal validation updates with a section-based update API. - Suppress redundant ResizeObserver loop errors in
custom.js.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/python/impactx/dashboard/Toolbar/sim_history/custom.js | Suppress ResizeObserver errors by overriding console.error. |
| src/python/impactx/dashboard/Toolbar/controls.py | Add error_notification banner and include it in the toolbar. |
| src/python/impactx/dashboard/Input/validation.py | Create SimulationValidation to track and cache per-section errors. |
| src/python/impactx/dashboard/Input/space_charge_configuration/spaceChargeMain.py | Swap DashboardValidation.update_* calls for SimulationValidation.update. |
| src/python/impactx/dashboard/Input/shared.py | Update imports and use SimulationValidation.update in shared utilities. |
| src/python/impactx/dashboard/Input/latticeConfiguration/variable_handler.py | Replace DashboardValidation calls; incorrectly calls update_simulation_validation_status. |
| src/python/impactx/dashboard/Input/latticeConfiguration/latticeMain.py | Replace validation triggers with SimulationValidation.update. |
| src/python/impactx/dashboard/Input/inputParameters/inputMain.py | Remove old validation hook but omit new SimulationValidation.update call. |
| src/python/impactx/dashboard/Input/generalFunctions.py | Remove unneeded comments and extend get_default with robust fallback. |
| src/python/impactx/dashboard/Input/distributionParameters/distributionMain.py | Hook distribution parameter changes into SimulationValidation.update. |
| src/python/impactx/dashboard/Input/init.py | Export SimulationValidation alongside DashboardValidation. |
Comments suppressed due to low confidence (3)
src/python/impactx/dashboard/Input/validation.py:173
- The
if n_cell_errorblock is mis-indented outside the loop, so only the last direction is ever checked. Move theifand its append logic inside theforblock.
for direction in ["x", "y", "z"]:
src/python/impactx/dashboard/Input/inputParameters/inputMain.py:44
- You removed the validation hook but did not add a
SimulationValidation.update("Input Parameters")call. Without it, changes here won’t update the input-error state.
if state.space_charge not in current_sc_list:
src/python/impactx/dashboard/Input/validation.py:158
- [nitpick] New validation logic in
SimulationValidationand the toolbar banner lack unit tests. Consider adding tests forupdatebehavior andInputToolbar.error_notificationrendering.
class SimulationValidation:
src/python/impactx/dashboard/Input/latticeConfiguration/variable_handler.py
Outdated
Show resolved
Hide resolved
| current_sc_list = ui_props.get("space_charge_list", []) | ||
| if state.space_charge not in current_sc_list: | ||
| state.space_charge = current_sc_list[0] | ||
| DashboardValidation.update_simulation_validation_status() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is fine to not have to update the simulation with tracking_mode because tracking_mode is a dropdown and will always have a valid input.
68527e7 to
a270010
Compare
d03f1b5 to
caa96bf
Compare
e3e1f41 to
f269f1a
Compare
f269f1a to
a5db113
Compare
break into multiple smaller functions
because the input of state.kin_energy_unit is coming from a dropdown, its input is a string. if it goes through the shared.py state change '@state.change(*INPUT_DEFAULTS)', then it will be validated as a string. Because it has no error messages (technically because the state.kin_energy_unit default is 'MeV' and would be a valid python identifier), it will be converted to a numeric value. however the 'convert_to_numeric' method will set the value to 'None' if it can't be turned into a default type of int or float. this will set the state.kin_energy_unit to 'None' and the dashboard will not launch. The solution to this is not have any dropdown inputs go through @state.change(*INPUT_DEFAULTS) because every dropdown will have a valid set of inputs by default.
which also fixes distribution validaiton
The current default for lattice name is 'None', a string. We change that to a python literal None now. But because that is the case the name parameter for the lattice element will be empty. So we need to make sure in the dashboard test we provide a name for the element so that there are no inputs errors before running a simulation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
doesnt affect dashbaord visually or functionally this resizeObserver error message appears whenever hovering over a tooltip that takes the entire width of the page, or if we hover over the tooltip showing input errors. not exactly sure why and this is just a suppression 'bandaid'
…g errors correctly track n_cell and blocking factor completely refactor refactor fixup create SimulationValidation class this is where the logic of checking for input errors is now stored update main function name shorten because the class name helps with identifying call correct function for variables add type hints simplify update 'get_default' [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci update var name for disabling sim
place in a new folder 'Input/validation'
the set_js_input is going to reach the 'exception' case if I place an invalid error. If I am intentionally trying to set an error, such as if I am testing the dashboard validation with an error input, I need it to fail on the dashboard end only.
sets all inputs to an error state, checks to make sure that the # of input errors is accurate, then reset different parts of the dashboard and continuously check the number of errors.
it always returned true
create '_apply_state_updates'
a5db113 to
4ca3e8c
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
This PR provides the user guidance on which inputs are invalid. Additionally, the PR refactors the current logic to track such errors.
Changes:
Inputstoolbar which will display the count of input errors the user has. Hovering over the banner will tell the user exactly which inputs are incorrect along with the error message.SimulationValidationinvalidation.py, is created to encapsulate all logic for determining whether the simulation can run based on current input errors.update, takes theinput sectionheader as an argument.resizeWarningerror.generalFunctions.pyshared.pyDemo:
chrome_u8cxvRN2ps.mp4
Merge after #981