Skip to content

[core-1] Dashboard tabs are declared by the solver adapter, and by nothing else #38

Description

@florian-simvia

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 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.

Proposal

1. Each adapter declares its tabs

class CodeSaturneAdapter(SolverAdapterBase):
    dashboard_panels: ClassVar[tuple[str, ...]] = (
        "status", "residuals", "probes", "performance", "compare", "tail", "errors",
    )

class CodeAsterAdapter(SolverAdapterBase):
    dashboard_panels: ClassVar[tuple[str, ...]] = ("status", "compare", "tail", "errors")
  • 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.

3. Nothing else may change the list

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:

#34 (Qarnot), which also edits base.py and the adapters, comes in the last milestone and rebases on this.

Effect on other issues

These issues have been updated to match:

Definition of done

  • Every adapter (code_saturne, code_aster, stub, and openTELEMAC when it lands) declares dashboard_panels explicitly.
  • ALWAYS_ON_PANELS and the dashboard_panels ban in __init_subclass__ are gone.
  • A test fails if an adapter declares a tab it cannot feed, or an unknown tab name.
  • /api/app_config and csauto doctor report exactly the declared list, and the dashboard shows exactly those tabs for every backend.
  • For code_saturne, the dashboard is unchanged: it declares the seven tabs it shows today.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions