Add report registry and valid periods

This commit is contained in:
2026-05-29 17:17:50 +00:00
parent d494550b20
commit caf21dfedd
8 changed files with 763 additions and 6 deletions

View File

@@ -1,7 +1,8 @@
# Weatherreporter CLI
`weatherreporter` currently resolves configuration and command requests, then
returns a not-implemented error for report generation and scheduled runs.
`weatherreporter` currently resolves configuration, command requests, report
definitions, and valid periods, then returns a not-implemented error for report
generation and scheduled runs.
## Shortest Useful Command
@@ -9,8 +10,8 @@ returns a not-implemented error for report generation and scheduled runs.
weatherreporter generate daily --date 2026-05-29 --out ./daily.md
```
The command parses flags, loads configuration, resolves the request, and then
stops before weather data fetching or report rendering.
The command parses flags, loads configuration, resolves report identity and the
valid period, and then stops before weather data fetching or report rendering.
## Command Overview

View File

@@ -0,0 +1,63 @@
# Report Registry Internals
This document describes the implemented report identity and valid-period
boundary.
## Purpose
`internal/report` centralizes report IDs, prompt IDs, comparison strategies,
valid-period resolution, report metadata, and scheduled batch membership.
## Inputs and Outputs
Inputs:
- report ID or batch name
- generation time
- configured timezone
- optional Daily date override
- optional manual storm start and end times
Outputs:
- `report.Resolved` values with definition metadata and half-open valid periods
- `report.Metadata` values suitable for later persisted run metadata
## Boundaries
- This package defines report identity and time coverage only.
- It does not fetch weather data, build briefings, compare snapshots, write
state, or call `scriptorium`.
## Behavior
- Daily Today covers one configured local civil day.
- Daily Tomorrow covers the next configured local civil day.
- 3-Day Outlook covers generation time through local midnight after the second
following local civil day.
- Weekend Outlook covers Saturday 00:00 to Monday 00:00 Monday through
Thursday; Friday and Saturday cover the remaining weekend from Friday 18:00
or generation time, whichever is later.
- Manual Storm Report uses explicit start and end times.
- Morning batch resolves Daily Today and 3-Day Outlook, plus Weekend Outlook
except on Sunday.
- Evening batch resolves Daily Tomorrow.
## Failure Behavior
- Unknown report and batch names return actionable errors.
- Sunday Weekend Outlook resolution returns an error.
- Storm windows require start and end, with end after start.
## Tests
Inspect:
- `internal/report/period_test.go`
- `internal/app/app_test.go`
## Invariants
- Report selection goes through the registry.
- Valid periods are independent of rendered report text.
- Prompt IDs and comparison strategies are declared with report definitions.