4.0 KiB
Report Registry Internals
internal/report owns the registry of report identities and the data declared
for each one: resolution, generation mode, prompt identity, 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
mode, optional 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 | Mode | Period policy | Comparison | Registry batch flag | Output copy |
|---|---|---|---|---|---|
daily |
Generated text + template | Explicit local civil day | Same valid date | Dynamic Daily inclusion is app-owned | daily.md |
today |
Generated text + template | Selected or current local civil day | Same valid date | Morning | today.md |
tomorrow |
Generated text + template | Next local civil day | Same valid date | Evening | tomorrow.md |
hourly |
Generated text + template | Rolling six-hour interval | Rolling window | — | hourly.md |
three_day |
Scriptorium Markdown | Generation time through the third following local midnight | Same valid date | Morning | three-day.md |
weekend |
Scriptorium Markdown | Upcoming weekend window | Weekend window | Morning | weekend.md |
storm |
Scriptorium Markdown | Caller-supplied event window | Explicit window | — | storm.md |
The four generated-text reports pair their report ID with matching template and schema IDs. The three direct-Markdown reports leave both IDs empty. Exact template fields and schema assets belong to report templates and generated-text internals.
All valid periods are half-open. Storm accepts local YYYY-MM-DDTHH:MM values
in the effective report timezone or offset-bearing RFC3339 values; its end
must follow its start. Resolving Weekend directly on Sunday is rejected.
Registry collaborators
DefaultRegistry is the only source of the seven 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, Generated, and comparison compatibility
are likewise consumed by state and orchestration rather than recomputed there.
Unknown report IDs or batch names, an invalid weekend resolution, and invalid storm windows return errors. The registry never collects weather data, builds modules, parses CLI flags, writes state, executes Scriptorium, 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.