Skip to content

ADR-008 compliance: add log-before-raise to remaining raises (C-19) #13

Description

@Polichinel

Context

ADR-008 requires structural failures to be both logged persistently AND raised explicitly. Currently:

  • mapping.py: 20 of 24 raises lack preceding logger.error (3 validation methods were fixed)
  • unfao.py: 3 of 7 raises lack preceding logger.error (lines 65, 75, 225)

When exceptions are caught by batch handlers (which log at ERROR and continue), the original raise is NOT logged — the failure is both swallowed AND unrecorded.

Requirements

  • Add logger.error(err_msg) before each raise ValueError(err_msg) in both files
  • This is a mechanical change — same pattern applied 23 times
  • Follow the pattern already used in _validate(): construct err_msg, log it, raise with it

Risk Register

C-19 (Tier 3). Part of Cluster B.

Note

If ADR-011 eliminates mapping.py from runtime, the 20 mapping.py raises become moot. The 3 unfao.py raises remain relevant regardless.

Activity

  1. Polichinel commented on Jun 26, 2026

    @Polichinel
    CollaboratorAuthor

    Status vs current development (2026-06-27): scope much reduced.

    • mapping.py is deleted (C-39) → the 20 mapping.py raises are moot.
    • unfao.py current raises: lines 70, 80, 108, 177, 182, 189, 194, 287.
      • Compliant (explicit log-before-raise): 177/182/189/194 (the _validate null/missing-column gates).
      • Logged via enclosing try/except: 108 (FileNotFoundError, inside _read_forecast_data's try that does logger.error(...); raise).
      • Still lacking any log-before: 3 raises — :70 (missing ensemble), :80 (missing loa), :287 (datasets None in _save).
    • New delivery/ invariants (coverage/identity/observed_range) raise representation-free by design; their manager call sites log context first (e.g. _check_coverage, _read_forecast_data identity log).
      Residual = the 3 manager raises above. Mechanical fix, Tier 3.
  2. added a commit that references this issue on Jun 27, 2026
  3. Polichinel commented on Jun 27, 2026

    @Polichinel
    CollaboratorAuthor

    Fixed and merged to development via #68 — the 3 manager raises now log-before-raise; the 20 mapping.py raises were moot (mapping.py deleted, C-39). Manager CIC §3 synced. Closing manually (auto-close keyword doesn't fire on development merges).

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