Skip to content

test(stats): pin the relay client's clock to the fake gateway's - #1825

Merged
frahlg merged 1 commit into
masterfrom
fix/statsrelay-test-clock
Oct 25, 2026
Merged

frahlg merged 1 commit into
masterfrom
fix/statsrelay-test-clock

Conversation

@frahlg

@frahlg frahlg commented Oct 25, 2026

Copy link
Copy Markdown
Member

Problem

Since 25 Oct 2026 every PR fails core (Go) in two tests from #1820:

  • internal/statsrelay TestAReportReachesTheGatewayThroughTheRelay: statsrelay: gateway answered 400
  • internal/energyreport TestABoxReportReachesTheGatewayThroughTheRelay: gateway got []

Master was green on 24 Oct, the day #1820 merged.

Cause

statsrelaytest.New gives the fake gateway a fixed clock (24 Oct in the statsrelay test, a fixed day in the energyreport test), but the client it returns stamps each report with time.Now(). From 25 Oct the gateway's freshness check (reportwire.Fresh) rejects the day, so it answers 400.

Production is unaffected: the box and the gateway both read the real clock.

Change

  • statsrelay.Client.WithClock sets the clock the client stamps reports with.
  • statsrelaytest.New returns a client on the gateway's clock.

No behaviour change in Core. Labelled no-changeset (test-only; the new method is used only by the test helper).

Evidence

go test ./internal/statsrelay/... ./internal/energyreport/ fails on master today and passes here; go vet clean.

🤖 Generated with Claude Code

The fake gateway's clock is fixed at 24 Oct 2026, but the client stamped
each report with the real day, so from 25 Oct the gateway judged every
test report stale and answered 400. statsrelaytest now gives the client
the gateway's clock. Production is unchanged: box and gateway both read
the real time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@frahlg frahlg added the no-changeset PR intentionally exempt from the changeset requirement (dev tooling / non-shipping) label Oct 25, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T08:15:58.566327Z 4fb1420 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@frahlg
frahlg merged commit 2e27505 into master Oct 25, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changeset PR intentionally exempt from the changeset requirement (dev tooling / non-shipping)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant