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

100 lines
3.6 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
2026-05-29 20:49:19 +00:00
membership, output naming, artifact grouping, and comparison declarations in
`internal/report`.
2026-05-29 17:17:50 +00:00
## Purpose
2026-05-29 20:49:19 +00:00
`internal/report` is the canonical source for report definitions. App, state,
2026-06-09 21:42:38 +00:00
module building, and CLI wiring consume resolved definitions instead of owning
report identity policy themselves.
2026-05-29 17:17:50 +00:00
2026-05-29 20:49:19 +00:00
## Definition Fields
2026-05-29 17:17:50 +00:00
2026-05-29 20:49:19 +00:00
Each report definition declares:
2026-05-29 17:17:50 +00:00
2026-05-29 20:49:19 +00:00
- report ID and display name
- Scriptorium prompt ID
- valid-period resolver
- comparison strategy
- managed artifact group
- batch output copy filename
- generated-report eligibility
- prior-report compatibility list
- morning or evening batch membership
- default ordered module composition
2026-05-29 17:17:50 +00:00
2026-06-09 21:42:38 +00:00
## Reports
2026-05-29 17:17:50 +00:00
2026-05-29 20:49:19 +00:00
| Report | ID | Prompt | Artifact group | Batch copy | Prior compatibility |
| --- | --- | --- | --- | --- | --- |
| Daily Today | `daily_today` | `weather.daily_report` | `daily` | `daily.md` | Daily Today, Daily Tomorrow |
| Daily Tomorrow | `daily_tomorrow` | `weather.daily_report` | `daily` | `tomorrow.md` | Daily Today, Daily Tomorrow |
| 3-Day Outlook | `three_day` | `weather.three_day_outlook` | `three-day` | `three-day.md` | 3-Day Outlook |
| Weekend Outlook | `weekend` | `weather.weekend_outlook` | `weekend` | `weekend.md` | Weekend Outlook |
| Storm Report | `storm` | `weather.storm_report` | `storm` | `storm.md` | Storm Report |
2026-05-29 17:17:50 +00:00
2026-06-09 21:42:38 +00:00
All report definitions are eligible for generation.
2026-05-29 17:17:50 +00:00
2026-05-29 20:49:19 +00:00
## Valid Periods
2026-05-29 19:54:22 +00:00
2026-05-29 20:49:19 +00:00
- Daily Today covers the selected local civil day, or the current local civil
day when no date override is supplied.
- Daily Tomorrow covers the next local civil day from generation time.
- 3-Day Outlook covers the interval from generation time through local midnight
three days later.
- Weekend Outlook covers the upcoming weekend window and is not scheduled for
Sunday morning batch resolution.
- Storm Report covers an explicit event window supplied by the caller.
2026-05-29 19:54:22 +00:00
2026-05-29 20:49:19 +00:00
Storm event windows can be parsed from local `YYYY-MM-DDTHH:MM` timestamps in
the configured timezone or RFC3339 timestamps with explicit offsets. End time
must be after start time.
2026-05-29 19:54:22 +00:00
2026-05-29 20:49:19 +00:00
## Boundaries
2026-05-29 19:54:22 +00:00
2026-05-29 20:49:19 +00:00
`internal/report` defines report metadata and time coverage. It does not fetch
2026-06-09 21:42:38 +00:00
weather data, build module values, compare snapshot contents, write state,
parse CLI flags, or invoke Scriptorium.
2026-05-29 19:54:22 +00:00
2026-05-29 20:49:19 +00:00
The CLI owns public command names. The app maps those command names to report
IDs, then uses the registry for report policy.
2026-05-29 19:54:22 +00:00
2026-05-29 20:49:19 +00:00
## Config Fields Used
The app supplies `weather_api.timezone` as a loaded `time.Location`. Batch
output path copying uses batch output names from report definitions.
2026-05-29 19:54:22 +00:00
2026-05-29 20:49:19 +00:00
## State And App Usage
2026-05-29 19:54:22 +00:00
2026-05-29 20:49:19 +00:00
- State paths use `ArtifactGroup`.
- Batch output copies use `BatchOutputName`.
- Generation checks `Generated`.
- Module composition defaults use `Modules`.
2026-05-29 20:49:19 +00:00
- Prior lookup checks `CompatiblePriorIDs` and the comparison strategy.
- RunIDs include the resolved report ID.
2026-05-29 17:17:50 +00:00
## Failure Behavior
2026-05-29 20:49:19 +00:00
- Unknown report IDs and batch names return actionable errors.
2026-05-29 19:54:22 +00:00
- 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.
2026-05-29 20:28:06 +00:00
- Artifact grouping, batch output filenames, generated-report eligibility,
default module composition, comparison compatibility, and comparison strategy
are declared by report definition.