Skip to content

issue D : Wire the API layer to adapter attributes that already exist #27

Description

@florian-simvia

Child of the solver boundary umbrella. Shape D: plain wiring. No new
mechanism, no new adapter attribute except one small addition. This is the
cheapest item and it removes the most embarrassing leaks, the ones in modules
the boundary test already claims to protect.

What leaks

csauto/web_support.py:187, inside discover_job_id:

for name in ("csauto.stdout", "csauto.stderr", "run_solver.log", "listing"):

adapter.anomaly_file_names holds exactly that list and is already passed into
this function's adapter argument. The literal list should simply be that
attribute.

csauto/fastapi_routes/case_data.py:

27:  file: str = "listing"                                   # Log Tail default
36:  scope: str = "monitoring"                               # probes scope
105: scope_value = (query.scope or "monitoring").strip().lower()
106: if scope_value not in ("monitoring", "profiles"):

listing, monitoring and profiles are code_saturne directory and file
names, sitting in HTTP query defaults. A solver whose console log is not called
listing gets an unusable default, and the boundary test does not notice
because its token list does not include these words.

What to do

  1. discover_job_id: replace the tuple with adapter.anomaly_file_names.
  2. The probes scope: the API should speak in roles, not in code_saturne
    directory names. Either rename the query values to probes / profiles and
    let the adapter map them to its own directories, or expose the valid scopes
    through the adapter. The adapter already has list_probe_files and
    list_profile_files, so the mapping has a natural home.
  3. The Log Tail default file: there is no adapter attribute for it today.
    Smallest option is a new default_tail_file (or reusing the first entry of
    the existing tail priority list). Decide in the PR; either way the literal
    leaves case_data.py.

Definition of done

  • No listing, monitoring, profiles or hardcoded file list in
    fastapi_routes/ or web_support.py.
  • With solver = "stub", the Log Tail panel opens on a file the stub actually
    produces, instead of defaulting to a code_saturne name.
  • Existing web tests still pass unchanged for code_saturne.

Note

This is the one child that changes the HTTP API surface (the scope values).
The umbrella lists API shapes as a non-goal, but that non-goal covers the
historical names kept deliberately (/api/resu_dirs, resu_removed); scope
is a query value nobody has documented as residue. Worth confirming before the
PR that renaming it is acceptable.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions