session.Watchdog takes an Active func(time.Time) bool that decides when silence is suspicious. Nothing in the lab ever sets it.
cmd/oe-client/main.go leaves it nil with a comment explaining that the fake venue has no trading hours, and docs/drills/09 describes the failure mode at length. But a reader copying the watchdog into their own code gets the half that fires, not the half that decides when it is allowed to.
Why this is the half that bites
A watchdog treating every quiet moment as suspicious tears down healthy sessions during legitimate quiet — pre-open, a lunch auction, an instrument nobody is trading. Get the boundary wrong by an hour and it fires every single morning during pre-open, reconnects, and presents as an unstable venue. The watchdog then looks like the thing detecting a problem when it is the problem.
That failure is strictly harder to diagnose than having no watchdog, because the logs show it doing its job.
Proposed
A real, copyable implementation — a TradingHours helper in internal/session covering:
- Open and close in a named timezone, not UTC offsets, so daylight saving is handled rather than assumed
- Different windows per market segment, since equities and derivatives do not open together
- Weekends and a holiday list
Wire it into cmd/oe-client behind a flag so the shipped binary demonstrates both halves, and extend drill 09 with a test that walks a clock across a boundary and asserts the watchdog stays quiet on one side and fires on the other.
Acceptance
Active is set to something real in at least one shipped binary
- A test that crosses the boundary in both directions
- Drill 09 documents the failure with a worked example rather than only a warning
session.Watchdogtakes anActive func(time.Time) boolthat decides when silence is suspicious. Nothing in the lab ever sets it.cmd/oe-client/main.goleaves it nil with a comment explaining that the fake venue has no trading hours, anddocs/drills/09describes the failure mode at length. But a reader copying the watchdog into their own code gets the half that fires, not the half that decides when it is allowed to.Why this is the half that bites
A watchdog treating every quiet moment as suspicious tears down healthy sessions during legitimate quiet — pre-open, a lunch auction, an instrument nobody is trading. Get the boundary wrong by an hour and it fires every single morning during pre-open, reconnects, and presents as an unstable venue. The watchdog then looks like the thing detecting a problem when it is the problem.
That failure is strictly harder to diagnose than having no watchdog, because the logs show it doing its job.
Proposed
A real, copyable implementation — a
TradingHourshelper ininternal/sessioncovering:Wire it into
cmd/oe-clientbehind a flag so the shipped binary demonstrates both halves, and extend drill 09 with a test that walks a clock across a boundary and asserts the watchdog stays quiet on one side and fires on the other.Acceptance
Activeis set to something real in at least one shipped binary