Skip to content

S3 — Forecast-file identity invariant (C-25) #54

Description

@Polichinel

Epic: #51 · S3 · depends on #61 (S0) · story implementation

Problem (C-25)

The forecast is selected by category="forecast" alone (unfao.py:98, newest-wins) — no loa/name/run filter. A stray upload silently ships the wrong predictions to FAO.

Build shape (per the epic design contract)

  • delivery/identity.py (representation-free): assert_forecast_identity(selected: dict, expected: dict) -> None over plain dicts (name/loa/etc.). No pandas.
  • unfao/extraction.py: file_metadata(downloaded) -> dict.
  • Manager: constrain the selection to the configured ensemble (name + loa="pgm"), or validate the selected file's metadata post-download via the invariant; fail loud on mismatch; log the chosen file identity.

Acceptance criteria

  • delivery/identity.py pure + pandas-free; unit-tested on dicts.
  • A decoy category="forecast" file with a different name is rejected; the correct one selected.
  • Mismatch fails loud, naming expected vs found.

Files

views_postprocessing/delivery/identity.py (new), unfao/extraction.py (extend), unfao/managers/unfao.py (_read_forecast_data), tests/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    implementationCode implementation workstoryA single reviewable unit of an epic

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions