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

3.6 KiB

Report Registry Internals

internal/report owns the registry of report identities and the data declared for each one: resolution, prompt identity and version, comparison policy, artifact group, output-copy name, default module composition, and Distributor path declarations. The public command syntax is owned by the CLI reference; configuration aliases and overrides are owned by the configuration reference.

Definitions and resolution

Each Definition declares a stable ID and display name, prompt ID, generation version, template and generated-text schema IDs, valid-period resolver, comparison strategy, artifact group, batch-copy filename, Distributor path templates, generation eligibility, compatible prior IDs, default modules, and batch eligibility flags. Resolved combines that definition with the valid period and run metadata for one invocation.

Report ID Prompt version Default profile Period policy Comparison Registry batch flag Output copy
daily 1.1.0 weather-balanced Explicit local civil day Same valid date Dynamic Daily inclusion is app-owned daily.md
today 1.1.0 weather-balanced Selected or current local civil day Same valid date Morning today.md
tomorrow 1.1.0 weather-balanced Next local civil day Same valid date Evening tomorrow.md
hourly 1.1.0 weather-light Rolling six-hour interval Rolling window hourly.md

Each report pairs its ID and prompt version with matching template and schema IDs. Exact template fields and schema assets belong to report templates and generated-text internals. Prompt assets own default profile selection; the registry deliberately stores no provider setting. The Promptkit integration guide owns profile definitions and resolution.

All valid periods are half-open.

Registry collaborators

DefaultRegistry is the only source of the four report definitions. Lookup, Resolve, and report-name helpers prevent callers from duplicating report identity rules. Registry overrides clone a definition and replace its module list only after the report ID is recognized.

The definition's DistributorPathTemplates are internal declarations consumed by app orchestration. Their rendered external bundle paths and compatibility contract are documented in the Distributor bundle guide, not repeated here.

morning and evening are registry-owned batch names. Registry flags declare fixed report eligibility; app orchestration determines data-dependent Daily membership and produces the actual batch plan.

Module composition and failures

Each definition supplies an ordered []module.ConfigItem; the complete report-to-module mapping is maintained in module internals. ArtifactGroup, BatchOutputName, and comparison compatibility are likewise consumed by state and orchestration rather than recomputed there.

Unknown report IDs or batch names return errors. The registry never collects weather data, builds modules, parses CLI flags, writes state, executes Promptkit, or delivers a report.

Verification and invariants

Focused tests cover definition completeness, command and alias lookup, period resolution, run IDs, path declarations, composition defaults, and override validation:

go test ./internal/report

All report selection goes through the registry, and the registry is the source of truth for report identity—not rendered report text or app-local constants.