Files
weatherreporter/docs/internal/report-registry.md

72 lines
1.9 KiB
Markdown
Raw Normal View History

2026-05-29 17:17:50 +00:00
# Report Registry Internals
2026-05-29 19:54:22 +00:00
This document describes report identity, valid-period resolution, batch
membership, and comparison declarations in `internal/report`.
2026-05-29 17:17:50 +00:00
## Purpose
2026-05-29 19:54:22 +00:00
`internal/report` centralizes report definitions so report IDs, prompt IDs,
default output names, comparison strategies, and valid periods are declared in
one package.
2026-05-29 17:17:50 +00:00
2026-05-29 19:54:22 +00:00
## Inputs And Outputs
2026-05-29 17:17:50 +00:00
Inputs:
- report ID or batch name
- generation time
2026-05-29 19:54:22 +00:00
- timezone
2026-05-29 17:17:50 +00:00
- optional Daily date override
2026-05-29 19:54:22 +00:00
- optional Storm Report start and end times
2026-05-29 17:17:50 +00:00
Outputs:
- `report.Resolved` values with definition metadata and half-open valid periods
2026-05-29 19:54:22 +00:00
- `report.Metadata` values used by briefing and persisted metadata builders
2026-05-29 17:17:50 +00:00
## Boundaries
- This package defines report identity and time coverage only.
- It does not fetch weather data, build briefings, compare snapshots, write
2026-05-29 19:54:22 +00:00
state, parse CLI flags, or invoke Scriptorium.
## Config Fields Used
The app supplies `weather_api.timezone` as a loaded `time.Location`. Report
output path copying uses default output names from report definitions.
## External Adapters Used
None.
## State Or Manifest Behavior
None directly. Resolved metadata contributes RunID, report ID, prompt ID,
generation time, timezone, and valid period to later briefing and state
metadata.
## Skip And Resume Behavior
No resume behavior. Morning batch resolution skips Weekend Outlook on Sunday.
2026-05-29 17:17:50 +00:00
## Failure Behavior
2026-05-29 19:54:22 +00:00
- Unknown reports and batch names return actionable errors.
- Weekend Outlook resolution returns an error when resolved directly on Sunday.
- Storm Report resolution requires start and end, with end after start.
2026-05-29 17:17:50 +00:00
## Tests
Inspect:
- `internal/report/period_test.go`
- `internal/app/app_test.go`
2026-05-29 19:54:22 +00:00
- `internal/cli/root_test.go`
2026-05-29 17:17:50 +00:00
## Invariants
- Report selection goes through the registry.
2026-05-29 19:54:22 +00:00
- Daily Today and Daily Tomorrow both use `weather.daily_report`.
- Valid periods are half-open intervals independent of rendered report text.
- Comparison strategy is declared by report definition.