app: render the panel with an injected clock so tests do not depend on the date (#12)

The headless forecast test failed from 2026-10-16 on because the panel
read the real clock while its fixture fixes the time.

- App: PanelWindow takes an optional TimeProvider (the system clock by
  default) and passes it to the pace bar, burn-up, peak and usage charts
  and every forecast label. The burn-up chart uses the panel's render
  time as now.
- Tests: headless panels run on a fixed clock at fixture time, with a
  check before, at and after the forecast start. App and Core tests
  with fixed-date Claude events pin HistoryStore's clock, so the 60-day
  retention cannot drop them later.

Closes #11
This commit was merged in pull request #12.
This commit is contained in:
2026-10-17 09:28:15 +02:00
parent adb8f5b88d
commit d5ad3ecee9
12 changed files with 90 additions and 65 deletions
+2 -2
View File
@@ -90,11 +90,11 @@ public class ReworkTests
using var directory = new TestDirectory();
var source = directory.Write("claude/projects/p/a.jsonl", Fixtures.Claude());
var log = new DiagnosticLog();
var store = new HistoryStore(directory.Path, log);
var store = new HistoryStore(directory.Path, log, new TestClock());
var scanner = new IncrementalScanner(store, log, Path.Combine(directory.Path, "claude"), directory.Path);
Assert.Equal(1, (await scanner.ScanAsync(TestContext.Current.CancellationToken)).AddedEvents);
await store.SaveAsync(TestContext.Current.CancellationToken);
store = new(directory.Path, log);
store = new(directory.Path, log, new TestClock());
scanner = new(store, log, Path.Combine(directory.Path, "claude"), directory.Path);
using var exclusive = new FileStream(source, FileMode.Open, FileAccess.Read, FileShare.None);
Assert.Equal(0, (await scanner.ScanAsync(TestContext.Current.CancellationToken)).AddedEvents);