Skip to content

fix(weather): guard the single clock reading on the weather view - #143

Merged
prorochestvo merged 2 commits into
alphafrom
fix/weather-service-clock-seam
Aug 24, 2026
Merged

fix(weather): guard the single clock reading on the weather view#143
prorochestvo merged 2 commits into
alphafrom
fix/weather-service-clock-seam

Conversation

@prorochestvo

Copy link
Copy Markdown
Owner

Two follow-ups recorded during the outlook review, neither of which had an owner until now.

The clock seam (was: the one fix that shipped without a guard)

Hoisting time.Now out of ObtainMeCurrent's per-city loop was correct and untested. Moving
the call back inside passed the entire suite, so the next refactor could undo it in silence
and two cities either side of a midnight would be handed baselines a calendar day apart
inside one response — each one's 16-day window starting somewhere different.

weather.Service now takes the clock seam chart.NewService and digest.NewService already
use: an explicit trailing now func() time.Time, wired as time.Now in cmd/web. No new
pattern invented.

The guard hands it a clock that steps over a local midnight between calls and asserts two
things — both cities were measured against the same instant, and the clock was read exactly
once. Verified by re-inlining the call per city: both assertions fail.

stubForecasts now records the window lower bound of every call, which is what makes the
baseline observable from outside at all.

The log line

The forecast agent gained a deferred= field in #138. Two places quoted the old
healthy-looking line — the decoder comment explaining why an unstorable batch must be an error,
and the same passage in beacon-collection. Both now quote what the collector actually
prints. Nothing parses the format: a grep for the old form outside the frozen plans returns
nothing.

Gate

go vet, scripts/lint-checks.sh and golangci-lint clean; 41 packages green.

Refs #127, #132

prorochestvo and others added 2 commits August 24, 2026 05:42
Hoisting time.Now out of the per-city loop shipped without a test: moving
the call back inside passed the whole suite, so the next refactor could
undo it silently and two cities either side of a midnight would get
baselines a calendar day apart inside one response.

Give the service the clock seam chart.NewService and digest.NewService
already use — an explicit trailing now func() time.Time, time.Now in
cmd/web. The guard hands it a clock that steps over a local midnight
between calls and asserts both cities were measured against the same
instant, and that the clock was read exactly once.

The forecast stub now records the window lower bound of every call,
which is what makes the baseline observable from outside at all.

Refs: #127

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U6jNuzK5PZrhDWBxB3t2gY
The forecast agent gained a deferred= field when failed fetches started
being throttled, so the two places quoting the healthy-looking line —
the decoder comment that explains why an unstorable batch must be an
error, and the same passage in the collection skill — were describing a
line the collector no longer prints.

Nothing parses the format; a grep for the old form outside the frozen
plans now returns nothing.

Refs: #132

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U6jNuzK5PZrhDWBxB3t2gY
@prorochestvo
prorochestvo merged commit 5ae33df into alpha Aug 24, 2026
1 check passed
@prorochestvo
prorochestvo deleted the fix/weather-service-clock-seam branch August 30, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant