Files
weatherreporter/docs/internal/changes.md

2.0 KiB

Changes Internals

This document describes structured Recent Changes comparison.

Purpose

internal/changes compares current and prior module snapshots and emits compact change records for prompt input data packages.

Inputs And Outputs

Inputs:

  • prior module snapshot
  • current module snapshot
  • comparison thresholds from configuration

Outputs:

  • ordered changes.Change items with type, message, previous value, and current value where useful

Boundaries

  • This package compares structured module snapshot data only.
  • It does not read filesystem state, find prior snapshots, render Markdown, invoke Scriptorium, or compare generated report text.

Config Fields Used

The app maps these 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

External Adapters Used

None.

State Or Manifest Behavior

None directly. The app loads prior module snapshots through internal/state before calling comparison functions.

Skip And Resume Behavior

No resume behavior. When the app has no prior comparable snapshot, it sends an empty Recent Changes list without calling a comparison function.

Failure Behavior

  • Daily comparison requires derived_daily_summary and derived_daypart_summaries stanzas. It also uses alert_digest and precip_timing when present.
  • 3-Day comparison requires derived_daypart_summaries.
  • Weekend comparison requires derived_daypart_summaries.
  • Storm Report currently has no comparison implementation, so the app leaves Recent Changes empty for Storm reports.

Tests

Inspect:

  • internal/changes/daily_test.go
  • internal/changes/three_day_test.go
  • internal/changes/weekend_test.go
  • internal/app/app_test.go

Invariants

  • Recent Changes are based on structured snapshots, not Markdown report text.
  • Report compatibility is determined outside this package by report definitions and state lookup.
  • Output stays compact enough for prompt input.