From 58f8b11dbb62f51f9b519ac2d3e6c52626172d22 Mon Sep 17 00:00:00 2001 From: mika kuns Date: Wed, 29 Jul 2026 12:10:58 +0200 Subject: [PATCH] fix(worker-tests): pin LogRingBuffer clock in Does_not_throw_when_detached The test built the buffer with the real DateTime.UtcNow clock but emitted an event with the file's fixed EvtTime timestamp (2026-06-23). As real time drifted more than the 1h window past that fixed timestamp, the just-appended record was evicted inside the same Append call, before Snapshot() ran. BroadcastLogSink.Emit itself buffers unconditionally regardless of attach state, so this was a test bug, not a sink bug. Pin the buffer's clock to EvtTime, matching every sibling test's NewSink setup. --- tests/ClaudeDo.Worker.Tests/Logging/BroadcastLogSinkTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ClaudeDo.Worker.Tests/Logging/BroadcastLogSinkTests.cs b/tests/ClaudeDo.Worker.Tests/Logging/BroadcastLogSinkTests.cs index 28274861..92c40934 100644 --- a/tests/ClaudeDo.Worker.Tests/Logging/BroadcastLogSinkTests.cs +++ b/tests/ClaudeDo.Worker.Tests/Logging/BroadcastLogSinkTests.cs @@ -98,7 +98,7 @@ public class BroadcastLogSinkTests [Fact] public void Does_not_throw_when_detached() { - var buffer = new LogRingBuffer(TimeSpan.FromHours(1)); + var buffer = new LogRingBuffer(TimeSpan.FromHours(1), utcNow: () => EvtTime.UtcDateTime); var sink = new BroadcastLogSink(buffer); sink.Emit(Evt(LogEventLevel.Error, "no subscriber"));