From 6fa411a33572b9a244ef5ba832891296c230c944 Mon Sep 17 00:00:00 2001 From: "Brian J. Fox" Date: Wed, 4 Nov 2026 10:37:59 +0000 Subject: [PATCH] fix(hub): keep the coder's scratch folder out of the app A coder saved its browser screenshots under .scratch/, which nothing ignored, so the app bundle carried them past the size limit and the preview and the filing failed. The bundle skips .scratch the way it skips installs and builds, the starter ignores it, and the coder is told it is the place for throwaway files. --- apps/hub/src/builds/app-snapshot.test.ts | 1 + apps/hub/src/builds/app-snapshot.ts | 5 +++-- workflows/coder/starter/.gitignore | 1 + workflows/coder/starter/AGENTS.md | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/hub/src/builds/app-snapshot.test.ts b/apps/hub/src/builds/app-snapshot.test.ts index e53cc5df..242c6be1 100644 --- a/apps/hub/src/builds/app-snapshot.test.ts +++ b/apps/hub/src/builds/app-snapshot.test.ts @@ -71,6 +71,7 @@ test("the collected app keeps binaries and byte-order marks, honors .gitignore a "server/data.sqlite3": png, "debug.log": "left out", "node_modules/react/index.js": "left out", + ".scratch/shots/new-dialog.png": "left out", "../home/secret.txt": "home\n", }; for (const [path, content] of Object.entries(files)) { diff --git a/apps/hub/src/builds/app-snapshot.ts b/apps/hub/src/builds/app-snapshot.ts index c60cb79e..85ed9693 100644 --- a/apps/hub/src/builds/app-snapshot.ts +++ b/apps/hub/src/builds/app-snapshot.ts @@ -16,13 +16,14 @@ import { WorkflowHttpError, workflowHttpJson } from "../workflows/http-json.ts"; import { INPUTS_DIRECTORY } from "../config/inputs.ts"; import { spliceDesignScreens } from "./starter.ts"; -// Installs and builds are rebuilt by setup and check-app, and .builder and the inputs come from -// filed documents. +// Installs and builds are rebuilt by setup and check-app, .builder and the inputs come from filed +// documents, and .scratch holds the coder's throwaway files, such as the screenshots it takes. export const EXCLUDED_DIRECTORIES: ReadonlySet = new Set([ "node_modules", "dist", ".git", ".builder", + ".scratch", INPUTS_DIRECTORY, ]); // Secrets (environment files, keys, registry credentials) and local databases never leave the diff --git a/workflows/coder/starter/.gitignore b/workflows/coder/starter/.gitignore index 0a9bee15..2d11a0b7 100644 --- a/workflows/coder/starter/.gitignore +++ b/workflows/coder/starter/.gitignore @@ -1,5 +1,6 @@ node_modules/ dist/ +.scratch/ server/data/ .env .env.* diff --git a/workflows/coder/starter/AGENTS.md b/workflows/coder/starter/AGENTS.md index 7177d4bc..3672b7ce 100644 --- a/workflows/coder/starter/AGENTS.md +++ b/workflows/coder/starter/AGENTS.md @@ -45,7 +45,7 @@ Commands, run from the root: It does not try features: confirm each requirement in the running app, against the acceptance checklist and the design. -The app's dev server runs while you build and reloads as files change; `app_status` gives its address and the server log. Use the browser tools on that address to try features the way a person would. +The app's dev server runs while you build and reloads as files change; `app_status` gives its address and the server log. Use the browser tools on that address to try features the way a person would. Keep throwaway files, such as the screenshots you take while trying it, under `.scratch/`; nothing there is part of the app. ## The app's documents