fix(share): keep change detection working with a gitignore-style .hyperframesignore (#7568)

* fix(share): keep change detection working with a gitignore-style .hyperframesignore

The project scan used by change detection now reads .hyperframesignore
through the strict source reader. Cloud render reads the same file as
gitignore syntax and its docs show /exports/, which the strict reader
refuses, so the scan threw and hosts lost change detection, export
freshness and share status for that project.

Change detection now falls back to scratch-only exclusions when the file
cannot be read. Source capture keeps the strict reader and still refuses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(share): check snapshotFiles tracks the file, not just names it

snapshotFiles returns every requested path, keying an excluded one as
undefined, so key presence alone did not prove the file was tracked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
terencecho
2026-11-11 19:52:50 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent a243169f8a
commit c07468d6a7
4 changed files with 52 additions and 3 deletions
+5
View File
@@ -55,6 +55,11 @@ excluding `index.html` are rejected. Do not exclude assets your composition uses
These rules can only exclude files, never re-include credentials or other files
blocked by the portable project policy.
Cloud render reads the same file as gitignore syntax, so it may hold rules this
reader rejects, such as `/exports/` or `**/*.mov`. Source capture then stops with
an error. Change detection keeps working and ignores the file's rules, so those
files still count as changes.
The upload uses the workspace's file-count, per-file, project-size and manifest
limits. Large media uploads in parts. Only a verified published snapshot that
still matches the rendered project can be attached to the video version. The CLI
+3 -3
View File
@@ -1,7 +1,7 @@
// @ts-check
// A project's files as change detection sees them: every file the film can use (isOutsideFilm), keyed by mtime and
// size, except html, keyed by content without the data-hf-id stamps. A run's change set and the watcher both read it.
import { readSourceIgnore } from "./sourceIgnore.mjs";
import { readChangeIgnore } from "./sourceIgnore.mjs";
import fs from "node:fs/promises";
import { constants } from "node:fs";
import path from "node:path";
@@ -61,7 +61,7 @@ async function entryKind(entry, full, followSymlinks) {
export async function snapshotProject(dir, { byContent = false, followSymlinks = false } = {}) {
/** @type {Snapshot} */
const result = new Map();
const ignored = await readSourceIgnore(dir);
const ignored = await readChangeIgnore(dir);
/** @param {string} current @param {Set<string>} ancestors */
async function walk(current, ancestors) {
const real = await fs.realpath(current).catch(() => null);
@@ -102,7 +102,7 @@ export function snapshotFingerprint(snapshot) {
export async function snapshotFiles(dir, files) {
/** @type {Map<string, unknown>} */
const result = new Map();
const ignored = await readSourceIgnore(dir);
const ignored = await readChangeIgnore(dir);
for (const file of files) {
const full = path.join(dir, file);
const stat = await fs.lstat(full).catch(() => null);
+8
View File
@@ -63,6 +63,14 @@ export async function readSourceIgnore(root) {
return (path) => scratch(path) || entries.some((entry) => entry.test(path));
}
/** The exclusions change detection applies. Change detection must keep working whatever the file holds: the CLI
* reads `.hyperframesignore` as gitignore syntax (`/renders/`, `**`, `!keep`), which this reader refuses. An
* unreadable file then excludes only scratch files, so a scan sees more files, never fewer. Source capture keeps
* the strict reader and still refuses the file. @param {string} root @returns {Promise<(path: string) => boolean>} */
export async function readChangeIgnore(root) {
return readSourceIgnore(root).catch(() => scratch);
}
/** @param {string} entry */
function ignorePattern(entry) {
const path = entry.replace(/\/$/, "");
+36
View File
@@ -649,3 +649,39 @@ test("a video-only retry never replays an unanswered source-bearing export", asy
);
assert.equal(creates, 1);
});
test("change detection keeps working when .hyperframesignore uses gitignore syntax", async (t) => {
for (const rule of ["/renders/", "**/*.mov", "!keep.mp4", "assets/*/raw-*.mp4", "a[bc].png"]) {
const dir = await folder(t);
await mkdir(join(dir, "assets"));
await writeFile(join(dir, "index.html"), "<div>Hello</div>");
await writeFile(join(dir, "assets/clip.mov"), "clip");
await writeFile(join(dir, ".hyperframesignore"), `${rule}\n`);
// The CLI's syntax is not this reader's: nothing is excluded beyond scratch, so a change still counts.
const files = await snapshotProject(dir);
assert.deepEqual([...files.keys()].sort(), ["assets/clip.mov", "index.html"], rule);
// snapshotFiles names every file asked for; an excluded one is keyed undefined.
assert.notEqual(
(await snapshotFiles(dir, ["assets/clip.mov"])).get("assets/clip.mov"),
undefined,
rule,
);
const before = await projectFingerprint(dir);
await writeFile(join(dir, "assets/clip.mov"), "edited clip");
assert.notEqual(await projectFingerprint(dir), before, rule);
}
});
test("change detection keeps working when .hyperframesignore is a link", async (t) => {
const dir = await folder(t);
await writeFile(join(dir, "index.html"), "<div>Hello</div>");
await symlink(join(dir, "index.html"), join(dir, ".hyperframesignore"));
assert.deepEqual([...(await snapshotProject(dir)).keys()], ["index.html"]);
});
test("change detection still applies a .hyperframesignore it can read", async (t) => {
const dir = await folder(t);
await mkdir(join(dir, "assets"));
await writeFile(join(dir, "index.html"), "<div>Hello</div>");
await writeFile(join(dir, "assets/raw.mov"), "raw");
await writeFile(join(dir, "debug.log"), "log");
await writeFile(join(dir, ".hyperframesignore"), "assets/raw.mov\n");
assert.deepEqual([...(await snapshotProject(dir)).keys()], ["index.html"]);
});