From d62c97c7a7956913312400ac513f6dbbbc432366 Mon Sep 17 00:00:00 2001 From: Maxwell Weinzierl Date: Mon, 23 Nov 2026 16:10:21 -0800 Subject: [PATCH 1/3] t4: an empty file where a favicon folder should be is no favicon, not a warning every few seconds (AI-126) usa-rs has an empty `.idea` file, so v0.1.11's favicon lookup stat'ed `.idea/icon.svg`, got ENOTDIR (BadResource) and logged 'Failed to enrich optional project metadata' about 5 times a minute (~7,000 a day). ENOTDIR now reads as a missing path, like ENOENT. --- .../src/project/ProjectFaviconResolver.test.ts | 13 +++++++++++++ apps/server/src/project/ProjectFaviconResolver.ts | 11 ++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/apps/server/src/project/ProjectFaviconResolver.test.ts b/apps/server/src/project/ProjectFaviconResolver.test.ts index 973ef659655e0..372bc75aab184 100644 --- a/apps/server/src/project/ProjectFaviconResolver.test.ts +++ b/apps/server/src/project/ProjectFaviconResolver.test.ts @@ -65,6 +65,19 @@ it.layer(layerTest)("ProjectFaviconResolverLive", (it) => { }), ); + it.effect("skips a candidate under a file where its folder should be", () => + Effect.gen(function* () { + const resolver = yield* ProjectFaviconResolver.ProjectFaviconResolver; + const path = yield* Path.Path; + const cwd = yield* makeTempDir; + // An empty `.idea` file: stat of `.idea/icon.svg` fails with ENOTDIR. + yield* writeTextFile(cwd, ".idea", ""); + yield* writeTextFile(cwd, "AppIcon.icns", "icon"); + + expect(yield* resolver.resolvePath(cwd)).toBe(path.join(cwd, "AppIcon.icns")); + }), + ); + it.effect("falls back at once when a cached favicon is deleted", () => Effect.gen(function* () { const fileSystem = yield* FileSystem.FileSystem; diff --git a/apps/server/src/project/ProjectFaviconResolver.ts b/apps/server/src/project/ProjectFaviconResolver.ts index e9b8f6d6a9637..9232c6f6ed8f4 100644 --- a/apps/server/src/project/ProjectFaviconResolver.ts +++ b/apps/server/src/project/ProjectFaviconResolver.ts @@ -10,6 +10,7 @@ import * as Layer from "effect/Layer"; import * as Option from "effect/Option"; import * as Path from "effect/Path"; import * as PlatformError from "effect/PlatformError"; +import * as Predicate from "effect/Predicate"; import * as Schema from "effect/Schema"; import * as WorkspacePaths from "../workspace/WorkspacePaths.ts"; @@ -130,6 +131,12 @@ function extractIconHref(source: string): string | null { return null; } +// t4 fork: a file where the path needs a folder (an empty `.idea` file) means the path is absent too. +const isNotDirectory = (error: PlatformError.PlatformError) => + error.reason._tag === "BadResource" && + Predicate.hasProperty(error.reason.cause, "code") && + error.reason.cause.code === "ENOTDIR"; + export const optionOnNotFound = ( effect: Effect.Effect, ): Effect.Effect, PlatformError.PlatformError, R> => @@ -137,7 +144,9 @@ export const optionOnNotFound = ( Effect.asSome, Effect.catchTags({ PlatformError: (error) => - error.reason._tag === "NotFound" ? Effect.succeed(Option.none()) : Effect.fail(error), + error.reason._tag === "NotFound" || isNotDirectory(error) + ? Effect.succeed(Option.none()) + : Effect.fail(error), }), ); From c02f9c48785b36b07eaee5eeddbd95e27463cbd4 Mon Sep 17 00:00:00 2001 From: Maxwell Weinzierl Date: Mon, 23 Nov 2026 16:13:54 -0800 Subject: [PATCH 2/3] t4: frameAncestors comment without issue numbers (Lint fails on t4 without it) --- apps/server/src/t4/frameAncestors.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/server/src/t4/frameAncestors.ts b/apps/server/src/t4/frameAncestors.ts index 7947f43995ff6..498c5b25bc646 100644 --- a/apps/server/src/t4/frameAncestors.ts +++ b/apps/server/src/t4/frameAncestors.ts @@ -1,8 +1,8 @@ // @effect-diagnostics processEnvInEffect:off -- t4 settings come from the client container's env. /** - * Who may frame T3's web app (AI-131). + * Who may frame T3's web app. * - * Upstream v0.1.11 (#36395) answers every HTML page with `frame-ancestors + * Upstream v0.1.11 answers every HTML page with `frame-ancestors * 'none'` and `X-Frame-Options: DENY`, so no site can frame it. The t4 * dashboard opens T3 in a full-screen frame on a phone (`T3Frame.tsx`), and * after the v0.1.11 rollout that frame was a white screen. `T4_FRAME_ANCESTORS` From 40f0a315afefae337fc750cb1318d7ee1e48f0ff Mon Sep 17 00:00:00 2001 From: Maxwell Weinzierl Date: Mon, 23 Nov 2026 16:14:14 -0800 Subject: [PATCH 3/3] t4: frameAncestors comment within the lint caps (Lint fails on t4 without it) --- apps/server/src/t4/frameAncestors.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/apps/server/src/t4/frameAncestors.ts b/apps/server/src/t4/frameAncestors.ts index 498c5b25bc646..e7eb136ec2e35 100644 --- a/apps/server/src/t4/frameAncestors.ts +++ b/apps/server/src/t4/frameAncestors.ts @@ -1,15 +1,7 @@ // @effect-diagnostics processEnvInEffect:off -- t4 settings come from the client container's env. -/** - * Who may frame T3's web app. - * - * Upstream v0.1.11 answers every HTML page with `frame-ancestors - * 'none'` and `X-Frame-Options: DENY`, so no site can frame it. The t4 - * dashboard opens T3 in a full-screen frame on a phone (`T3Frame.tsx`), and - * after the v0.1.11 rollout that frame was a white screen. `T4_FRAME_ANCESTORS` - * (compose) lists the origins allowed to frame T3 - the dashboard's - and every - * other site is still refused. X-Frame-Options has no allow-list, so it is left - * out when origins are named; browsers that read `frame-ancestors` ignore it. - */ +// t4 fork: upstream sends `frame-ancestors 'none'`, which blanks the t4 dashboard's phone frame. +// T4_FRAME_ANCESTORS names the origins allowed to frame T3; every other site is still refused. +// X-Frame-Options has no allow-list, so it is left out when origins are named. const ORIGIN = /^https?:\/\/[a-z0-9.-]+(?::\d{1,5})?$/i;