From 31e74f02fe36d92f6a6493d8739521dc8d983faf Mon Sep 17 00:00:00 2001 From: James Date: Sat, 13 Jun 2026 02:21:49 +0000 Subject: [PATCH] test(core): align file-tree test with backup-only hiding (#1366) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main went red again at e2cc134c: my #1399 fix branched off the pre-#1366 state (where `.hyperframes` was wholesale-hidden via IGNORE_DIRS) and, when it merged on top of #1366, overwrote #1366's corrected test with an assertion that `.hyperframes/examples` is hidden. #1366 is the authoritative behavior: walkDir now hides only `.hyperframes/backup` (shouldIgnoreDir), so `.hyperframes/examples` — like any other vendored dot-dir — stays visible in the file tree and is gated out of composition discovery by isInHiddenOrVendorDir. That is the original #1384 intent. Correct the file-tree test to match: - `.cache/examples/preset.html` and `.hyperframes/examples/preset.html` are both visible in `files` (kept the `.cache` case from #1399 — it exercises isInHiddenOrVendorDir gating for a non-special dot-dir). - `.hyperframes/backup/snapshot.html` is the only thing hidden from the tree. - Compositions still exclude every dot-dir example. Full non-producer suite green; walkDir "hides backups" test untouched. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/studio-api/routes/projects.test.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/core/src/studio-api/routes/projects.test.ts b/packages/core/src/studio-api/routes/projects.test.ts index 5e84a693d..7414048bd 100644 --- a/packages/core/src/studio-api/routes/projects.test.ts +++ b/packages/core/src/studio-api/routes/projects.test.ts @@ -17,14 +17,15 @@ afterEach(() => { const COMPOSITION_HTML = '
'; // Project layout for #1384: real compositions at the root and under -// compositions/, plus two kinds of dot-directory content that exercise -// discovery gating differently: -// - .cache/ a vendored dot-directory. walkDir does NOT special-case it, -// so its HTML stays listed in the file tree, but it must be -// gated out of composition discovery by isInHiddenOrVendorDir. -// - .hyperframes/ Studio's own internal directory (backups, etc.) — already in -// walkDir's IGNORE_DIRS, so it is hidden from the file tree -// entirely (and therefore from compositions too). +// compositions/, plus dot-directory content that exercises discovery gating +// and the file tree's backup-only hiding (#1366): +// - .cache/examples/ a vendored dot-dir. walkDir does NOT special-case +// it, so it stays listed in the file tree, but it is +// gated out of composition discovery (isInHiddenOrVendorDir). +// - .hyperframes/examples/ vendored under Studio's dir — also listed in the +// file tree, also gated out of discovery. +// - .hyperframes/backup/ Studio's internal snapshots — the only thing hidden +// from the file tree (walkDir's shouldIgnoreDir). function createProjectDir(): string { const projectDir = mkdtempSync(join(tmpdir(), "hf-projects-test-")); tempDirs.push(projectDir); @@ -35,6 +36,8 @@ function createProjectDir(): string { writeFileSync(join(projectDir, ".cache", "examples", "preset.html"), COMPOSITION_HTML); mkdirSync(join(projectDir, ".hyperframes", "examples"), { recursive: true }); writeFileSync(join(projectDir, ".hyperframes", "examples", "preset.html"), COMPOSITION_HTML); + mkdirSync(join(projectDir, ".hyperframes", "backup"), { recursive: true }); + writeFileSync(join(projectDir, ".hyperframes", "backup", "snapshot.html"), COMPOSITION_HTML); return projectDir; } @@ -71,7 +74,7 @@ describe("registerProjectRoutes — composition discovery (#1384)", () => { expect(payload.compositions).not.toContain(".hyperframes/examples/preset.html"); }); - it("lists vendored dot-directory files in the file tree but hides Studio-internal ones", async () => { + it("lists vendored dot-directory files in the file tree but hides Studio backups", async () => { const projectDir = createProjectDir(); const app = new Hono(); registerProjectRoutes(app, createAdapter(projectDir)); @@ -81,7 +84,8 @@ describe("registerProjectRoutes — composition discovery (#1384)", () => { // Vendored dot-dirs stay browsable — discovery is gated, the file tree is not. expect(payload.files).toContain(".cache/examples/preset.html"); - // Studio's internal dir is hidden from the tree entirely (walkDir IGNORE_DIRS). - expect(payload.files).not.toContain(".hyperframes/examples/preset.html"); + expect(payload.files).toContain(".hyperframes/examples/preset.html"); + // Only Studio's own backup snapshots are hidden from the tree (#1366). + expect(payload.files).not.toContain(".hyperframes/backup/snapshot.html"); }); });