Skip to content

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

Closed

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

Activity

  1. changed the title [-]S3 — Verify forecast-file identity before enrichment (C-25)[/-] [+]S3 — Forecast-file identity invariant (C-25)[/+] on Jun 26, 2026
  2. Polichinel commented on Jun 26, 2026

    @Polichinel
    CollaboratorAuthor

    Delivered and merged to development via #64 (input-integrity sprint S0–S6). ruff clean, 126 passed / 44 xfailed. Closing — the auto-close keyword did not fire because #64 merged into development, not the default branch. Live-run validation of the residual contracts (C-25 identity name/loa, C-43 enrichment equivalence) is tracked in the risk register and exercised by the go-global run (views-models#127).

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

    implementationCode implementation workstoryA single reviewable unit of an epic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions