feat: derive dashboard panels and actions from solver capabilities - #22
Merged
Merged
Conversation
Its Compare panel previously showed an empty file selector because the adapter inherited the empty compare_kinds default.
dashboard_panels defaulted to ALL_DASHBOARD_PANELS, so an adapter that implements no analytics still advertised every panel. It is now a property derived from what the adapter actually provides, and subclasses are prevented from shadowing it.
Deriving the performance capability from performance_columns makes a parser without columns silently dead. Same for apply_control without control_actions.
capabilities gates the action buttons, control_actions gates the individual entries of the More menu.
Restart on a solver without restart support returned 500 Launch error, a client error reported as a server fault. Control returned the unreadable 'Invalid action (expected one of [])'.
'expected one of []' did not tell the user the solver was the problem.
The derivation is implicit by design; this is where an adapter author sees its result without reading base.py.
Restart, Stop, the control directives and the Open GUI column were gated on case status only, so they were offered for solvers that reject them.
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
Dashboard panels and action buttons are now derived from what the solver adapter
actually implements, instead of a hand maintained
dashboard_panelsdeclarationwhose default was "show everything".
A capability exists when the thing that feeds it is no longer the base default:
an overridden method (
find_residuals_files,list_probe_files,build_restart_args,gui_argv) or a non-empty declaration (compare_kinds,performance_columns,control_actions).dashboard_panelsfollows from thatset,
/api/app_configserves it, andFastAPIContext.require_capabilityenforces it server side.
Why
CodeAsterAdapternever trimmeddashboard_panels, so the dashboard offered aResiduals chart for a solver that produces no residuals, plus a Probes panel, a
Timing panel and an empty Compare selector.
The action buttons were worse:
canControlandcanRestartdepended only oncase status, never on the solver, and
/api/app_configdid not exposecontrol_actions. On a running code_aster case, Stop, Extend, Checkpoint, Flush,Restart and Open GUI were all enabled and all failed on click, Restart with an
HTTP 500 (a client error reported as a server fault).
Deriving instead of declaring makes the inconsistency impossible by
construction, and adapters can no longer shadow the derivation: declaring
dashboard_panelsorcapabilitiesraisesTypeErrorat import time.How to test
Note: the web tests need the optional extra (
pip install -e ".[web,dev]"),otherwise 54 of them are skipped.
Then, against a code_aster campaign (
examples/codeaster-cube):csauto prepare doe.csv TEMPLATE RUNS csauto doctor RUNS # reports the derived panels and capabilities csauto serve RUNSExpected: four panels only (Status, Compare, Log Tail, Recent Errors), no Stop,
no More menu, no Restart, no Open GUI column, and a Compare panel that offers
doe_row.csv. Withsolver = "code_saturne", nothing changes.Direct API calls are refused with a 400 naming the solver:
Checklist
pytest -q)cd frontend && pnpm build)ruff check . && ruff format --check .)frontend/dist/is up-to-date (committed afterpnpm build)