@devries-cameron20 / t3code Mirror · read-only / commits / e858ddb656
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 16:45 UTC

test(usage): usage service tests keep their state directory until cache writes land (#17636)

Tristan Knight committed Oct 10, 2026 at 03:09 UTC e858ddb65668d54be5de3996f30c0bd5c3149657
1 file changed +4 -6
apps/server/src/usage/UsageService.test.ts
+4 -6
@@ -132,7 +132,9 @@ const layerService = (input: {
132 Layer.provideMerge(ProviderHostLive.layer),
133 Layer.provideMerge(Layer.mock(BackgroundPolicy.BackgroundPolicy)({})),
134 Layer.provideMerge(Layer.mock(ServerSecretStore.ServerSecretStore)({})),
135 - Layer.provideMerge(ServerConfig.layerTest(process.cwd(), { prefix: input.prefix })),
135 + Layer.provideMerge(
136 + ServerConfig.layerTest(process.cwd(), NodePath.join(input.home, input.prefix)),
137 + ),
138 Layer.provideMerge(NodeServices.layer),
139 Layer.provideMerge(Layer.succeed(HostProcess.Platform, input.platform ?? "linux")),
140 Layer.provideMerge(ServerSettings.layerTest(input.settings)),
@@ -1203,8 +1205,7 @@ describe("UsageService", () => {
1205 return text;
1206 });
1207
1206 - const restarted = yield* UsageService.make;
1207 - const summary = yield* restarted.readSummary(WINDOW);
1208 + const summary = yield* (yield* UsageService.make).readSummary(WINDOW);
1209 // The live rollout re-parses at the ultrafast rate (10 x 6); the
1210 // deleted one keeps its saved v4 usage at the standard rate (20 x 1).
1211 assert.strictEqual(totalOutputTokens(summary), 30);
@@ -1217,9 +1218,6 @@ describe("UsageService", () => {
1218 yield* Effect.promise(() => NodeFSP.readFile(legacyPath, "utf8")),
1219 legacy,
1220 );
1220 - // The migrated cache is written in the background; let it land before
1221 - // the layer removes the state directory under it.
1222 - yield* restarted.awaitPersisted;
1221 }).pipe(
1222 Effect.provide(
1223 layerService({