authorgravatar for 56691628+Mnigos@users.noreply.github.comIgor Makowski <56691628+Mnigos@users.noreply.github.com> 2026-10-10 00:59:06+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-09 19:59:06-03:00
loga0a0e94822a0c675fbe0792ef94ff218101aeb66
tree165c319950db33e8440b4df04e6dc32d21980771
parent6586a01f41bd692f02d565d38f97b52a8067317e
signature Signed by PGP key B5690EEEBB952194

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


1 files changed, 5 insertions(+), 1 deletions(-)

apps/server/src/usage/UsageService.test.ts+5-1
...@@ -1175,7 +1175,8 @@ describe("UsageService", () => {...@@ -1175,7 +1175,8 @@ describe("UsageService", () => {
1175 return text;1175 return text;
1176 });1176 });
11771177
1178 const summary = yield* (yield* UsageService.make).readSummary(WINDOW);1178 const restarted = yield* UsageService.make;
1179 const summary = yield* restarted.readSummary(WINDOW);
1179 // The live rollout re-parses at the ultrafast rate (10 x 6); the1180 // The live rollout re-parses at the ultrafast rate (10 x 6); the
1180 // deleted one keeps its saved v4 usage at the standard rate (20 x 1).1181 // deleted one keeps its saved v4 usage at the standard rate (20 x 1).
1181 assert.strictEqual(totalOutputTokens(summary), 30);1182 assert.strictEqual(totalOutputTokens(summary), 30);
...@@ -1188,6 +1189,9 @@ describe("UsageService", () => {...@@ -1188,6 +1189,9 @@ describe("UsageService", () => {
1188 yield* Effect.promise(() => NodeFSP.readFile(legacyPath, "utf8")),1189 yield* Effect.promise(() => NodeFSP.readFile(legacyPath, "utf8")),
1189 legacy,1190 legacy,
1190 );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;
1191 }).pipe(1195 }).pipe(
1192 Effect.provide(1196 Effect.provide(
1193 layerService({1197 layerService({