You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[core-1] Dashboard tabs are declared by the solver adapter, and by nothing else #38
The dashboard tabs a campaign shows are decided by its solver adapter, and by nothing else: not the execution backend, not a user setting, not the campaign configuration, not the frontend.
The adapter states the list. csauto checks that the adapter can feed every tab it lists, and the dashboard renders exactly that list.
Where main stands
Since #22, the tabs already come from the adapter alone. /api/app_config returns adapter.dashboard_panels, and frontend/src/routes/+page.svelte renders exactly that list through showPanel. #34 does not change this.
But the adapter does not choose its tabs. It only implies them:
dashboard_panels (csauto/solvers/base.py:228) is derived from what the adapter implements. Residuals appears if find_residuals_files is redefined, Probes if list_probe_files is redefined, Performance if performance_columns is non-empty, and Compare if compare_kinds is non-empty.
Declaring the list explicitly is forbidden: __init_subclass__ (base.py:192) raises TypeError if an adapter declares dashboard_panels.
Status, Log Tail and Recent Errors are imposed by generic code through ALWAYS_ON_PANELS (base.py:50). No adapter can remove them.
As a result, an adapter cannot hide a tab whose data it provides. Probes, for instance, may be implemented for internal use and still not be worth showing. And an adapter author has to read the derivation rules to know which tabs their solver will get.
The declaration is required: the base class has no default, so a new adapter cannot get tabs by accident.
ALWAYS_ON_PANELS goes. Status, Log Tail and Recent Errors become ordinary entries the adapter lists, or leaves out.
The __init_subclass__ ban on dashboard_panels goes. The ban on capabilities stays: capabilities drive actions and buttons, and remain derived.
Display order stays fixed by ALL_DASHBOARD_PANELS, so tabs appear in the same order whatever the solver. Only the selection belongs to the adapter.
2. A test checks every declaration
For every adapter, each declared tab must be feedable: the method or declaration it depends on is provided. A tab the adapter could feed but does not list is allowed. That is precisely the choice this issue gives the adapter.
This follows 06535bf ("assert analytics parsers imply their declarations"). Unknown tab names fail too, so a typo cannot silently hide a tab.
Per-case data: a declared tab is never hidden because the selected case has no results yet. It shows its empty state. The fix that keeps a plot tab usable on a case without results (4188a61) is currently in [qarnot-1] Run a campaign on the Qarnot cloud #34, and is worth extracting ahead of it.
User and campaign settings: no setting hides or adds a tab.
4. Docs
docs/adding-a-solver.md explains how the tabs are derived today. It should instead tell the adapter author to declare them, and say which method feeds each tab.
Order
Part of the Generic core milestone, and the first item in it:
it is small: csauto/solvers/base.py, the three adapters, one test and the docs;
Principle
The dashboard tabs a campaign shows are decided by its solver adapter, and by nothing else: not the execution backend, not a user setting, not the campaign configuration, not the frontend.
The adapter states the list. csauto checks that the adapter can feed every tab it lists, and the dashboard renders exactly that list.
Where
mainstandsSince #22, the tabs already come from the adapter alone.
/api/app_configreturnsadapter.dashboard_panels, andfrontend/src/routes/+page.svelterenders exactly that list throughshowPanel. #34 does not change this.But the adapter does not choose its tabs. It only implies them:
dashboard_panels(csauto/solvers/base.py:228) is derived from what the adapter implements. Residuals appears iffind_residuals_filesis redefined, Probes iflist_probe_filesis redefined, Performance ifperformance_columnsis non-empty, and Compare ifcompare_kindsis non-empty.__init_subclass__(base.py:192) raisesTypeErrorif an adapter declaresdashboard_panels.ALWAYS_ON_PANELS(base.py:50). No adapter can remove them.As a result, an adapter cannot hide a tab whose data it provides. Probes, for instance, may be implemented for internal use and still not be worth showing. And an adapter author has to read the derivation rules to know which tabs their solver will get.
Proposal
1. Each adapter declares its tabs
ALWAYS_ON_PANELSgoes. Status, Log Tail and Recent Errors become ordinary entries the adapter lists, or leaves out.__init_subclass__ban ondashboard_panelsgoes. The ban oncapabilitiesstays: capabilities drive actions and buttons, and remain derived.ALL_DASHBOARD_PANELS, so tabs appear in the same order whatever the solver. Only the selection belongs to the adapter.2. A test checks every declaration
For every adapter, each declared tab must be feedable: the method or declaration it depends on is provided. A tab the adapter could feed but does not list is allowed. That is precisely the choice this issue gives the adapter.
This follows
06535bf("assert analytics parsers imply their declarations"). Unknown tab names fail too, so a typo cannot silently hide a tab.3. Nothing else may change the list
observability_globsthe files that feed its declared tabs, otherwise a tab would be shown but stay empty during a remote run. The opt-in test of [qarnot-2] Qarnot for every solver: a Run option each adapter opts into (code_saturne, code_aster, openTELEMAC) #36 should check that, against this declaration.4188a61) is currently in [qarnot-1] Run a campaign on the Qarnot cloud #34, and is worth extracting ahead of it.4. Docs
docs/adding-a-solver.mdexplains how the tabs are derived today. It should instead tell the adapter author to declare them, and say which method feeds each tab.Order
Part of the Generic core milestone, and the first item in it:
csauto/solvers/base.py, the three adapters, one test and the docs;#34 (Qarnot), which also edits
base.pyand the adapters, comes in the last milestone and rebases on this.Effect on other issues
These issues have been updated to match:
dashboard_panels, readable in one line.observability_globscovers the declared tabs.Definition of done
dashboard_panelsexplicitly.ALWAYS_ON_PANELSand thedashboard_panelsban in__init_subclass__are gone./api/app_configandcsauto doctorreport exactly the declared list, and the dashboard shows exactly those tabs for every backend.