Skip to content

Commit ab7f69c

Browse files
jrusso1020claude
andauthored
test(core): align file-tree test with backup-only hiding (#1366) (#1400)
main went red again at e2cc134: 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) <noreply@anthropic.com>
1 parent e2cc134 commit ab7f69c

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

packages/core/src/studio-api/routes/projects.test.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ afterEach(() => {
1717
const COMPOSITION_HTML = '<html><body><div data-composition-id="main"></div></body></html>';
1818

1919
// Project layout for #1384: real compositions at the root and under
20-
// compositions/, plus two kinds of dot-directory content that exercise
21-
// discovery gating differently:
22-
// - .cache/ a vendored dot-directory. walkDir does NOT special-case it,
23-
// so its HTML stays listed in the file tree, but it must be
24-
// gated out of composition discovery by isInHiddenOrVendorDir.
25-
// - .hyperframes/ Studio's own internal directory (backups, etc.) — already in
26-
// walkDir's IGNORE_DIRS, so it is hidden from the file tree
27-
// entirely (and therefore from compositions too).
20+
// compositions/, plus dot-directory content that exercises discovery gating
21+
// and the file tree's backup-only hiding (#1366):
22+
// - .cache/examples/ a vendored dot-dir. walkDir does NOT special-case
23+
// it, so it stays listed in the file tree, but it is
24+
// gated out of composition discovery (isInHiddenOrVendorDir).
25+
// - .hyperframes/examples/ vendored under Studio's dir — also listed in the
26+
// file tree, also gated out of discovery.
27+
// - .hyperframes/backup/ Studio's internal snapshots — the only thing hidden
28+
// from the file tree (walkDir's shouldIgnoreDir).
2829
function createProjectDir(): string {
2930
const projectDir = mkdtempSync(join(tmpdir(), "hf-projects-test-"));
3031
tempDirs.push(projectDir);
@@ -35,6 +36,8 @@ function createProjectDir(): string {
3536
writeFileSync(join(projectDir, ".cache", "examples", "preset.html"), COMPOSITION_HTML);
3637
mkdirSync(join(projectDir, ".hyperframes", "examples"), { recursive: true });
3738
writeFileSync(join(projectDir, ".hyperframes", "examples", "preset.html"), COMPOSITION_HTML);
39+
mkdirSync(join(projectDir, ".hyperframes", "backup"), { recursive: true });
40+
writeFileSync(join(projectDir, ".hyperframes", "backup", "snapshot.html"), COMPOSITION_HTML);
3841
return projectDir;
3942
}
4043

@@ -71,7 +74,7 @@ describe("registerProjectRoutes — composition discovery (#1384)", () => {
7174
expect(payload.compositions).not.toContain(".hyperframes/examples/preset.html");
7275
});
7376

74-
it("lists vendored dot-directory files in the file tree but hides Studio-internal ones", async () => {
77+
it("lists vendored dot-directory files in the file tree but hides Studio backups", async () => {
7578
const projectDir = createProjectDir();
7679
const app = new Hono();
7780
registerProjectRoutes(app, createAdapter(projectDir));
@@ -81,7 +84,8 @@ describe("registerProjectRoutes — composition discovery (#1384)", () => {
8184

8285
// Vendored dot-dirs stay browsable — discovery is gated, the file tree is not.
8386
expect(payload.files).toContain(".cache/examples/preset.html");
84-
// Studio's internal dir is hidden from the tree entirely (walkDir IGNORE_DIRS).
85-
expect(payload.files).not.toContain(".hyperframes/examples/preset.html");
87+
expect(payload.files).toContain(".hyperframes/examples/preset.html");
88+
// Only Studio's own backup snapshots are hidden from the tree (#1366).
89+
expect(payload.files).not.toContain(".hyperframes/backup/snapshot.html");
8690
});
8791
});

0 commit comments

Comments
 (0)