@devries-cameron20 / t3code-1 / commits / a0a0e94822
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

test(usage): v4 cache upgrade test waits for the migrated cache write (#17553)

Igor Makowski committed Oct 10, 2026 at 00:59 UTC a0a0e94822a0c675fbe0792ef94ff218101aeb66
1 file changed +5 -1
apps/server/src/usage/UsageService.test.ts
+5 -1
@@ -1175,7 +1175,8 @@ describe("UsageService", () => {
1175 return text;
1176 });
1177
1178 - const summary = yield* (yield* UsageService.make).readSummary(WINDOW);
1178 + const restarted = yield* UsageService.make;
1179 + const summary = yield* restarted.readSummary(WINDOW);
1180 // The live rollout re-parses at the ultrafast rate (10 x 6); the
1181 // deleted one keeps its saved v4 usage at the standard rate (20 x 1).
1182 assert.strictEqual(totalOutputTokens(summary), 30);
@@ -1188,6 +1189,9 @@ describe("UsageService", () => {
1189 yield* Effect.promise(() => NodeFSP.readFile(legacyPath, "utf8")),
1190 legacy,
1191 );
1192 + // The migrated cache is written in the background; let it land before
1193 + // the layer removes the state directory under it.
1194 + yield* restarted.awaitPersisted;
1195 }).pipe(
1196 Effect.provide(
1197 layerService({