DetailsIsland.BindAsync churn (~1900 binds/day, 91-96% cancelled) was not a UI reactivity bug: OperationTiming.Shared is a static singleton hardcoded to ~/.todo-app/logs/operation-timing.ndjson, and Ui.Tests/Worker.Tests both construct real DetailsIslandViewModel/TasksIslandViewModel instances that call Shared.Record directly. Every dotnet test run appended 50-100 lines straight into the live app's log — pid-burst analysis showed 13 distinct test-run pids in the ":?" bucket (tests never pass a source) plus a no-suffix bucket with no pid field at all (pre-dating the pid-per-line feature). Real user-driven binds that day: 4. Made Shared settable and added a [ModuleInitializer]-based TestSetup in both test projects that redirects it to a per-process temp file before any test runs.
20 lines
872 B
C#
20 lines
872 B
C#
using System.Runtime.CompilerServices;
|
|
using ClaudeDo.Ui.Services;
|
|
|
|
namespace ClaudeDo.Worker.Tests;
|
|
|
|
internal static class TestSetup
|
|
{
|
|
// Runs once when this test assembly loads, before any test executes. UiVm/*Tests.cs construct
|
|
// real TasksIslandViewModel instances, whose LoadForListAsync/ReorderAsync/ReconcileTickAsync
|
|
// call OperationTiming.Shared.Record directly — without a redirect those writes land in the
|
|
// live app's ~/.todo-app/logs/operation-timing.ndjson (see ClaudeDo.Ui.Tests' TestSetup for
|
|
// the same trap on the Ui.Tests side).
|
|
[ModuleInitializer]
|
|
internal static void RedirectOperationTimingAwayFromRealAppData()
|
|
{
|
|
var path = Path.Combine(Path.GetTempPath(), "claudedo-worker-tests", $"operation-timing-{Environment.ProcessId}.ndjson");
|
|
OperationTiming.Shared = new OperationTiming(path);
|
|
}
|
|
}
|