Files
weatherreporter/docs/internal/changes.md

75 lines
2.2 KiB
Markdown
Raw Normal View History

2026-05-29 17:53:03 +00:00
# Changes Internals
This document describes the implemented structured change comparison boundary.
## Purpose
`internal/changes` compares current and prior structured briefing snapshots and
produces compact change records for prompt input data packages.
## Inputs and Outputs
Inputs:
2026-05-29 18:08:50 +00:00
- prior briefing package
- current briefing package
2026-05-29 17:53:03 +00:00
- configured Recent Changes thresholds
Output:
- ordered `changes.Change` records with type, message, previous value, and
current value where useful
## Boundaries
- This package compares structured briefing data only.
- It does not read state directly, render Markdown, invoke `scriptorium`, or
compare generated report text.
## Config Fields Used
The app maps these config fields into comparison thresholds:
- `recent_change.temperature_degrees`
- `recent_change.precip_probability_points`
- `recent_change.wind_gust_miles_per_hour`
- `recent_change.precip_timing_shift_minutes`
## Behavior
2026-05-29 18:16:10 +00:00
Daily, 3-Day, and Weekend comparison currently detect:
2026-05-29 17:53:03 +00:00
- temperature changes crossing configured thresholds
- precipitation probability and timing changes
- alert additions and removals
- peak wind gust changes
- snow, ice, and thunder risk changes
When no prior comparable snapshot exists, the app sends an empty Recent Changes
2026-05-29 18:00:27 +00:00
section in the data package. Daily Today and Daily Tomorrow are compatible for
2026-05-29 18:08:50 +00:00
same-valid-date comparison through the report registry. 3-Day Outlook compares
2026-05-29 18:16:10 +00:00
with prior 3-Day Outlook snapshots for the same valid local date. Weekend
Outlook compares with prior Weekend Outlook snapshots for the same weekend
window.
2026-05-29 17:53:03 +00:00
## Failure Behavior
2026-05-29 18:08:50 +00:00
Daily comparison requires both inputs to contain Daily briefing content. 3-Day
2026-05-29 18:16:10 +00:00
comparison requires both inputs to contain 3-Day briefing content. Weekend
comparison requires both inputs to contain Weekend briefing content.
2026-05-29 17:53:03 +00:00
## Tests
Inspect:
- `internal/changes/daily_test.go`
2026-05-29 18:08:50 +00:00
- `internal/changes/three_day_test.go`
2026-05-29 18:16:10 +00:00
- `internal/changes/weekend_test.go`
2026-05-29 17:53:03 +00:00
- `internal/app/app_test.go`
## Invariants
- Recent Changes are based on structured snapshots, not Markdown report text.
- Comparison thresholds come from configuration.
- The comparison output remains compact enough for prompt input.