Skip to content

feat: derive dashboard panels and actions from solver capabilities - #22

Merged
florian-simvia merged 9 commits into
mainfrom
feat/solver-capabilities
Sep 11, 2026
Merged

florian-simvia merged 9 commits into
mainfrom
feat/solver-capabilities

Conversation

@florian-simvia

Copy link
Copy Markdown
Collaborator

What

Dashboard panels and action buttons are now derived from what the solver adapter
actually implements, instead of a hand maintained dashboard_panels declaration
whose 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_panels follows from that
set, /api/app_config serves it, and FastAPIContext.require_capability
enforces it server side.

code_saturne stub code_aster
Panels 7 (unchanged) status, compare, tail, errors status, compare, tail, errors
Capabilities all 7 compare, control compare

Why

CodeAsterAdapter never trimmed dashboard_panels, so the dashboard offered a
Residuals 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: canControl and canRestart depended only on
case status, never on the solver, and /api/app_config did not expose
control_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_panels or capabilities raises TypeError at import time.

How to test

pytest -q                                   # 371 passed, 3 skipped
cd frontend && pnpm check && pnpm build

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 RUNS

Expected: 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. With solver = "code_saturne", nothing changes.

Direct API calls are refused with a 400 naming the solver:

curl -X POST localhost:8000/api/control_case -H 'Content-Type: application/json' \
  -d '{"cases":["case0001"],"action":"stop"}'
# {"detail":"Solver 'code_aster' does not support control"}

Checklist

  • Tests pass locally (pytest -q)
  • Frontend builds (cd frontend && pnpm build)
  • No linting errors (ruff check . && ruff format --check .)
  • frontend/dist/ is up-to-date (committed after pnpm build)

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.
@florian-simvia
florian-simvia merged commit 9861ace into main Sep 11, 2026
6 checks passed
@florian-simvia
florian-simvia deleted the feat/solver-capabilities branch September 11, 2026 13:12
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