Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

CI: check every tracked file for the parity studio's name before the build

Adarsh9f3e50beede5
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index bcbc53dd..49545733 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -1,7 +1,8 @@
# Builds each push to main on GitHub's runners and sends the build to the server, which installs it.
#
# Two jobs, so the server's key never meets the code that builds:
-# - build: no secrets. Installs, typechecks, builds, packs .next with scripts/pack-build.sh, and keeps the
+# - build: no secrets. Checks that no tracked file names the parity studio (scripts/check-neutral-names.mjs),
+# installs, typechecks, builds, packs .next with scripts/pack-build.sh, and keeps the
# archive for a week. It holds only compiled code from this public repository: no node_modules, data or env.
# - deploy: only for pushes to main of this repository, in the "production" environment, whose secrets only
# it can read. It runs no code from the repository: it downloads the archive, checks its sha256, and sends it
@@ -54,6 +55,10 @@ jobs:
node-version: 22.23.4
package-manager-cache: false
+ # Node and git only, before the install: a few seconds. It prints file:line, never the matched text.
+ - name: Neutral names
+ run: node scripts/check-neutral-names.mjs
+
- name: Set up pnpm (the version package.json names)
run: |
corepack enable
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index ecabb5b9..8e724144 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -295,7 +295,7 @@ Round 4 part 5 (O7). Fuobe no longer calls the retired cloud provider's API; the
- **In-flight work.** A job stored under a provider Fuobe no longer has gets the stand-in adapter (`provider()` in `src/server/providers/index.ts`): its next poll fails it with `RETIRED_PROVIDER_ERROR`, and `pollOne` gives the same message for a job whose model was retired or whose provider is unknown. A training on a retired target fails by target (see Training).
- **Stored settings and ads.** Migration 22 deletes the saved key, turns a Preferred provider Fuobe no longer offers into Automatic and marks the ads that provider drew `baked` (see Storage). Model-access switches saved for the retired provider or a retired model match nothing any more (see Models & licences).
- **Partner routes added.** Happy Horse 1.1 (`happy-horse-1-1`), which only the retired provider hosted, gets fal's text, image and reference to video routes from the research's `partnerEndpoints` (`fetch-hosted-schemas.py --partner`, checked 2026-10-27; $0.14/s at 720p, $0.18/s at 1080p). The Ad Multiplier's cloud edits become Kling O3 (the default), Happy Horse video edit and Gemini Omni Flash (see Studios).
-- **The guards.** `tests/neutral-names.test.ts` reads every tracked path and every tracked text file, docs and research included, and fails on any spelling of the parity studio's name: it holds only a SHA-256 hash of the name, so the test never spells it (`tests/helpers/retired-name.mjs`, shared with the browser checks). `tests/retired-provider.test.ts` keeps the O7 checks: no retired model or training id quoted in `src` or `bin` outside `replaced.ts` and `db.ts`, the catalog's providers, the settings, `REPLACED_BY`'s targets and operations, the Director words, the API notes, retries, waiting steps, the in-flight error and the migration on seeded rows (its fixtures store an unknown provider id, `old-provider`, as rows from before O7 do).
+- **The guards.** `tests/neutral-names.test.ts` reads every tracked path and every tracked text file, docs and research included, and fails on any spelling of the parity studio's name: it holds only a SHA-256 hash of the name, so the test never spells it (`tests/helpers/retired-name.mjs`, shared with the browser checks). CI runs the same check before every build (`scripts/check-neutral-names.mjs`, the first step of `.github/workflows/deploy.yml`), with the matcher and the interim list from that module; it prints only `path:line`. `tests/retired-provider.test.ts` keeps the O7 checks: no retired model or training id quoted in `src` or `bin` outside `replaced.ts` and `db.ts`, the catalog's providers, the settings, `REPLACED_BY`'s targets and operations, the Director words, the API notes, retries, waiting steps, the in-flight error and the migration on seeded rows (its fixtures store an unknown provider id, `old-provider`, as rows from before O7 do).
- **Checked** by the guard and the updated unit tests, in demo mode. No fal or Replicate call and no GPU run: Happy Horse 1.1 and the replacements' payloads are checked against the research schemas and planner tests only. Left over: browser Reuse drops Cinema Studio's Director fields (the toast says so), Soul 2.0's `color_palette` is dropped rather than turned into a palette lock, and Assist and MCP move a retired model without saying why.
## Models & licences (`src/lib/licences.ts`, `src/lib/model-access.ts`, `src/server/model-access.ts`)
diff --git a/docs/STATUS.md b/docs/STATUS.md
index 4f733c63..b1d01265 100644
--- a/docs/STATUS.md
+++ b/docs/STATUS.md
@@ -367,7 +367,7 @@ pnpm install
pnpm typecheck && pnpm lint && pnpm test && pnpm build # in a checkout without .next, run `pnpm exec next typegen` (or a dev or build run) before typecheck; where it runs out of memory, set NODE_OPTIONS=--max-old-space-size=6144
```
-`pnpm test` includes `tests/neutral-names.test.ts`, which fails if any tracked file or path names the parity studio (it knows the name only as a hash), and two checks from round 4, part 5: `tests/retired-provider.test.ts`, which fails if code quotes a retired model id (only `src/lib/catalog/replaced.ts` and the migration in `src/server/db.ts` may) or the catalog or settings offer the retired provider again, and `tests/comfy-reach.test.ts`, which tells a busy ComfyUI from a down one against stand-in servers. Round 5, part 1 adds `tests/ollama-reach.test.ts` (the same for Ollama, and Assist on a busy one), `tests/comfy-install.test.ts` (the Workflows page's install commands, run twice against local git repositories) and `tests/settings-links.test.ts` (every `/settings#…` link and every "Settings → …" text names a real section).
+`pnpm test` includes `tests/neutral-names.test.ts`, which fails if any tracked file or path names the parity studio (it knows the name only as a hash; CI runs the same check, `scripts/check-neutral-names.mjs`, before every build), and two checks from round 4, part 5: `tests/retired-provider.test.ts`, which fails if code quotes a retired model id (only `src/lib/catalog/replaced.ts` and the migration in `src/server/db.ts` may) or the catalog or settings offer the retired provider again, and `tests/comfy-reach.test.ts`, which tells a busy ComfyUI from a down one against stand-in servers. Round 5, part 1 adds `tests/ollama-reach.test.ts` (the same for Ollama, and Assist on a busy one), `tests/comfy-install.test.ts` (the Workflows page's install commands, run twice against local git repositories) and `tests/settings-links.test.ts` (every `/settings#…` link and every "Settings → …" text names a real section).
Browser checks need the app running (`pnpm dev`, or `pnpm build && pnpm start`); demo mode with no keys is fine. They use Playwright: the repo's `playwright` / `playwright-core` if it resolves, else a global install, and `$CHROMIUM_PATH` or the newest `/opt/pw-browsers/chromium-*`.
diff --git a/scripts/check-neutral-names.mjs b/scripts/check-neutral-names.mjs
new file mode 100644
index 00000000..0dd9fad3
--- /dev/null
+++ b/scripts/check-neutral-names.mjs
@@ -0,0 +1,62 @@
+#!/usr/bin/env node
+// Fails when a tracked file's path or text names the parity studio. CI runs it before the build (it needs only Node and
+// git, no install); tests/neutral-names.test.ts checks the same under pnpm test. Both read the matcher and the interim
+// list from tests/helpers/retired-name.mjs, so they can't drift.
+//
+// It prints where, never what: `path:line`, with any part of a path that names it masked. Exit 0 clean, 1 named, 2
+// when git can't list the checkout.
+//
+// Run: node scripts/check-neutral-names.mjs
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { INTERIM_ALLOWED, formatHit, scanTree } from "../tests/helpers/retired-name.mjs";
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
+const SELF = "scripts/check-neutral-names.mjs";
+const LIST = "tests/helpers/retired-name.mjs (INTERIM_ALLOWED)";
+const ACTIONS = process.env.GITHUB_ACTIONS === "true";
+
+// GitHub's workflow commands (::error file=…,line=…::message) put the finding on the commit's file and line.
+const escapeData = (s) => String(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
+const escapeProperty = (s) => escapeData(s).replace(/:/g, "%3A").replace(/,/g, "%2C");
+function report(level, message, hit) {
+ const text = hit ? `${formatHit(hit)}: ${message}` : message;
+ if (!ACTIONS) {
+ (level === "error" ? console.error : console.log)(`${level}: ${text}`);
+ return;
+ }
+ // A masked path can't point at its file, so only an unmasked one is linked.
+ const linked = hit && !hit.file.includes("[…]");
+ const props = linked ? ` file=${escapeProperty(hit.file)}${hit.line ? `,line=${hit.line}` : ""}` : "";
+ console.log(`::${level}${props}::${escapeData(text)}`);
+}
+
+const started = Date.now();
+let scan;
+try {
+ scan = scanTree(ROOT);
+} catch (e) {
+ report("error", `git couldn't list the tracked files: ${e instanceof Error ? e.message.split("\n")[0] : e}`);
+ process.exit(2);
+}
+if (!scan.files.includes(SELF)) {
+ report("error", `git listed ${scan.files.length} files, without ${SELF}: run it from a checkout of the repository.`);
+ process.exit(2);
+}
+
+for (const p of scan.namedPaths) report("error", `A tracked path names the parity studio: ${p}. Rename it with a neutral word.`);
+for (const hit of scan.hits) report("error", 'This line names the parity studio. Write "the parity studio" (or "the parity research") instead.', hit);
+for (const f of scan.missing) report("warning", `${f} is on the interim list but not tracked: take it off ${LIST}.`);
+for (const f of scan.cleared) report("notice", `${f} no longer names it: take it off ${LIST}.`);
+
+const count = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
+const seconds = ((Date.now() - started) / 1000).toFixed(1);
+const interim = Object.keys(INTERIM_ALLOWED).length;
+const summary = `neutral names: ${count(scan.files.length, "tracked file")} in ${seconds} s${interim ? `, ${scan.skipped.length} of ${interim} interim files not checked yet` : ""}`;
+if (scan.namedPaths.length || scan.hits.length) {
+ const files = new Set(scan.hits.map((h) => h.file)).size;
+ const found = [scan.namedPaths.length && count(scan.namedPaths.length, "path"), scan.hits.length && `${count(scan.hits.length, "line")} in ${count(files, "file")}`];
+ console.error(`${summary}: ${found.filter(Boolean).join(" and ")} name the parity studio.`);
+ process.exit(1);
+}
+console.log(`${summary}: clean.`);
diff --git a/tests/helpers/retired-name.mjs b/tests/helpers/retired-name.mjs
index 4de6cb4b..6778dc78 100644
--- a/tests/helpers/retired-name.mjs
+++ b/tests/helpers/retired-name.mjs
@@ -1,7 +1,11 @@
// The name of the closed studio Fuobe's parity research measures against, as a check that never spells it.
-// The repo calls that studio "the parity studio" and never writes its name (tests/neutral-names.test.ts).
-// Only the SHA-256 of the lower-case name and its length are kept here.
+// The repo calls that studio "the parity studio" and never writes its name. Two checks read this one module, so their
+// matcher and their interim list can't drift: tests/neutral-names.test.ts (pnpm test) and scripts/check-neutral-names.mjs
+// (CI, before the build). Only the SHA-256 of the lower-case name and its length are kept here.
+import { execFileSync } from "node:child_process";
import { createHash } from "node:crypto";
+import fs from "node:fs";
+import path from "node:path";
const RETIRED_NAME_SHA256 = "50b2676afbe30c833f43fedf384f115302474c88365501ad94ba93aec48777c6";
const RETIRED_NAME_LENGTH = 10;
@@ -52,3 +56,104 @@ export function matcherFor(sha256Hex, length) {
/** True when `text` names the parity studio in any spelling: one word, two words, hyphenated, glued or in an identifier. */
export const mentionsRetiredName = matcherFor(RETIRED_NAME_SHA256, RETIRED_NAME_LENGTH);
+
+/**
+ * Interim, by path only: three files whose comments (and one migration's SQL) still name the studio until the change
+ * that rewords them lands. Remove each line in that change, and this list with the last one.
+ * @type {Readonly<Record<string, string>>}
+ */
+export const INTERIM_ALLOWED = Object.freeze({
+ "src/server/db.ts": "migration 22's comment and SQL",
+ "src/server/generations.ts": "two comments",
+ "src/components/studio/feed.tsx": "one comment",
+});
+
+/**
+ * Every tracked file under `root`, as git lists it (paths with forward slashes).
+ * @param {string} root
+ * @returns {string[]}
+ */
+export function trackedFiles(root) {
+ const out = execFileSync("git", ["ls-files", "-z"], { cwd: root, maxBuffer: 64 * 1024 * 1024 }).toString("utf8");
+ return out.split("\0").filter(Boolean);
+}
+
+/**
+ * A file is binary when its first 8 KB hold a NUL byte (git's own test).
+ * @param {Buffer} buf
+ */
+export const isBinary = (buf) => buf.subarray(0, 8192).includes(0);
+
+/**
+ * A path safe to print: each part that names it becomes "[…]" (all of it, when only the whole path does).
+ * @param {string} file
+ * @param {(text: string) => boolean} [mentions]
+ */
+export function maskPath(file, mentions = mentionsRetiredName) {
+ if (!mentions(file)) return file;
+ const masked = file
+ .split("/")
+ .map((part) => (mentions(part) ? "[…]" : part))
+ .join("/");
+ return mentions(masked) ? "[…]" : masked;
+}
+
+/**
+ * @typedef {{ file: string, line?: number }} NameHit A line that names it (`file` already masked); no `line` when the
+ * name is split across two lines.
+ */
+
+/**
+ * The lines of one file's `text` that name it.
+ * @param {string} file
+ * @param {string} text
+ * @param {(text: string) => boolean} [mentions]
+ * @returns {NameHit[]}
+ */
+export function hitsIn(file, text, mentions = mentionsRetiredName) {
+ if (!mentions(text)) return [];
+ const shown = maskPath(file, mentions);
+ const lines = text.split(/\r?\n/).flatMap((line, i) => (mentions(line) ? [{ file: shown, line: i + 1 }] : []));
+ return lines.length ? lines : [{ file: shown }];
+}
+
+/**
+ * `path:line`, or `path (split across lines)`.
+ * @param {NameHit} hit
+ */
+export const formatHit = (hit) => (hit.line ? `${hit.file}:${hit.line}` : `${hit.file} (split across lines)`);
+
+/**
+ * Every tracked file under `root`, checked: its path, then its text unless it is binary or on the interim list. A file
+ * on the list is still read, to say when its entry can go.
+ * @param {string} root
+ * @param {{ mentions?: (text: string) => boolean, interim?: Readonly<Record<string, string>> }} [options]
+ * @returns {{
+ * files: string[],
+ * namedPaths: string[],
+ * hits: NameHit[],
+ * skipped: string[],
+ * cleared: string[],
+ * missing: string[],
+ * }} namedPaths: tracked paths that name it (masked); hits: lines outside the interim list; skipped: interim files that
+ * still name it; cleared: interim files that no longer do; missing: interim entries git doesn't track.
+ */
+export function scanTree(root, { mentions = mentionsRetiredName, interim = INTERIM_ALLOWED } = {}) {
+ const files = trackedFiles(root);
+ const namedPaths = files.filter((f) => mentions(f)).map((f) => maskPath(f, mentions));
+ const hits = [];
+ const skipped = [];
+ const cleared = [];
+ for (const f of files) {
+ const full = path.join(root, f);
+ if (!fs.existsSync(full)) continue; // deleted in the working tree, not yet committed
+ const buf = fs.readFileSync(full);
+ if (isBinary(buf)) continue;
+ const found = hitsIn(f, buf.toString("utf8"), mentions);
+ if (Object.hasOwn(interim, f)) (found.length ? skipped : cleared).push(f);
+ else hits.push(...found);
+ }
+ const tracked = new Set(files);
+ const missing = Object.keys(interim).filter((f) => !tracked.has(f));
+ return { files, namedPaths, hits, skipped, cleared, missing };
+}
diff --git a/tests/neutral-names.test.ts b/tests/neutral-names.test.ts
index 377404ab..c55b2cb8 100644
--- a/tests/neutral-names.test.ts
+++ b/tests/neutral-names.test.ts
@@ -2,78 +2,66 @@ import { execFileSync } from "node:child_process";
import { createHash } from "node:crypto";
import fs from "node:fs";
import path from "node:path";
-import { describe, expect, it } from "vitest";
-import { matcherFor, mentionsRetiredName, wordsOf } from "./helpers/retired-name.mjs";
+import { beforeAll, describe, expect, it } from "vitest";
+import { tempDir } from "./helpers/temp-dir";
+import { INTERIM_ALLOWED, formatHit, maskPath, matcherFor, mentionsRetiredName, scanTree, wordsOf } from "./helpers/retired-name.mjs";
/**
* The repo never names the closed studio its parity research measures Fuobe against: code, tests, docs, research, file
* names, everything tracked. Write "the parity studio" (or "the parity research" for where a fact came from). This test
* knows the name only as a hash (tests/helpers/retired-name.mjs), so it never spells it either.
+ *
+ * CI runs the same check before every build (scripts/check-neutral-names.mjs, in .github/workflows/deploy.yml), with the
+ * matcher and the interim list (INTERIM_ALLOWED) from the same module.
*/
const ROOT = path.resolve(__dirname, "..");
-/**
- * Interim, by path only: three files whose comments (and one migration's SQL) still name the studio until the change
- * that rewords them lands. Remove each line in that change, and this list with the last one.
- */
-const INTERIM_ALLOWED: Record<string, string> = {
- "src/server/db.ts": "migration 22's comment and SQL",
- "src/server/generations.ts": "two comments",
- "src/components/studio/feed.tsx": "one comment",
-};
-
-/** Every tracked file, as git lists it (paths with forward slashes). */
-function trackedFiles(): string[] {
- const out = execFileSync("git", ["ls-files", "-z"], { cwd: ROOT, maxBuffer: 64 * 1024 * 1024 }).toString("utf8");
- return out.split("\0").filter(Boolean);
-}
+/** A stand-in for the name, with its own matcher: the scan's own tests plant this word, never the real one. */
+const WORD = "quokkabird";
+const standIn = matcherFor(createHash("sha256").update(WORD).digest("hex"), WORD.length);
-/** A file is binary when its first 8 KB hold a NUL byte (git's own test). */
-const isBinary = (buf: Buffer) => buf.subarray(0, 8192).includes(0);
+const git = (cwd: string, ...args: string[]) => execFileSync("git", args, { cwd, stdio: "pipe" });
-/** `path:line` for each line of `text` that names it. */
-function hitsIn(file: string, text: string): string[] {
- if (!mentionsRetiredName(text)) return [];
- const lines = text.split(/\r?\n/).flatMap((line, i) => (mentionsRetiredName(line) ? [`${file}:${i + 1}`] : []));
- return lines.length ? lines : [`${file} (split across lines)`];
+/** A new git repository holding `files` (path → text or bytes), all added. */
+function repoWith(files: Record<string, string | Buffer>): string {
+ const dir = tempDir("fuobe-neutral-");
+ for (const [f, body] of Object.entries(files)) {
+ fs.mkdirSync(path.dirname(path.join(dir, f)), { recursive: true });
+ fs.writeFileSync(path.join(dir, f), body);
+ }
+ git(dir, "init", "-q");
+ git(dir, "add", "-A");
+ return dir;
}
describe("neutral names: the parity studio is never named", () => {
- const files = trackedFiles();
+ let scan: ReturnType<typeof scanTree>;
+ beforeAll(() => {
+ scan = scanTree(ROOT);
+ }, 120_000); // about 12,700 files and 50 MB of text: a few seconds, longer on a busy machine
it("reads every tracked file", () => {
- expect(files.length).toBeGreaterThan(3000);
- expect(files).toContain("src/server/providers/index.ts");
- expect(files).toContain("docs/research/README.md");
+ expect(scan.files.length).toBeGreaterThan(3000);
+ expect(scan.files).toContain("src/server/providers/index.ts");
+ expect(scan.files).toContain("docs/research/README.md");
});
it("names no tracked file or folder after it", () => {
- expect(files.filter((f) => mentionsRetiredName(f))).toEqual([]);
+ expect(scan.namedPaths).toEqual([]);
});
it("finds it in no tracked text file", () => {
- const hits: string[] = [];
- const skipped = Object.keys(INTERIM_ALLOWED);
- for (const f of files) {
- if (INTERIM_ALLOWED[f]) continue;
- const full = path.join(ROOT, f);
- if (!fs.existsSync(full)) continue; // deleted in the working tree, not yet committed
- const buf = fs.readFileSync(full);
- if (isBinary(buf)) continue;
- hits.push(...hitsIn(f, buf.toString("utf8")));
- }
- if (skipped.length) console.info(`neutral names: not yet checked: ${skipped.join(", ")}`);
- expect(hits).toEqual([]);
- }, 120_000); // about 3,100 files and 50 MB of text: a few seconds, longer on a busy machine
+ if (scan.skipped.length) console.info(`neutral names: not yet checked: ${scan.skipped.join(", ")}`);
+ expect(scan.hits.map(formatHit)).toEqual([]);
+ });
it("keeps the interim list honest: each file on it still exists", () => {
- for (const f of Object.keys(INTERIM_ALLOWED)) expect(files, f).toContain(f);
+ expect(scan.missing).toEqual([]);
+ for (const f of Object.keys(INTERIM_ALLOWED)) expect(scan.files, f).toContain(f);
});
it("catches every spelling, shown here with a stand-in word", () => {
- const word = "quokkabird";
- const mentions = matcherFor(createHash("sha256").update(word).digest("hex"), word.length);
for (const p of [
"export class QuokkaBirdProvider {}",
"const viaQuokkabird = true;",
@@ -86,12 +74,57 @@ describe("neutral names: the parity studio is never named", () => {
"openquokkabirdai",
"docs/research/quokkabird-inventory.md",
])
- expect(mentions(p), p).toBe(true);
- for (const ok of ["Quokka Audio v2", "a quokka", "bird watching", "quokka-audio"]) expect(mentions(ok), ok).toBe(false);
+ expect(standIn(p), p).toBe(true);
+ for (const ok of ["Quokka Audio v2", "a quokka", "bird watching", "quokka-audio"]) expect(standIn(ok), ok).toBe(false);
expect(wordsOf("QuokkaBirdProvider HTMLParser x2y")).toEqual(["quokka", "bird", "provider", "html", "parser", "x", "y"]);
});
it("leaves unrelated words alone", () => {
for (const ok of ["Higgs Audio v2 3B (HiggsAudioEngineNode)", "the parity studio's Soul", "Hugging Face (HF_TOKEN)"]) expect(mentionsRetiredName(ok), ok).toBe(false);
});
+
+ it("scans a tree the way CI does, and says where without the word (stand-in)", () => {
+ const dir = repoWith({
+ "src/a.ts": "const ok = 1;\nconst viaQuokkaBird = true;\n",
+ "docs/split.md": "the quokka\nbird studio\n",
+ "docs/quokkabird-inventory/notes.md": "clean\n",
+ "src/still.ts": "// QUOKKABIRD_API_KEY\n",
+ "src/done.ts": "// reworded\n",
+ "public/x.bin": Buffer.concat([Buffer.from([0, 1, 2]), Buffer.from(WORD)]),
+ });
+ const r = scanTree(dir, { mentions: standIn, interim: { "src/still.ts": "one comment", "src/done.ts": "one comment", "src/gone.ts": "renamed" } });
+ expect(r.files).toHaveLength(6);
+ expect(r.namedPaths).toEqual(["docs/[…]/notes.md"]);
+ expect(r.hits.map(formatHit)).toEqual(["docs/split.md (split across lines)", "src/a.ts:2"]);
+ expect(r.skipped).toEqual(["src/still.ts"]);
+ expect(r.cleared).toEqual(["src/done.ts"]);
+ expect(r.missing).toEqual(["src/gone.ts"]);
+ // A path is printed with each part that names it masked, or masked whole when only the whole path does.
+ expect(maskPath("docs/research/quokka-bird-api.json", standIn)).toBe("docs/research/[…]");
+ expect(maskPath("docs/quokka/bird.md", standIn)).toBe("[…]");
+ expect(maskPath("docs/research/README.md", standIn)).toBe("docs/research/README.md");
+ });
+
+ it("runs as CI's first check, before the install and the build", () => {
+ const yml = fs.readFileSync(path.join(ROOT, ".github/workflows/deploy.yml"), "utf8");
+ const at = (s: string) => yml.indexOf(s);
+ expect(at("node scripts/check-neutral-names.mjs")).toBeGreaterThan(at("actions/setup-node@"));
+ expect(at("node scripts/check-neutral-names.mjs")).toBeLessThan(at("pnpm install --frozen-lockfile"));
+ expect(at("pnpm install --frozen-lockfile")).toBeLessThan(at("pnpm build"));
+ expect(at("pnpm build")).toBeLessThan(at("\n deploy:"));
+ });
+
+ it("the CI script runs on a checkout with Node and git alone, and passes a clean one", () => {
+ const self = (f: string) => fs.readFileSync(path.join(ROOT, f));
+ const dir = repoWith({
+ "scripts/check-neutral-names.mjs": self("scripts/check-neutral-names.mjs"),
+ "tests/helpers/retired-name.mjs": self("tests/helpers/retired-name.mjs"),
+ "src/server/db.ts": "// clean\n",
+ "README.md": "the parity studio\n",
+ });
+ const out = execFileSync(process.execPath, [path.join(dir, "scripts/check-neutral-names.mjs")], { cwd: dir, env: { ...process.env, GITHUB_ACTIONS: "true" } }).toString();
+ expect(out).toMatch(/^::notice::src\/server\/db\.ts no longer names it/m);
+ expect(out).toMatch(/^::warning::src\/server\/generations\.ts is on the interim list but not tracked/m);
+ expect(out).toMatch(/neutral names: 4 tracked files in [\d.]+ s, 0 of 3 interim files not checked yet: clean\.$/m);
+ });
});