From d6829af32beb35d4d42fe5226a84bb0c9e734079 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Thu, 13 Aug 2026 04:17:05 +0000 Subject: [PATCH] Remove unused alert envelope retention --- docs/internal/briefing.md | 2 ++ docs/internal/facts.md | 3 +++ docs/internal/weather-data.md | 4 ++++ internal/adapters/weatherapi/client.go | 3 +-- internal/weatherdata/bundle.go | 1 - 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/internal/briefing.md b/docs/internal/briefing.md index e070957..c7080f4 100644 --- a/docs/internal/briefing.md +++ b/docs/internal/briefing.md @@ -48,6 +48,8 @@ metadata summary, checked-empty alerts and SPC outlooks remain distinct from missing sources, and prompt-safe SPC values omit geometry and other template-only or source details. The complete module composition is in [module internals](module.md); fact derivation is in [fact contracts](facts.md). +Alert digests are built from selected alert items and source provenance, not a +provider response envelope. Derived daypart-summary maps use the forecast package's canonical daypart identity and reject any collision instead of replacing an earlier value. diff --git a/docs/internal/facts.md b/docs/internal/facts.md index ac313c1..1e44ed4 100644 --- a/docs/internal/facts.md +++ b/docs/internal/facts.md @@ -16,6 +16,9 @@ story, and convective outlook data. Source provenance and warnings are copied into their own slices so downstream consumers can inspect data completeness without treating it as an ordinary weather fact. +Alert facts retain individual alert payloads for period selection together with +their copied source provenance; they do not retain a provider response envelope. + A nil bundle produces an empty collected value. Collection itself, missing source policy, and source hashes are outside this package. diff --git a/docs/internal/weather-data.md b/docs/internal/weather-data.md index 485f6f3..0bc93c6 100644 --- a/docs/internal/weather-data.md +++ b/docs/internal/weather-data.md @@ -31,6 +31,10 @@ provider endpoint or retry policy from the normalized types. See [collection](collect.md) for assembly and [report templates](../templates.md) for the values exposed to authors. +An alert run retains its check time and individual alert payloads for overlap +selection. Its source entry retains provider provenance; the full provider +envelope is not carried into the normalized bundle. + ## Source provenance Every checked source is represented by a `Source` entry. The record identifies diff --git a/internal/adapters/weatherapi/client.go b/internal/adapters/weatherapi/client.go index 09fb548..22f8a34 100644 --- a/internal/adapters/weatherapi/client.go +++ b/internal/adapters/weatherapi/client.go @@ -308,7 +308,7 @@ func (b *bundleBuilder) fetchAlerts(acquired sourceAcquisition) error { } raw, source := fetched.raw, fetched.source if isJSONNull(raw) { - b.bundle.Alerts = &weatherdata.AlertRun{Raw: append(json.RawMessage(nil), raw...)} + b.bundle.Alerts = &weatherdata.AlertRun{} b.addSource(source) return nil } @@ -316,7 +316,6 @@ func (b *bundleBuilder) fetchAlerts(acquired sourceAcquisition) error { if err := decodeSource(raw, &alerts); err != nil { return b.handleMalformed(&source, err, acquired.request) } - alerts.Raw = append(json.RawMessage(nil), raw...) if alerts.AsOf != nil { source.IssuedAt = alerts.AsOf } diff --git a/internal/weatherdata/bundle.go b/internal/weatherdata/bundle.go index 7919a94..2e56871 100644 --- a/internal/weatherdata/bundle.go +++ b/internal/weatherdata/bundle.go @@ -148,7 +148,6 @@ func (p ForecastPeriod) HasValidPrecipitationProbability() bool { type AlertRun struct { AsOf *time.Time `json:"asOf,omitempty"` Alerts []json.RawMessage `json:"alerts,omitempty"` - Raw json.RawMessage `json:"raw,omitempty"` } type Discussion struct {