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 21, 21:00 UTC
fix(server): favicon lookups for a missing project folder are cached (#34905)
Julius Marminge committed
Nov 12, 2026 at 00:00 UTC
c9211b6abba9dbf00543f505a1a57c6912dc1d2e
2 files changed
+28
-2
apps/server/src/project/ProjectFaviconResolver.test.ts
+23
-1
@@ -43,7 +43,7 @@ const writeTextFile = Effect.fn("writeTextFile")(function* (
43
44
const makeResolverWithFileSystem = (fileSystem: FileSystem.FileSystem) =>
45
ProjectFaviconResolver.make.pipe(
46
- Effect.provide([WorkspacePaths.layer, T3ProjectFileLoader.layer]),
46
+ Effect.provide([Layer.fresh(WorkspacePaths.layer), T3ProjectFileLoader.layer]),
47
Effect.provideService(FileSystem.FileSystem, fileSystem),
48
);
49
@@ -81,6 +81,28 @@ it.layer(layerTest)("ProjectFaviconResolverLive", (it) => {
81
}).pipe(Effect.provide(TestClock.layer())),
82
);
83
84
+ it.effect("looks up a missing workspace root once within the negative cache window", () =>
85
+ Effect.gen(function* () {
86
+ const fileSystem = yield* FileSystem.FileSystem;
87
+ const path = yield* Path.Path;
88
+ const cwd = path.join(yield* makeTempDir, "deleted-project");
89
+ let rootStats = 0;
90
+ const resolver = yield* makeResolverWithFileSystem(
91
+ FileSystem.FileSystem.of({
92
+ ...fileSystem,
93
+ stat: (filePath) => {
94
+ if (filePath === cwd) rootStats += 1;
95
+ return fileSystem.stat(filePath);
96
+ },
97
+ }),
98
+ );
99
+
100
+ yield* Effect.exit(resolver.resolvePath(cwd));
101
+ yield* Effect.exit(resolver.resolvePath(cwd));
102
+ expect(rootStats).toBe(1);
103
+ }),
104
+ );
105
+
106
it.effect("prefers a t3.json iconPath over well-known files", () =>
107
Effect.gen(function* () {
108
const resolver = yield* ProjectFaviconResolver.ProjectFaviconResolver;
apps/server/src/project/ProjectFaviconResolver.ts
+5
-1
@@ -1,4 +1,5 @@
1
import * as Cache from "effect/Cache";
2
+import * as Cause from "effect/Cause";
3
import * as Context from "effect/Context";
4
import * as Duration from "effect/Duration";
5
import * as Effect from "effect/Effect";
@@ -304,7 +305,10 @@ export const make = Effect.gen(function* () {
305
timeToLive: Exit.match({
306
onSuccess: (value: string | null) =>
307
value === null ? FAVICON_NEGATIVE_CACHE_TTL : FAVICON_POSITIVE_CACHE_TTL,
307
- onFailure: () => Duration.zero,
308
+ onFailure: (cause) =>
309
+ Option.exists(Cause.findErrorOption(cause), isMissingWorkspaceRoot)
310
+ ? FAVICON_NEGATIVE_CACHE_TTL
311
+ : Duration.zero,
312
}),
313
},
314
);