carlos / platform Public

console: the walk's log lines share a clock hour, so the session count does not depend on the time of day

The Logs poll reads from a second before its cursor (the newer of the
two seeded lines). With the lines at now-10m and now-5m, a run in
minutes 5 to 9 of an hour put them in different hours, the poll skipped
the chunk's hour, and the session counted 996 instead of 1000. They are
now two seconds apart in one hour. The ceiling stays 1000.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev b070ef8c558fa58f2f3115c41dabcfa10dc55d62 parent 64c0e3b
1 file changed, +11 −3
  • internal/console/perfwalk_test.go +11 −3

CI failed — run details

diff --git a/internal/console/perfwalk_test.go b/internal/console/perfwalk_test.go
index d9c9285d7..c3ddb16bb 100644
--- a/internal/console/perfwalk_test.go
+++ b/internal/console/perfwalk_test.go
@@ -281,10 +281,18 @@ func perfSeed(t *testing.T, fx *consoleFixture, seeds *perfSeeds) {
}
seedFleetJSON(t, fx)
- // One log chunk, one error chunk and one analytics day for kass.
+ // One log chunk, one error chunk and one analytics day for kass. The
+ // two log lines sit two seconds apart in one clock hour: the Logs
+ // tab's poll reads from a second before its cursor (the newer line),
+ // so lines in different hours would make the poll skip the chunk's
+ // hour at some times of day and read it at others.
+ logAt := now.Add(-10 * time.Minute)
+ if applog.HourOf(logAt) != applog.HourOf(logAt.Add(2*time.Second)) {
+ logAt = logAt.Add(-2 * time.Second)
+ }
recs := []applog.Record{
- {TS: now.Add(-10 * time.Minute), Box: "box-a", Host: "kass.carlosapp.dev", Stream: applog.StreamApp, Msg: "listening on socket", Seq: 100},
- {TS: now.Add(-5 * time.Minute), Box: "box-a", Host: "kass.carlosapp.dev", Stream: applog.StreamPlatform, Level: applog.LevelError,
+ {TS: logAt, Box: "box-a", Host: "kass.carlosapp.dev", Stream: applog.StreamApp, Msg: "listening on socket", Seq: 100},
+ {TS: logAt.Add(2 * time.Second), Box: "box-a", Host: "kass.carlosapp.dev", Stream: applog.StreamPlatform, Level: applog.LevelError,
Msg: "wake failed: nothing is promoted for this instance's channel", Seq: 101},
}
body, err := applog.EncodeChunk(recs)