Repository navigation
test(server): pin clock in saved-usage window test - #261
Conversation
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 1280ccd)
|
Code quality review of The diff matches upstream's 1280ccd line for line, and it uses the same The file's other hard-coded 2026-08 timestamps read live transcripts, not saved usage past retention, so they aren't affected by this time bomb. |
NoahHendrickson
left a comment
There was a problem hiding this comment.
Reviewed commit 1d204b6bc3c67cfe80a47c6e5b56f1693cdcdacf against base 1cbd9f2bab5d10ae81dc40297fbf92f23ba10136.
No actionable findings. The test-scoped TestClock pins the retention cutoff within 92 days of the fixture's file timestamp and preserves the assertions for both query windows. Production code is unchanged.
Validation: vp test run apps/server/src/usage/UsageService.test.ts -t "reports saved usage of a removed directory only for windows it reaches" passed (1 passed, 39 skipped).
NoahHendrickson
left a comment
There was a problem hiding this comment.
Code review — commit 1d204b6
No issues found.
-
Matches upstream. The diff is the same as upstream 1280ccd (pingdotgg#28603). Only the line offsets differ.
-
The fix works.
UsageServicegets "now" fromClock.currentTimeMillis(UsageService.ts:664), and the retention cutoff is derived from it (:678). Wrapping the case inTestClock.layer()and setting the clock to 2026-08-15 puts the 2026-08-01 transcript inside the 92-day window no matter what the real date is. The file already uses this pattern for the Cursor case (UsageService.test.ts:1255/:1284). -
Placement is fine.
Effect.provide(TestClock.layer())wraps the whole generator, so the clock is frozen forsetupandUsageService.maketoo. Nothing in this path sleeps on the clock, and the case passes. -
Local run (macOS, this commit): the target case passes. In the full file, 38 of 40 tests pass. The two failures don't involve dates:
discovers Pi history…: a/private/varvs/vartmpdir realpath mismatch.retains Codex reconciliation…: also a path comparison (path === transcript,:2007).
Both fail the same way without this change and are macOS-specific.
Not blocking: other cases still hardcode 2026-08 fixtures (BEFORE_NARROW_WINDOW, the created/timestamp literals), but they don't depend on cache retention, so they shouldn't break with time. CI was still pending when this review was posted.
Reviewed by Claude Opus 5.5 (Claude Code).
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
Problem
UsageService.test.ts > reports saved usage of a removed directory only for windows it reacheswrites a transcript dated 2026-08-01 10:00 UTC, and the usage cache keeps files for 92 days (CACHE_RETENTION_DAYS). As of 2026-11-01 10:00 UTC the saved usage is past retention, so the test fails on every branch (it's failingTest Server 7on #260).Change
Cherry-picks upstream's fix, 1280ccd (pingdotgg#28603), which pins the test clock near the write.
Verification
🤖 Generated with Claude Code