PR #19791 cache cleanup proof Linux x64, Node 24.21.0, installed Effect 4.0.5 Base: 1451e7cb23034d29774338608368a15d8845df36 Six consumers share the same cache service. Phases: before activation, activation, 59 minutes, one hour, two hours, two hours after owning scope closes. Main: [0,6,6,12,18,18] Fixed: [0,1,1,2,3,3] The lifecycle uses Deferred activation, TestClock, and an instrumented empty directory. The separate existing real-filesystem test verifies expiration/deletion. The fallback test uses a real file blocking directory initialization and checks cached reads, invalidation, and zero scans. This is test-level proof, not a trace of a live instance or a real-time hourly soak. MAIN FAILURE OUTPUT Command: ['./node_modules/.bin/vp', 'test', 'run', 'apps/server/src/pullRequest/PullRequestReadCache.test.ts', '-t', 'shares one scoped prune loop|uses memory without starting cleanup', '--reporter=verbose'] note: You are running `vp test` as a Vite+ built-in command. If you meant to run the test npm script, use `vpr test` instead. RUN v5.0.1 /home/ubuntu/wt/pull-request-06 stdout | apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > shares one scoped prune loop across cache layer consumers [09:25:06.410] ERROR (#10): Error [AssertionError]: expected [ +0, 6, 6, 12, 18, 18 ] to deeply equal [ +0, 1, 1, 2, 3, 3 ] at /home/ubuntu/wt/pull-request-06/apps/server/src/pullRequest/PullRequestReadCache.test.ts:110:14 { actual: [ 0, 6, 6, 12, 18, 18 ], expected: [ 0, 1, 1, 2, 3, 3 ], showDiff: true, operator: 'deepStrictEqual', [cause]: undefined } ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > prunes entry files written before the max age and keeps fresh ones × apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > shares one scoped prune loop across cache layer consumers 33ms → expected [ +0, 6, 6, 12, 18, 18 ] to deeply equal [ +0, 1, 1, 2, 3, 3 ] ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > uses memory without starting cleanup when the cache directory is unavailable 15ms ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > sweeps the cache directory every hour once the layer is built ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > reuses files after restart and respects the original expiry ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > clears in-flight reads before a new service can reuse them ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > invalidates only the changed scope across restarts and coalesces its next reads ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > shares a pending refresh without blocking an unrelated cached PR ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > compacts expired scope records without discarding fresh PR data ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > does not persist failed GitHub reads ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > resumes caching after a failed scope read ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > cancels abandoned reads without blocking invalidation ↓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > finishes the in-memory revision update when invalidation is canceled after writing ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯ FAIL apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > shares one scoped prune loop across cache layer consumers AssertionError: expected [ +0, 6, 6, 12, 18, 18 ] to deeply equal [ +0, 1, 1, 2, 3, 3 ] - Expected + Received [ 0, - 1, - 1, - 2, - 3, - 3, + 6, + 6, + 12, + 18, + 18, ] ❯ apps/server/src/pullRequest/PullRequestReadCache.test.ts:110:14 108| ); 109| yield* TestClock.adjust("2 hours"); 110| assert.deepStrictEqual([...scanCounts, scans], [0, 1, 1, 2, 3, 3… | ^ 111| }).pipe( 112| Effect.scoped, ❯ IteratorImpl.~effect/Effect/successCont node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:1422:28 ❯ ExitPrimitive.~effect/Effect/evaluate node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/core.ts:585:30 ❯ FiberImpl.runLoop node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:654:41 ❯ FiberImpl.evaluate node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:595:23 ❯ FiberImpl.evaluate node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:589:27 ❯ node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:1159:17 ❯ Array. node_modules/.pnpm/effect@4.0.5/node_modules/effect/src/internal/effect.ts:804:44 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ Test Files 1 failed (1) Tests 1 failed | 1 passed | 11 skipped (13) Start at 09:25:04 Duration 2.04s (transform 58%, import 34%, setup 5%, tests 3%) RESTORED FIX OUTPUT note: You are running `vp test` as a Vite+ built-in command. If you meant to run the test npm script, use `vpr test` instead. RUN v5.0.1 /home/ubuntu/wt/pull-request-06 ✓ apps/server/src/serverActivation.test.ts > proves a root is parked before returning and releases it with one gate 8ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > prunes entry files written before the max age and keeps fresh ones 24ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > shares one scoped prune loop across cache layer consumers 15ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > uses memory without starting cleanup when the cache directory is unavailable 10ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > sweeps the cache directory every hour once the layer is built 11ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > reuses files after restart and respects the original expiry 8ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > clears in-flight reads before a new service can reuse them 6ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > invalidates only the changed scope across restarts and coalesces its next reads 22ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > shares a pending refresh without blocking an unrelated cached PR 5ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > compacts expired scope records without discarding fresh PR data 76ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > does not persist failed GitHub reads 4ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > resumes caching after a failed scope read 1ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > cancels abandoned reads without blocking invalidation 1ms ✓ apps/server/src/pullRequest/PullRequestReadCache.test.ts > PR filesystem cache > finishes the in-memory revision update when invalidation is canceled after writing 2ms Test Files 2 passed (2) Tests 14 passed (14) Start at 09:25:32 Duration 2.13s (transform 46%, import 36%, tests 9%, setup 9%)