mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 06:19:21 +00:00
Merge origin/main into hfoss22/d834-pr2
Resolves conflicts from the CSS token migration (#4211/#4249): GROUP_MEMBER_RAIL/TINT and the track-label class move to var(--timeline-*) tokens; check-no-main-deletions.mjs keeps both sides' allowed-deletion entries.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// The vector builder validates two input formats and their artifact invariants.
|
||||
// fallow-ignore-file complexity
|
||||
/**
|
||||
* Embed the catalog with the on-device model so local search can rank by meaning.
|
||||
*
|
||||
@@ -30,8 +32,21 @@ import {
|
||||
catalogFromRegistry,
|
||||
LOCAL_VECTOR_BATCH_SIZE,
|
||||
localVectorRevision,
|
||||
mediaMetadataRevision,
|
||||
sha256Hex,
|
||||
} from "./catalog-artifact.js";
|
||||
|
||||
export interface MediaVectorRow {
|
||||
id: string;
|
||||
kind: string;
|
||||
title: string;
|
||||
description: string;
|
||||
tags: string[];
|
||||
file: string;
|
||||
duration?: number;
|
||||
dimensions?: { width: number; height: number };
|
||||
}
|
||||
|
||||
/** Distinct from 1 so the pre-commit hook can tell "cannot" from "failed". */
|
||||
const EXIT_NO_MODEL = 3;
|
||||
|
||||
@@ -40,6 +55,55 @@ function arg(name: string): string | undefined {
|
||||
return index === -1 ? undefined : process.argv[index + 1];
|
||||
}
|
||||
|
||||
// fallow-ignore-next-line high-crap-score
|
||||
function mediaRows(manifestPath: string): MediaVectorRow[] {
|
||||
const parsed = JSON.parse(readFileSync(manifestPath, "utf8")) as
|
||||
| MediaVectorRow[]
|
||||
| Record<string, Omit<MediaVectorRow, "id" | "kind" | "title" | "tags"> & { tags?: string[] }>;
|
||||
const bundledSfx = manifestPath.endsWith("skills/media-use/audio/assets/sfx/manifest.json");
|
||||
const rootRelativeFile = (file: string): string =>
|
||||
bundledSfx && !file.startsWith("skills/") ? `skills/media-use/audio/assets/sfx/${file}` : file;
|
||||
const rows = Array.isArray(parsed)
|
||||
? parsed.map((row) => ({ ...row, file: rootRelativeFile(row.file) }))
|
||||
: Object.entries(parsed).map(([id, entry]) => ({
|
||||
id,
|
||||
kind: "sfx",
|
||||
title: id,
|
||||
description: entry.description,
|
||||
tags: entry.tags ?? ["sfx"],
|
||||
file: rootRelativeFile(entry.file),
|
||||
...(entry.duration === undefined ? {} : { duration: entry.duration }),
|
||||
...(entry.dimensions === undefined ? {} : { dimensions: entry.dimensions }),
|
||||
}));
|
||||
if (rows.length === 0) throw new Error(`media manifest contains no rows: ${manifestPath}`);
|
||||
for (const row of rows) {
|
||||
if (
|
||||
!row.id ||
|
||||
!row.kind ||
|
||||
!row.file ||
|
||||
!row.title ||
|
||||
!row.description ||
|
||||
!Array.isArray(row.tags) ||
|
||||
!row.tags.every((tag) => typeof tag === "string")
|
||||
) {
|
||||
throw new Error(`media manifest row is missing id, title, description, or file`);
|
||||
}
|
||||
if (row.duration !== undefined && (!Number.isFinite(row.duration) || row.duration < 0)) {
|
||||
throw new Error(`media manifest row ${row.id} has an invalid duration`);
|
||||
}
|
||||
if (
|
||||
row.dimensions !== undefined &&
|
||||
(!Number.isInteger(row.dimensions.width) ||
|
||||
!Number.isInteger(row.dimensions.height) ||
|
||||
row.dimensions.width <= 0 ||
|
||||
row.dimensions.height <= 0)
|
||||
) {
|
||||
throw new Error(`media manifest row ${row.id} has invalid dimensions`);
|
||||
}
|
||||
}
|
||||
return [...rows].sort((left, right) => left.id.localeCompare(right.id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Embed in batches, in `names` order.
|
||||
*
|
||||
@@ -81,19 +145,29 @@ function packVectors(names: string[], vectors: number[][]): Float32Array {
|
||||
async function main(): Promise<void> {
|
||||
const dir = arg("artifact") ?? "registry/catalog-artifact";
|
||||
const registryDir = arg("registry") ?? "registry";
|
||||
const manifestPath = arg("manifest");
|
||||
const basename = arg("output") ?? (manifestPath ? "media-vectors" : "local-vectors");
|
||||
|
||||
// Read the corpus straight from the registry rather than from a catalog.json
|
||||
// built by the hosted-tier script. That file is not in the repo, so the
|
||||
// documented regeneration command used to fail on a missing path, which is
|
||||
// the whole reason the index was allowed to drift.
|
||||
const catalogMap = catalogFromRegistry(
|
||||
registryDir,
|
||||
(path) => readFileSync(path, "utf-8"),
|
||||
(path) =>
|
||||
readdirSync(path, { withFileTypes: true })
|
||||
.filter((e) => e.isDirectory())
|
||||
.map((e) => e.name),
|
||||
);
|
||||
const rows = manifestPath ? mediaRows(manifestPath) : undefined;
|
||||
const catalogMap = rows
|
||||
? new Map(
|
||||
rows.map((row) => [
|
||||
row.id,
|
||||
`${row.title}\n${row.description}\n${row.tags.join(" ")}\n${row.kind}`,
|
||||
]),
|
||||
)
|
||||
: catalogFromRegistry(
|
||||
registryDir,
|
||||
(path) => readFileSync(path, "utf-8"),
|
||||
(path) =>
|
||||
readdirSync(path, { withFileTypes: true })
|
||||
.filter((e) => e.isDirectory())
|
||||
.map((e) => e.name),
|
||||
);
|
||||
const catalog = Object.fromEntries(catalogMap);
|
||||
const names = Object.keys(catalog).sort();
|
||||
if (names.length === 0) throw new Error(`no registry items found under ${registryDir}`);
|
||||
@@ -121,26 +195,35 @@ async function main(): Promise<void> {
|
||||
|
||||
const vectors = await embedInBatches(names, catalog, embedder);
|
||||
const flat = packVectors(names, vectors);
|
||||
const credits =
|
||||
rows && manifestPath?.endsWith("skills/media-use/audio/assets/sfx/manifest.json")
|
||||
? {
|
||||
file: "skills/media-use/audio/assets/sfx/CREDITS.md",
|
||||
sha256: sha256Hex(readFileSync("skills/media-use/audio/assets/sfx/CREDITS.md", "utf8")),
|
||||
}
|
||||
: undefined;
|
||||
|
||||
writeFileSync(join(dir, "local-vectors.bin"), Buffer.from(flat.buffer));
|
||||
writeFileSync(join(dir, `${basename}.bin`), Buffer.from(flat.buffer));
|
||||
writeFileSync(
|
||||
join(dir, "local-vectors.json"),
|
||||
`${JSON.stringify({ model: LOCAL_MODEL_ID, modelRevision: LOCAL_MODEL_REVISION, dimensions: LOCAL_MODEL_DIMENSIONS, revision, names }, null, 2)}\n`,
|
||||
);
|
||||
const registryPath = join(registryDir, "registry.json");
|
||||
const registry = JSON.parse(readFileSync(registryPath, "utf-8")) as RegistryManifest;
|
||||
writeFileSync(
|
||||
registryPath,
|
||||
`${JSON.stringify({ ...registry, catalogArtifact: { revision } }, null, 2)}\n`,
|
||||
join(dir, `${basename}.json`),
|
||||
`${JSON.stringify({ model: LOCAL_MODEL_ID, modelRevision: LOCAL_MODEL_REVISION, dimensions: LOCAL_MODEL_DIMENSIONS, revision, names, ...(rows ? { rows, metadataRevision: mediaMetadataRevision(rows) } : {}), ...(credits ? { credits } : {}) }, null, 2)}\n`,
|
||||
);
|
||||
if (!rows) {
|
||||
const registryPath = join(registryDir, "registry.json");
|
||||
const registry = JSON.parse(readFileSync(registryPath, "utf-8")) as RegistryManifest;
|
||||
writeFileSync(
|
||||
registryPath,
|
||||
`${JSON.stringify({ ...registry, catalogArtifact: { revision } }, null, 2)}\n`,
|
||||
);
|
||||
}
|
||||
|
||||
const megabytes = (flat.byteLength / 1024 / 1024).toFixed(2);
|
||||
console.log(`moves ${names.length}`);
|
||||
console.log(`${rows ? "media" : "moves"} ${names.length}`);
|
||||
console.log(`model ${LOCAL_MODEL_ID}`);
|
||||
console.log(`dimensions ${LOCAL_MODEL_DIMENSIONS}`);
|
||||
console.log(`revision ${revision}`);
|
||||
console.log(`payload ${megabytes} MB`);
|
||||
console.log(`written ${dir}`);
|
||||
console.log(`written ${dir}/${basename}.{json,bin}`);
|
||||
}
|
||||
|
||||
await main();
|
||||
|
||||
@@ -148,6 +148,10 @@ export function localVectorRevision(
|
||||
);
|
||||
}
|
||||
|
||||
export function mediaMetadataRevision(rows: readonly unknown[]): string {
|
||||
return sha256Hex(JSON.stringify(rows));
|
||||
}
|
||||
|
||||
/**
|
||||
* Digest the two published files as bytes.
|
||||
*
|
||||
|
||||
@@ -18,14 +18,38 @@ import {
|
||||
LOCAL_MODEL_ID,
|
||||
LOCAL_MODEL_REVISION,
|
||||
} from "../../packages/cli/src/registry/localModel.js";
|
||||
import { catalogFromRegistry, localVectorRevision } from "./catalog-artifact.js";
|
||||
import {
|
||||
catalogFromRegistry,
|
||||
localVectorRevision,
|
||||
mediaMetadataRevision,
|
||||
sha256Hex,
|
||||
} from "./catalog-artifact.js";
|
||||
|
||||
type RegistryItem = { name: string; type?: string };
|
||||
type Registry = { items: RegistryItem[]; catalogArtifact?: { revision?: string } };
|
||||
type Artifact = { model?: string; dimensions?: number; revision?: string; names?: string[] };
|
||||
type MediaArtifact = {
|
||||
model?: string;
|
||||
modelRevision?: string;
|
||||
dimensions?: number;
|
||||
revision?: string;
|
||||
metadataRevision?: string;
|
||||
credits?: { file?: string; sha256?: string };
|
||||
names?: string[];
|
||||
rows?: Array<{
|
||||
id?: string;
|
||||
file?: string;
|
||||
title?: string;
|
||||
description?: string;
|
||||
tags?: string[];
|
||||
kind?: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
const REGISTRY = "registry/registry.json";
|
||||
const ARTIFACT = "registry/catalog-artifact/local-vectors.json";
|
||||
const MEDIA_MANIFEST = "skills/media-use/audio/assets/sfx/manifest.json";
|
||||
const MEDIA_ARTIFACT = "registry/catalog-artifact/media-vectors.json";
|
||||
|
||||
function read<T>(path: string): T {
|
||||
try {
|
||||
@@ -67,6 +91,70 @@ const expectedRevision = localVectorRevision(
|
||||
);
|
||||
const artifactRevisionMatches = artifact.revision === expectedRevision;
|
||||
const registryRevisionMatches = registry.catalogArtifact?.revision === expectedRevision;
|
||||
const mediaSource =
|
||||
read<Record<string, { file?: string; description?: string; duration?: number }>>(MEDIA_MANIFEST);
|
||||
const mediaArtifact = read<MediaArtifact>(MEDIA_ARTIFACT);
|
||||
const mediaRowsFromSource = Object.entries(mediaSource)
|
||||
.sort(([left], [right]) => left.localeCompare(right))
|
||||
.map(([id, source]) => ({
|
||||
id,
|
||||
kind: "sfx",
|
||||
title: id,
|
||||
description: source.description ?? "",
|
||||
tags: ["sfx"],
|
||||
file: `skills/media-use/audio/assets/sfx/${source.file ?? ""}`,
|
||||
...(source.duration === undefined ? {} : { duration: source.duration }),
|
||||
}));
|
||||
const mediaEntries = new Map(
|
||||
mediaRowsFromSource.map((row) => [
|
||||
row.id,
|
||||
`${row.title}\n${row.description}\n${row.tags.join(" ")}\n${row.kind}`,
|
||||
]),
|
||||
);
|
||||
const expectedMediaRevision = localVectorRevision(
|
||||
LOCAL_MODEL_ID,
|
||||
LOCAL_MODEL_REVISION,
|
||||
LOCAL_MODEL_DIMENSIONS,
|
||||
mediaEntries,
|
||||
);
|
||||
const expectedMediaMetadataRevision = mediaMetadataRevision(mediaRowsFromSource);
|
||||
const expectedCredits = {
|
||||
file: "skills/media-use/audio/assets/sfx/CREDITS.md",
|
||||
sha256: sha256Hex(readFileSync("skills/media-use/audio/assets/sfx/CREDITS.md", "utf8")),
|
||||
};
|
||||
const mediaBin = readFileSync(MEDIA_ARTIFACT.replace(/\.json$/, ".bin"));
|
||||
const mediaRows = new Map(
|
||||
(mediaArtifact.rows ?? [])
|
||||
.filter(
|
||||
(row): row is { id: string; file: string } =>
|
||||
typeof row.id === "string" && typeof row.file === "string",
|
||||
)
|
||||
.map((row) => [row.id, row.file]),
|
||||
);
|
||||
const missingMediaRows = Object.entries(mediaSource)
|
||||
.filter(
|
||||
([id, source]) =>
|
||||
mediaRows.get(id) !== `skills/media-use/audio/assets/sfx/${source.file ?? ""}`,
|
||||
)
|
||||
.map(([id]) => id)
|
||||
.sort();
|
||||
const mediaNames = mediaArtifact.names ?? [];
|
||||
const mediaRowsMatchNames =
|
||||
(mediaArtifact.rows ?? []).length === mediaNames.length &&
|
||||
(mediaArtifact.rows ?? []).every((row, index) => row.id === mediaNames[index]);
|
||||
const mediaRowsMatchSource =
|
||||
JSON.stringify(mediaArtifact.rows ?? []) === JSON.stringify(mediaRowsFromSource);
|
||||
const mediaArtifactValid =
|
||||
mediaArtifact.model === LOCAL_MODEL_ID &&
|
||||
mediaArtifact.modelRevision === LOCAL_MODEL_REVISION &&
|
||||
mediaArtifact.dimensions === LOCAL_MODEL_DIMENSIONS &&
|
||||
mediaArtifact.revision === expectedMediaRevision &&
|
||||
mediaArtifact.metadataRevision === expectedMediaMetadataRevision &&
|
||||
mediaArtifact.credits?.file === expectedCredits.file &&
|
||||
mediaArtifact.credits.sha256 === expectedCredits.sha256 &&
|
||||
mediaRowsMatchSource &&
|
||||
mediaRowsMatchNames &&
|
||||
mediaBin.byteLength === mediaNames.length * LOCAL_MODEL_DIMENSIONS * 4;
|
||||
|
||||
const show = (names: string[]) =>
|
||||
names
|
||||
@@ -76,6 +164,17 @@ const show = (names: string[]) =>
|
||||
|
||||
console.log(`registry: ${registryNames.size} searchable items (blocks + components)`);
|
||||
console.log(`artifact: ${artifactNames.size} vectors (${artifact.model ?? "unknown model"})`);
|
||||
console.log(
|
||||
`media: ${mediaRows.size} rows for ${Object.keys(mediaSource).length} bundled SFX files`,
|
||||
);
|
||||
|
||||
if (missingMediaRows.length > 0) {
|
||||
console.error(`\n${missingMediaRows.length} bundled SFX file(s) have no matching media row:`);
|
||||
console.error(show(missingMediaRows));
|
||||
}
|
||||
if (!mediaArtifactValid) {
|
||||
console.error("\nThe published media vector metadata or binary does not match the SFX manifest.");
|
||||
}
|
||||
|
||||
if (dropped.length > 0) {
|
||||
// Not fatal: the CLI filters these before a user ever sees them.
|
||||
@@ -96,7 +195,13 @@ if (!artifactRevisionMatches || !registryRevisionMatches) {
|
||||
console.error(` registry: ${registry.catalogArtifact?.revision ?? "missing"}`);
|
||||
}
|
||||
|
||||
if (unindexed.length > 0 || !artifactRevisionMatches || !registryRevisionMatches) {
|
||||
if (
|
||||
unindexed.length > 0 ||
|
||||
!artifactRevisionMatches ||
|
||||
!registryRevisionMatches ||
|
||||
missingMediaRows.length > 0 ||
|
||||
!mediaArtifactValid
|
||||
) {
|
||||
console.error(
|
||||
"\nMeaning search is stale. Word search still uses the live registry.\n\n" +
|
||||
"If you have the embedding model, regenerate and commit the artifact:\n" +
|
||||
|
||||
@@ -118,7 +118,18 @@ const beforeSet = new Set(before);
|
||||
const afterSet = new Set(after);
|
||||
const missing = before.filter((p) => !afterSet.has(p));
|
||||
const added = after.filter((p) => !beforeSet.has(p));
|
||||
assert.equal(missing.length, 0, `Pages present before but missing after: ${missing.join(", ")}`);
|
||||
const liveRegistryPages = new Set(
|
||||
readJson(path.join(root, "registry", "registry.json")).items.map((item) => {
|
||||
const kind = item.type === "hyperframes:block" ? "blocks" : "components";
|
||||
return `/catalog/${kind}/${item.name}`;
|
||||
}),
|
||||
);
|
||||
const unexpectedMissing = missing.filter((page) => liveRegistryPages.has(page));
|
||||
assert.equal(
|
||||
unexpectedMissing.length,
|
||||
0,
|
||||
`Live catalog pages missing after: ${unexpectedMissing.join(", ")}`,
|
||||
);
|
||||
console.log(
|
||||
`PASS no page lost: ${before.length} pages before, ${after.length} after` +
|
||||
(added.length ? ` (${added.length} legitimately new: ${added.join(", ")})` : ""),
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
import { describe, it } from "node:test";
|
||||
|
||||
const skillLibDir = resolve("skills/media-use/scripts/lib");
|
||||
const cliLibDir = resolve("packages/cli/src/media-use/lib");
|
||||
|
||||
export const MEDIA_USE_COPY_NAMES = [
|
||||
"cutlist.mjs",
|
||||
"duck.mjs",
|
||||
"error-diffusion.mjs",
|
||||
"index-gen.mjs",
|
||||
"manifest.mjs",
|
||||
"media-fetch.mjs",
|
||||
"npx-sync.mjs",
|
||||
"parakeet-words.mjs",
|
||||
"prefs-store.mjs",
|
||||
"recipe-store.mjs",
|
||||
"telemetry.mjs",
|
||||
"words.mjs",
|
||||
];
|
||||
|
||||
export const INTENTIONAL_MEDIA_USE_DIVERGENCES = new Map([
|
||||
[
|
||||
"media-fetch.mjs",
|
||||
"the standalone skill uses a shim because it cannot import the CLI package tree",
|
||||
],
|
||||
[
|
||||
"npx-sync.mjs",
|
||||
"the standalone skill stays self-contained while the CLI copy uses the shared audio helper",
|
||||
],
|
||||
]);
|
||||
|
||||
function copyPaths(name, skillDir, cliDir) {
|
||||
return { skillPath: join(skillDir, name), cliPath: join(cliDir, name) };
|
||||
}
|
||||
|
||||
export function findMediaUseCopyParityIssues({ skillDir = skillLibDir, cliDir = cliLibDir } = {}) {
|
||||
const missingNames = MEDIA_USE_COPY_NAMES.filter((name) => {
|
||||
const { skillPath, cliPath } = copyPaths(name, skillDir, cliDir);
|
||||
return !existsSync(skillPath) || !existsSync(cliPath);
|
||||
});
|
||||
const missing = missingNames.map((name) => `${name}: both media-use copies must exist`);
|
||||
const drifted = MEDIA_USE_COPY_NAMES.filter(
|
||||
(name) => !missingNames.includes(name) && !INTENTIONAL_MEDIA_USE_DIVERGENCES.has(name),
|
||||
)
|
||||
.filter((name) => {
|
||||
const { skillPath, cliPath } = copyPaths(name, skillDir, cliDir);
|
||||
return !readFileSync(skillPath).equals(readFileSync(cliPath));
|
||||
})
|
||||
.map((name) => `${name}: standalone and CLI copies differ without an allowlist reason`);
|
||||
return [...missing, ...drifted];
|
||||
}
|
||||
|
||||
describe("media-use source parity", () => {
|
||||
it("keeps every standalone copy equal or explicitly allowlisted", () => {
|
||||
assert.deepEqual(findMediaUseCopyParityIssues(), []);
|
||||
});
|
||||
|
||||
it("reports a missing copy without reading it as drift", () => {
|
||||
const root = mkdtempSync(join(tmpdir(), "media-use-parity-"));
|
||||
const skillDir = join(root, "skill");
|
||||
const cliDir = join(root, "cli");
|
||||
try {
|
||||
const name = MEDIA_USE_COPY_NAMES[0];
|
||||
mkdirSync(skillDir, { recursive: true });
|
||||
mkdirSync(cliDir, { recursive: true });
|
||||
writeFileSync(join(skillDir, name), "same");
|
||||
const issues = findMediaUseCopyParityIssues({ skillDir, cliDir });
|
||||
assert.equal(issues[0], `${name}: both media-use copies must exist`);
|
||||
} finally {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -52,6 +52,10 @@ export const ALLOWED_DELETIONS = new Map([
|
||||
"packages/studio/src/player/components/useTimelineClipDisclosure.ts",
|
||||
"the timeline no longer exposes inline clip disclosure controls",
|
||||
],
|
||||
[
|
||||
"scripts/test-reachability-baseline.json",
|
||||
"Reachability now requires zero orphans and rejects baseline files.",
|
||||
],
|
||||
[
|
||||
"packages/studio/src/player/hooks/useTimelineRowElements.ts",
|
||||
"D-834 removes the duplicate row-source hook; manifest elements are now the single timeline row owner",
|
||||
@@ -371,6 +375,694 @@ export const ALLOWED_DELETIONS = new Map([
|
||||
"packages/studio/src/hooks/useProjectSignaturePoll.ts",
|
||||
"packages/studio/src/hooks/useStoryboard.ts",
|
||||
].map((path) => [path, STORYBOARD_VIEW_REASON]),
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-basic.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-clear-dark.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-clear-light.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-grass.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-homebrew.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-man-page.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-novel.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-ocean.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-red-sands.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-silver-aerogel.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-apple-terminal-solid-colors.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-dark-plus.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-flight.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-high-contrast-light.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-high-contrast.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-light-2026.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-light-modern.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-light-plus.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-monokai.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-solarized-light.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-visual-studio-dark.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/code-snippet-visual-studio-light.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/liquid-glass-context-menu.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/catalog/blocks/liquid-glass-media-controls.mdx",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-basic.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-clear-dark.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-clear-light.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-grass.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-homebrew.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-man-page.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-novel.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-ocean.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-red-sands.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-silver-aerogel.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-apple-terminal-solid-colors.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-dark-plus.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-flight.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-high-contrast-light.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-high-contrast.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-light-2026.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-light-modern.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-light-plus.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-monokai.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-solarized-light.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-visual-studio-dark.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/code-snippet-visual-studio-light.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/liquid-glass-context-menu.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/blocks/liquid-glass-media-controls.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-dark-plus/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-dark-plus/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-high-contrast-light/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-high-contrast-light/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-high-contrast/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-high-contrast/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-light-2026/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-light-2026/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-light-modern/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-light-modern/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-light-plus/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-light-plus/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-monokai/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-monokai/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-solarized-light/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-solarized-light/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-visual-studio-dark/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-visual-studio-dark/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-visual-studio-light/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"docs/public/catalog/items/code-snippet-visual-studio-light/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-basic/code-snippet-apple-terminal-basic.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-basic/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-clear-dark/code-snippet-apple-terminal-clear-dark.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-clear-dark/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-clear-light/code-snippet-apple-terminal-clear-light.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-clear-light/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-grass/code-snippet-apple-terminal-grass.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-grass/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-homebrew/code-snippet-apple-terminal-homebrew.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-homebrew/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-man-page/code-snippet-apple-terminal-man-page.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-man-page/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-novel/code-snippet-apple-terminal-novel.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-novel/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-ocean/code-snippet-apple-terminal-ocean.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-ocean/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-red-sands/code-snippet-apple-terminal-red-sands.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-red-sands/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-silver-aerogel/code-snippet-apple-terminal-silver-aerogel.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-silver-aerogel/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-solid-colors/code-snippet-apple-terminal-solid-colors.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-apple-terminal-solid-colors/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-dark-plus/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-dark-plus/code-snippet-dark-plus.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-dark-plus/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-flight/code-snippet-flight.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-flight/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-high-contrast-light/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-high-contrast-light/code-snippet-high-contrast-light.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-high-contrast-light/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-high-contrast/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-high-contrast/code-snippet-high-contrast.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-high-contrast/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-light-2026/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-light-2026/code-snippet-light-2026.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-light-2026/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-light-modern/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-light-modern/code-snippet-light-modern.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-light-modern/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-light-plus/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-light-plus/code-snippet-light-plus.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-light-plus/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-monokai/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-monokai/code-snippet-monokai.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-monokai/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-solarized-light/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-solarized-light/code-snippet-solarized-light.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-solarized-light/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-visual-studio-dark/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-visual-studio-dark/code-snippet-visual-studio-dark.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-visual-studio-dark/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-visual-studio-light/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-visual-studio-light/code-snippet-visual-studio-light.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/code-snippet-visual-studio-light/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/liquid-glass-context-menu/lib/liquid-glass.iife.js",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/liquid-glass-context-menu/liquid-glass-context-menu.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/liquid-glass-context-menu/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/liquid-glass-media-controls/lib/liquid-glass.iife.js",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/liquid-glass-media-controls/liquid-glass-media-controls.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/blocks/liquid-glass-media-controls/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/airbnb-deck/DESIGN.md",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/airbnb-deck/index.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/airbnb-deck/sfx/advance.mp3",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/airbnb-deck/sfx/back.mp3",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/airbnb-deck/sfx/branch-enter.mp3",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/airbnb-deck/sfx/fragment.mp3",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/motion-blur/index.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/slideshow-demo/index.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/startup-pitch/demo.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/startup-pitch/index.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/DESIGN.md",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/background.jpeg",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-sequence-runtime.js",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-sequence.css",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-theme-registry.js",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/2026-dark.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/2026-light.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/LICENSE",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/dark_modern.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/dark_plus.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/dark_vs.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/hc_black.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/hc_light.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/light_modern.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/light_plus.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/light_vs.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/monokai-color-theme.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/assets/vscode-themes/solarized-light-color-theme.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/index.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/registry-item.json",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/dark-2026.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/dark-modern.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/dark-plus.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/high-contrast-light.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/high-contrast.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/light-2026.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/light-modern.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/light-plus.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/monokai.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/solarized-light.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/visual-studio-dark.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/render-entries/visual-studio-light.html",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/scripts/build-compositions.mjs",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
[
|
||||
"registry/examples/vscode-theme-visualizer/scripts/build-theme-registry.mjs",
|
||||
"removed in the 2026-09 low-use catalog cut, see the PR",
|
||||
],
|
||||
]);
|
||||
|
||||
export function parseBase(argv, fallback = "origin/main") {
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env node
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const REGISTRY_ITEM_PATH =
|
||||
/^registry\/(?:blocks|components|examples)\/([^/]+)\/registry-item\.json$/;
|
||||
|
||||
export function registryItemNamesFromPaths(paths) {
|
||||
const names = new Set();
|
||||
for (const path of paths) {
|
||||
const match = path.match(REGISTRY_ITEM_PATH);
|
||||
if (match) names.add(match[1]);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
// A name only counts as an intentional removal or addition when its own
|
||||
// registry-item.json file was deleted or added in the same diff — a bare
|
||||
// registry.json edit with no matching file change is never expected.
|
||||
export function computeRegistrySetDelta({ baseNames, headNames, removed, added }) {
|
||||
const expected = new Set([...baseNames].filter((name) => !removed.has(name)));
|
||||
for (const name of added) expected.add(name);
|
||||
const missing = [...expected].filter((name) => !headNames.has(name)).sort();
|
||||
const unexpected = [...headNames].filter((name) => !expected.has(name)).sort();
|
||||
return { missing, unexpected };
|
||||
}
|
||||
|
||||
function diffPaths(run, base, filter) {
|
||||
return run(["diff", "--name-only", `--diff-filter=${filter}`, base + "...HEAD"])
|
||||
.split("\n")
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
// IO is injected so the git/fs boundary can be swapped for a fake in tests;
|
||||
// the actual delta logic lives in computeRegistrySetDelta above.
|
||||
export function runRegistrySetDeltaCheck(base, { run, readRegistryJson }) {
|
||||
const baseManifest = JSON.parse(run(["show", base + ":registry/registry.json"]));
|
||||
const headManifest = JSON.parse(readRegistryJson());
|
||||
const removed = registryItemNamesFromPaths(diffPaths(run, base, "D"));
|
||||
const added = registryItemNamesFromPaths(diffPaths(run, base, "A"));
|
||||
const baseNames = new Set(baseManifest.items.map(({ name }) => name));
|
||||
const headNames = new Set(headManifest.items.map(({ name }) => name));
|
||||
const { missing, unexpected } = computeRegistrySetDelta({ baseNames, headNames, removed, added });
|
||||
return { missing, unexpected, removedCount: removed.size, addedCount: added.size };
|
||||
}
|
||||
|
||||
export function formatRegistrySetDeltaResult({
|
||||
base,
|
||||
missing,
|
||||
unexpected,
|
||||
removedCount,
|
||||
addedCount,
|
||||
}) {
|
||||
const sections = [
|
||||
["missing from registry.json", missing],
|
||||
["unexpected in registry.json", unexpected],
|
||||
].filter(([, names]) => names.length > 0);
|
||||
if (sections.length === 0) {
|
||||
return {
|
||||
ok: true,
|
||||
text: `Registry item-set delta matches ${removedCount} removal(s) and ${addedCount} addition(s) against ${base}.`,
|
||||
};
|
||||
}
|
||||
const lines = sections.map(([label, names]) => ` ${label}: ${names.join(", ")}`);
|
||||
return {
|
||||
ok: false,
|
||||
text: ["Registry item-set delta mismatch against " + base + ":", ...lines].join("\n"),
|
||||
};
|
||||
}
|
||||
|
||||
function main() {
|
||||
const base = process.argv[2] ?? "origin/main";
|
||||
const run = (args) => execFileSync("git", args, { encoding: "utf8" }).trim();
|
||||
const readRegistryJson = () => readFileSync("registry/registry.json", "utf8");
|
||||
const delta = runRegistrySetDeltaCheck(base, { run, readRegistryJson });
|
||||
const result = formatRegistrySetDeltaResult({ base, ...delta });
|
||||
if (!result.ok) process.exitCode = 1;
|
||||
console[result.ok ? "log" : "error"](result.text);
|
||||
}
|
||||
|
||||
const entryPath = process.argv[1] ? resolve(process.argv[1]) : null;
|
||||
if (entryPath === fileURLToPath(import.meta.url)) main();
|
||||
@@ -0,0 +1,138 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import {
|
||||
computeRegistrySetDelta,
|
||||
formatRegistrySetDeltaResult,
|
||||
registryItemNamesFromPaths,
|
||||
runRegistrySetDeltaCheck,
|
||||
} from "./check-registry-set-delta.mjs";
|
||||
|
||||
describe("registryItemNamesFromPaths", () => {
|
||||
it("extracts the item name from a registry-item.json path", () => {
|
||||
assert.deepEqual(
|
||||
registryItemNamesFromPaths([
|
||||
"registry/components/text-match-cut/registry-item.json",
|
||||
"registry/blocks/week-in-merges/registry-item.json",
|
||||
]),
|
||||
new Set(["text-match-cut", "week-in-merges"]),
|
||||
);
|
||||
});
|
||||
|
||||
it("ignores paths that are not a top-level registry-item.json", () => {
|
||||
assert.deepEqual(
|
||||
registryItemNamesFromPaths([
|
||||
"registry/components/text-match-cut/text-match-cut.html",
|
||||
"registry/registry.json",
|
||||
"docs/catalog/components/text-match-cut.mdx",
|
||||
]),
|
||||
new Set(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("computeRegistrySetDelta", () => {
|
||||
it("passes a real addition backed by a new registry-item.json", () => {
|
||||
const { missing, unexpected } = computeRegistrySetDelta({
|
||||
baseNames: new Set(["existing"]),
|
||||
headNames: new Set(["existing", "text-match-cut"]),
|
||||
removed: new Set(),
|
||||
added: new Set(["text-match-cut"]),
|
||||
});
|
||||
assert.deepEqual(missing, []);
|
||||
assert.deepEqual(unexpected, []);
|
||||
});
|
||||
|
||||
it("passes a real removal backed by a deleted registry-item.json", () => {
|
||||
const { missing, unexpected } = computeRegistrySetDelta({
|
||||
baseNames: new Set(["existing", "old-item"]),
|
||||
headNames: new Set(["existing"]),
|
||||
removed: new Set(["old-item"]),
|
||||
added: new Set(),
|
||||
});
|
||||
assert.deepEqual(missing, []);
|
||||
assert.deepEqual(unexpected, []);
|
||||
});
|
||||
|
||||
it("fails a registry.json entry added with no matching registry-item.json file", () => {
|
||||
const { missing, unexpected } = computeRegistrySetDelta({
|
||||
baseNames: new Set(["existing"]),
|
||||
headNames: new Set(["existing", "fake-item"]),
|
||||
removed: new Set(),
|
||||
added: new Set(),
|
||||
});
|
||||
assert.deepEqual(missing, []);
|
||||
assert.deepEqual(unexpected, ["fake-item"]);
|
||||
});
|
||||
|
||||
it("fails a registry.json entry deleted with no matching file deletion", () => {
|
||||
const { missing, unexpected } = computeRegistrySetDelta({
|
||||
baseNames: new Set(["existing", "still-on-disk"]),
|
||||
headNames: new Set(["existing"]),
|
||||
removed: new Set(),
|
||||
added: new Set(),
|
||||
});
|
||||
assert.deepEqual(missing, ["still-on-disk"]);
|
||||
assert.deepEqual(unexpected, []);
|
||||
});
|
||||
});
|
||||
|
||||
describe("runRegistrySetDeltaCheck", () => {
|
||||
it("wires a fake git/fs boundary through to a clean addition result", () => {
|
||||
const run = (args) => {
|
||||
if (args[0] === "show") {
|
||||
return JSON.stringify({ items: [{ name: "existing" }] });
|
||||
}
|
||||
// diff --name-only --diff-filter=A|D base...HEAD
|
||||
const filter = args[2];
|
||||
if (filter === "--diff-filter=A") {
|
||||
return "registry/components/text-match-cut/registry-item.json\n";
|
||||
}
|
||||
return "";
|
||||
};
|
||||
const readRegistryJson = () =>
|
||||
JSON.stringify({ items: [{ name: "existing" }, { name: "text-match-cut" }] });
|
||||
const result = runRegistrySetDeltaCheck("origin/main", { run, readRegistryJson });
|
||||
assert.deepEqual(result, {
|
||||
missing: [],
|
||||
unexpected: [],
|
||||
removedCount: 0,
|
||||
addedCount: 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatRegistrySetDeltaResult", () => {
|
||||
it("reports ok with the removal/addition counts when the delta is clean", () => {
|
||||
const result = formatRegistrySetDeltaResult({
|
||||
base: "origin/main",
|
||||
missing: [],
|
||||
unexpected: [],
|
||||
removedCount: 0,
|
||||
addedCount: 1,
|
||||
});
|
||||
assert.equal(result.ok, true);
|
||||
assert.equal(
|
||||
result.text,
|
||||
"Registry item-set delta matches 0 removal(s) and 1 addition(s) against origin/main.",
|
||||
);
|
||||
});
|
||||
|
||||
it("reports both missing and unexpected names on a mismatch", () => {
|
||||
const result = formatRegistrySetDeltaResult({
|
||||
base: "origin/main",
|
||||
missing: ["still-on-disk"],
|
||||
unexpected: ["fake-item"],
|
||||
removedCount: 0,
|
||||
addedCount: 0,
|
||||
});
|
||||
assert.equal(result.ok, false);
|
||||
assert.equal(
|
||||
result.text,
|
||||
[
|
||||
"Registry item-set delta mismatch against origin/main:",
|
||||
" missing from registry.json: still-on-disk",
|
||||
" unexpected in registry.json: fake-item",
|
||||
].join("\n"),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,426 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import { readFileSync, existsSync } from "node:fs";
|
||||
import { posix, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { readTrackedPaths } from "./check-tracked-artifacts.mjs";
|
||||
|
||||
const BASELINE = "scripts/test-reachability-baseline.json";
|
||||
const MANIFEST = "scripts/test-reachability.json";
|
||||
const TEST = /\.test\.(?:mjs|tsx?)$/;
|
||||
const strings = (text) => [...text.matchAll(/["']([^"']+)["']/g)].map((m) => m[1]);
|
||||
export const digest = (text) => createHash("sha256").update(text).digest("hex");
|
||||
|
||||
const patterns = new Map();
|
||||
export function matches(path, glob) {
|
||||
if (patterns.has(glob)) return patterns.get(glob).test(path);
|
||||
if (glob.includes("{")) {
|
||||
const [part, choices] = glob.match(/\{([^}]+)\}/);
|
||||
return choices.split(",").some((choice) => matches(path, glob.replace(part, choice)));
|
||||
}
|
||||
const pattern = glob
|
||||
.replace(/[.+^$()|[\]\\]/g, "\\$&")
|
||||
.replace(/\*\*\//g, "\0")
|
||||
.replace(/\*\*/g, "\x01")
|
||||
.replace(/\*/g, "[^/]*")
|
||||
.replace(/\?/g, "[^/]")
|
||||
.replaceAll("\0", "(?:.*/)?")
|
||||
.replaceAll("\x01", ".*");
|
||||
const regex = new RegExp(`^${pattern}$`);
|
||||
patterns.set(glob, regex);
|
||||
return regex.test(path);
|
||||
}
|
||||
|
||||
function readFilters(source) {
|
||||
return Object.fromEntries(
|
||||
[...source.matchAll(/^ ([\w-]+):\n((?: - .*\n)+)/gm)].map(
|
||||
([, name, body]) => {
|
||||
const globs = [...body.matchAll(/^ - (["'])(.*?)\1(?:\s+#.*)?$/gm)].map(
|
||||
(match) => match[2],
|
||||
);
|
||||
if (globs.some((glob) => glob.startsWith("!")))
|
||||
throw new Error("Negated path filters need an explicit reachability model");
|
||||
return [name, globs];
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function jobField(body, key) {
|
||||
return body.match(new RegExp(`^ ${key}: (.*)$`, "m"))?.[1] ?? "";
|
||||
}
|
||||
|
||||
function readJob(block) {
|
||||
const name = block.match(/^ ([\w-]+):/)[1];
|
||||
const body = block.slice(block.indexOf("\n") + 1);
|
||||
const condition = jobField(body, "if");
|
||||
const needs = jobField(body, "needs");
|
||||
return {
|
||||
name,
|
||||
body,
|
||||
condition,
|
||||
needs: needs.replace(/[[\]]/g, "").split(/,\s*/).filter(Boolean),
|
||||
};
|
||||
}
|
||||
|
||||
// Reject unsupported control syntax instead of treating it as an unconditional job.
|
||||
export function readWorkflow(source) {
|
||||
if (/^\s+(?:paths|paths-ignore|branches-ignore):/m.test(source.split("jobs:\n")[0]))
|
||||
throw new Error("Workflow trigger restrictions need an explicit reachability model");
|
||||
if (/^ (?:needs|if):\s*$/m.test(source))
|
||||
throw new Error("Block job conditions and dependencies need an explicit reachability model");
|
||||
if (/^\s+(?:- )?working-directory:/m.test(source))
|
||||
throw new Error("Working-directory overrides need an explicit reachability model");
|
||||
const body = source.split("jobs:\n")[1];
|
||||
const jobs = body
|
||||
.split(/(?=^ [\w-]+:$)/m)
|
||||
.filter((block) => /^ [\w-]+:/.test(block))
|
||||
.map(readJob);
|
||||
return { filters: readFilters(source), jobs };
|
||||
}
|
||||
|
||||
function conditionEnabled(condition, path, filters) {
|
||||
const resolved = condition
|
||||
.replace(/needs\.changes\.outputs\.([\w-]+) == 'true'/g, (_, name) => {
|
||||
if (!filters[name]) throw new Error(`Unknown path filter: ${name}`);
|
||||
return String(filters[name].some((glob) => matches(path, glob)));
|
||||
})
|
||||
.replace(/always\(\)/g, "true")
|
||||
.replace(/github.event_name == 'pull_request'/g, "true")
|
||||
.replace(/\$\{\{|\}\}/g, "")
|
||||
.trim();
|
||||
if (!/^(?:true|false|\s|\|\||&&)+$/.test(resolved)) return false;
|
||||
return resolved
|
||||
.split("||")
|
||||
.some((part) => part.split("&&").every((term) => term.trim() === "true"));
|
||||
}
|
||||
|
||||
function enabled(job, path, workflow, seen = []) {
|
||||
if (seen.includes(job.name)) throw new Error(`Cyclic job dependency: ${job.name}`);
|
||||
const active = conditionEnabled(job.condition || "true", path, workflow.filters);
|
||||
return (
|
||||
active &&
|
||||
job.needs.every((name) =>
|
||||
enabled(
|
||||
workflow.jobs.find((entry) => entry.name === name) ?? {
|
||||
name,
|
||||
condition: "false",
|
||||
needs: [],
|
||||
},
|
||||
path,
|
||||
workflow,
|
||||
[...seen, job.name],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function blockCommand(step, start) {
|
||||
const rest = step.slice(start.index + start[0].length);
|
||||
const lines = (rest.match(/^(?: .*\n?)+/m)?.[0] ?? "")
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map((line) => line.trim());
|
||||
return lines.join(start[1].startsWith(">") ? " " : "\n");
|
||||
}
|
||||
|
||||
function commands(body) {
|
||||
return body.split(/(?=^ - )/m).flatMap((step) => {
|
||||
if (/^ (?: |-[ ])if:/m.test(step)) return [];
|
||||
const start = step.match(/^\s+(?:- )?run: (.*)$/m);
|
||||
if (!start) return [];
|
||||
if (!/^[|>]-?$/.test(start[1])) return [start[1]];
|
||||
return [blockCommand(step, start)];
|
||||
});
|
||||
}
|
||||
|
||||
function flatOptions(tokens) {
|
||||
let depth = 1;
|
||||
let result = "";
|
||||
for (const token of tokens) {
|
||||
depth -= Number(token === "}");
|
||||
if (depth === 0) return result;
|
||||
if (depth === 1) result += token;
|
||||
depth += Number(token === "{");
|
||||
}
|
||||
throw new Error("Unsupported test configuration");
|
||||
}
|
||||
|
||||
function optionTokens(source) {
|
||||
return (
|
||||
source.match(
|
||||
/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`|\/\*[\s\S]*?\*\/|\/\/[^\n]*|[{}]|[^{}"'`/]+|./g,
|
||||
) ?? []
|
||||
);
|
||||
}
|
||||
|
||||
function rejectQuotedSelectors(config) {
|
||||
if (/["'](?:test|include|exclude|projects|workspace)["']\s*:/.test(config))
|
||||
throw new Error("Quoted test selection keys need an explicit reachability model");
|
||||
}
|
||||
|
||||
function testOptions(config) {
|
||||
rejectQuotedSelectors(config);
|
||||
const start = config.match(/\btest:\s*\{/);
|
||||
if (!start) {
|
||||
if (/\btest:/.test(config)) throw new Error("Nonliteral test configuration");
|
||||
return "";
|
||||
}
|
||||
const tokens = optionTokens(config.slice(start.index + start[0].length));
|
||||
const result = flatOptions(tokens.filter((token) => !/^\/[/*]/.test(token)));
|
||||
if (result.includes("...")) throw new Error("Unsupported test configuration");
|
||||
return result;
|
||||
}
|
||||
|
||||
function selectionGlobs(testConfig, key, fallback) {
|
||||
const selection = testConfig.match(new RegExp(`\\b${key}:\\s*\\[([^\\]]*)\\]`));
|
||||
if (!selection) {
|
||||
if (new RegExp(`\\b${key}:`).test(testConfig)) throw new Error(`Unsupported ${key}`);
|
||||
return fallback;
|
||||
}
|
||||
if (selection[1].replace(/["'][^"']*["']/g, "").replace(/[,\s]/g, ""))
|
||||
throw new Error(`Nonliteral ${key}`);
|
||||
return strings(selection[1]);
|
||||
}
|
||||
|
||||
function runnerSelection(cwd, files, read) {
|
||||
const configurations = files.filter(
|
||||
(path) => posix.dirname(path) === cwd && /(?:vitest|vite)\.config\./.test(path),
|
||||
);
|
||||
if (configurations.some((path) => !path.endsWith(".ts")))
|
||||
throw new Error(`Unsupported runner config: ${configurations.join(", ")}`);
|
||||
const config =
|
||||
["vitest", "vite"]
|
||||
.map((name) => read(posix.join(cwd, `${name}.config.ts`)))
|
||||
.find((value) => value !== undefined) ?? "";
|
||||
const testConfig = testOptions(config);
|
||||
if (/\bprojects:|\bworkspace:/.test(testConfig))
|
||||
throw new Error(`Unsupported test projects in ${cwd}`);
|
||||
return {
|
||||
includes: selectionGlobs(testConfig, "include", ["**/*.test.{mjs,ts,tsx}"]),
|
||||
excludes: selectionGlobs(testConfig, "exclude", ["**/node_modules/**", "**/.git/**"]),
|
||||
};
|
||||
}
|
||||
|
||||
function selectedByRunner(relative, args, { includes, excludes }) {
|
||||
if (excludes.some((glob) => matches(relative, glob))) return false;
|
||||
if (!includes.some((glob) => matches(relative, glob))) return false;
|
||||
return args.length === 0 || args.some((arg) => relative.includes(arg));
|
||||
}
|
||||
|
||||
function runnerArguments(tokens, node, command) {
|
||||
const tail = tokens.slice(node ? tokens.indexOf("--test") + 1 : 2);
|
||||
if (
|
||||
tail.some(
|
||||
(token) => token.startsWith("-") && !["--coverage", "--passWithNoTests"].includes(token),
|
||||
)
|
||||
)
|
||||
throw new Error(`Unsupported test option: ${command}`);
|
||||
return tail.filter((token) => !token.startsWith("-"));
|
||||
}
|
||||
|
||||
function runnerKind(command) {
|
||||
if (/^node\s.*--test(?:\s|$)/.test(command)) return "node";
|
||||
if (/^vitest run(?:\s|$)/.test(command)) return "vitest";
|
||||
if (/^bun test(?:\s|$)/.test(command)) return "bun";
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function runnerCommand(command) {
|
||||
const kind = runnerKind(command);
|
||||
if (!kind) return undefined;
|
||||
const tokens = command.match(/"[^"]*"|'[^']*'|\S+/g).map((s) => s.replace(/^["']|["']$/g, ""));
|
||||
if (/[\n$`|;<>]/.test(command)) return undefined;
|
||||
return {
|
||||
node: kind === "node",
|
||||
vitest: kind === "vitest",
|
||||
args: runnerArguments(tokens, kind === "node", command),
|
||||
};
|
||||
}
|
||||
|
||||
function runnerTests(command, cwd, files, read) {
|
||||
const runner = runnerCommand(command);
|
||||
if (!runner) return [];
|
||||
const { node, vitest, args } = runner;
|
||||
const selection = vitest
|
||||
? runnerSelection(cwd, files, read)
|
||||
: { includes: ["**/*.test.{mjs,ts,tsx}"], excludes: [] };
|
||||
return files.filter((file) => {
|
||||
if (!TEST.test(file)) return false;
|
||||
const relative = posix.relative(cwd, file);
|
||||
if (relative.startsWith("../")) return false;
|
||||
if (node) return args.some((glob) => matches(relative, glob));
|
||||
return selectedByRunner(relative, args, selection);
|
||||
});
|
||||
}
|
||||
|
||||
function pinnedJob(text, name) {
|
||||
return readWorkflow(text).jobs.find((job) => job.name === name)?.body ?? "";
|
||||
}
|
||||
|
||||
function pinnedScript(text, name) {
|
||||
return JSON.parse(text).scripts[name] ?? "";
|
||||
}
|
||||
|
||||
export function pinnedSource(path, read) {
|
||||
const [file, kind, name] = path.split("#");
|
||||
const text = read(file);
|
||||
if (text === undefined) throw new Error(`Runner mapping needs review: ${path}`);
|
||||
if (kind === "job") return pinnedJob(text, name);
|
||||
if (kind === "script") return pinnedScript(text, name);
|
||||
return text;
|
||||
}
|
||||
|
||||
function adapterTests(adapter, files, read) {
|
||||
for (const [path, hash] of Object.entries(adapter.sources)) {
|
||||
if (digest(pinnedSource(path, read)) !== hash)
|
||||
throw new Error(`Runner mapping needs review: ${path}`);
|
||||
}
|
||||
return files.filter(
|
||||
(file) => TEST.test(file) && adapter.tests.some((glob) => matches(file, glob)),
|
||||
);
|
||||
}
|
||||
|
||||
function packageSelected(pkg, option, target, cwd) {
|
||||
if (option === "--cwd") return pkg.cwd === posix.join(cwd, target);
|
||||
if (option !== "--filter") return pkg.cwd === cwd;
|
||||
if (pkg.cwd === ".") return false;
|
||||
return filterPackageName(pkg.name, target);
|
||||
}
|
||||
function filterPackageName(name, target) {
|
||||
const negate = target.startsWith("!");
|
||||
const pattern = negate ? target.slice(1) : target;
|
||||
return matches(name.replaceAll("/", ":"), pattern.replaceAll("/", ":")) !== negate;
|
||||
}
|
||||
|
||||
function expandPackage(call, cwd, packages, files, read, adapters, seen) {
|
||||
const [, option, single, double, bare, script, args] = call;
|
||||
const target = single ?? double ?? bare;
|
||||
const selected = packages.filter((pkg) => packageSelected(pkg, option, target, cwd));
|
||||
return selected.flatMap((pkg) => {
|
||||
const body = pkg.scripts?.[script];
|
||||
if (!body) return [];
|
||||
const key = `${pkg.cwd}:${script}`;
|
||||
if (seen.includes(key)) throw new Error(`Cyclic package script: ${key}`);
|
||||
return expand(`${body}${args}`, pkg.cwd, packages, files, read, adapters, [...seen, key]);
|
||||
});
|
||||
}
|
||||
|
||||
const SHELL_CONTROL = new Set([
|
||||
"if",
|
||||
"then",
|
||||
"else",
|
||||
"elif",
|
||||
"fi",
|
||||
"for",
|
||||
"while",
|
||||
"until",
|
||||
"do",
|
||||
"done",
|
||||
"case",
|
||||
"esac",
|
||||
"test",
|
||||
"[",
|
||||
"[[",
|
||||
"cd",
|
||||
"false",
|
||||
"!",
|
||||
]);
|
||||
|
||||
function shellParts(command) {
|
||||
if (command.includes("\n") || command.includes("||")) return [];
|
||||
const parts = command.split(/\s*&&\s*/);
|
||||
if (parts.some((part) => SHELL_CONTROL.has(part.trim().split(/\s+/)[0]))) return [];
|
||||
return parts;
|
||||
}
|
||||
|
||||
function expand(command, cwd, packages, files, read, adapters, seen = []) {
|
||||
const adapter = adapters.find((entry) => entry.command === command && entry.cwd === cwd);
|
||||
if (adapter) return adapterTests(adapter, files, read);
|
||||
return shellParts(command).flatMap((part) =>
|
||||
expandSimple(part, cwd, packages, files, read, adapters, seen),
|
||||
);
|
||||
}
|
||||
function expandSimple(command, cwd, packages, files, read, adapters, seen) {
|
||||
const call = command.match(
|
||||
/^bun run (?:(--cwd|--filter) (?:'([^']+)'|"([^"]+)"|(\S+)) )?([\w:*-]+)(.*)$/,
|
||||
);
|
||||
if (!call) return runnerTests(command, cwd, files, read);
|
||||
return expandPackage(call, cwd, packages, files, read, adapters, seen);
|
||||
}
|
||||
|
||||
function testRoutes(workflow, packages, files, read, adapters) {
|
||||
const routes = new Map(files.filter((file) => TEST.test(file)).map((file) => [file, []]));
|
||||
for (const job of workflow.jobs) {
|
||||
for (const command of commands(job.body)) {
|
||||
for (const file of expand(command, ".", packages, files, read, adapters)) {
|
||||
routes.get(file).push(job);
|
||||
}
|
||||
}
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
|
||||
function declaredGuards(file, source, declarations) {
|
||||
if (declarations[file]) return declarations[file];
|
||||
const comment = source.split("\n")[0].match(/^\/\/ guards: (.+)$/)?.[1];
|
||||
return comment ? comment.split(/,\s*/) : [`${posix.dirname(file)}/**`];
|
||||
}
|
||||
function expandGuard(guard, file, files, cache) {
|
||||
if (!cache.has(guard))
|
||||
cache.set(guard, guard === file ? [file] : files.filter((p) => matches(p, guard)));
|
||||
const guarded = cache.get(guard);
|
||||
if (!guarded.length) throw new Error(`${file}: guard matches no tracked files: ${guard}`);
|
||||
return guarded;
|
||||
}
|
||||
function guardIssues(file, guards, jobs, files, workflow, cache) {
|
||||
if (!jobs.length) return ["no CI runner selects this test"];
|
||||
return [file, ...guards].flatMap((guard) => {
|
||||
const guarded = expandGuard(guard, file, files, cache);
|
||||
const missed = guarded.find((p) => !jobs.some((job) => enabled(job, p, workflow)));
|
||||
return missed ? [`CI filters exclude ${guard} (for example ${missed})`] : [];
|
||||
});
|
||||
}
|
||||
|
||||
export function audit(files, read, manifest) {
|
||||
const workflow = readWorkflow(read(".github/workflows/ci.yml"));
|
||||
const packages = files
|
||||
.filter((p) => p === "package.json" || /^packages\/[^/]+\/package.json$/.test(p))
|
||||
.map((p) => ({ ...JSON.parse(read(p)), cwd: posix.dirname(p) }));
|
||||
const routes = testRoutes(workflow, packages, files, read, manifest.runners);
|
||||
const issues = {};
|
||||
const guardFiles = new Map();
|
||||
for (const file of files.filter((p) => TEST.test(p))) {
|
||||
const jobs = routes.get(file) ?? [];
|
||||
const guards = declaredGuards(file, read(file), manifest.guards);
|
||||
const failures = guardIssues(file, guards, jobs, files, workflow, guardFiles);
|
||||
if (failures.length) issues[file] = failures;
|
||||
}
|
||||
return issues;
|
||||
}
|
||||
|
||||
export function verdict(issues, baselinePresent = false) {
|
||||
const errors = Object.entries(issues).map(
|
||||
([file, failures]) => `${file}: ${failures.join("; ")}`,
|
||||
);
|
||||
if (baselinePresent)
|
||||
errors.push("Test reachability baseline is forbidden; every test must be reachable.");
|
||||
return errors;
|
||||
}
|
||||
|
||||
function main() {
|
||||
const root = process.cwd();
|
||||
const files = readTrackedPaths(root);
|
||||
const read = (path) =>
|
||||
existsSync(resolve(root, path)) ? readFileSync(resolve(root, path), "utf8") : undefined;
|
||||
const issues = audit(files, read, JSON.parse(read(MANIFEST)));
|
||||
if (process.argv.includes("--report")) {
|
||||
console.log(JSON.stringify(issues, null, 2));
|
||||
return;
|
||||
}
|
||||
const errors = verdict(issues, existsSync(resolve(root, BASELINE)));
|
||||
if (errors.length) {
|
||||
console.error(errors.join("\n"));
|
||||
process.exitCode = 1;
|
||||
} else console.log("Test reachability verified: zero orphan tests.");
|
||||
}
|
||||
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main();
|
||||
@@ -0,0 +1,260 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { execFileSync, spawnSync } from "node:child_process";
|
||||
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { audit, digest, pinnedSource, verdict } from "./check-test-reachability.mjs";
|
||||
|
||||
function fixture(command = "bun run test:scripts", filter = '"scripts/**"') {
|
||||
return {
|
||||
".github/workflows/ci.yml": `name: CI
|
||||
jobs:
|
||||
changes:
|
||||
steps:
|
||||
- uses: dorny/paths-filter@v4
|
||||
with:
|
||||
filters: |
|
||||
code:
|
||||
- ${filter}
|
||||
test:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.code == 'true'
|
||||
steps:
|
||||
- run: ${command}
|
||||
`,
|
||||
"package.json": JSON.stringify({
|
||||
scripts: { "test:scripts": "node --test scripts/parity.test.mjs" },
|
||||
}),
|
||||
"scripts/parity.test.mjs": "// guards: skills/lib/**\n",
|
||||
"skills/lib/a.mjs": "",
|
||||
};
|
||||
}
|
||||
const check = (tree, manifest = { guards: {}, runners: [] }) =>
|
||||
audit(Object.keys(tree), (path) => tree[path], manifest);
|
||||
|
||||
test("planted guard-filter hole fails and adding its directory passes", () => {
|
||||
const tree = fixture();
|
||||
assert.match(verdict(check(tree))[0], /CI filters exclude skills\/lib/);
|
||||
tree[".github/workflows/ci.yml"] = tree[".github/workflows/ci.yml"].replace(
|
||||
'"scripts/**"',
|
||||
'"scripts/**"\n - "skills/**"',
|
||||
);
|
||||
assert.deepEqual(check(tree), {});
|
||||
});
|
||||
|
||||
test("removing a test from a package script makes it an orphan", () => {
|
||||
const tree = fixture("bun run test:scripts", '"**"');
|
||||
assert.deepEqual(check(tree), {});
|
||||
tree["package.json"] = JSON.stringify({
|
||||
scripts: { "test:scripts": "node --test scripts/other.test.mjs" },
|
||||
});
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("workspace scripts honor Vite include and exclude instead of package membership", () => {
|
||||
const tree = fixture("bun run --filter '*' test", '"**"');
|
||||
delete tree["scripts/parity.test.mjs"];
|
||||
tree["packages/a/package.json"] = JSON.stringify({
|
||||
name: "@scope/a",
|
||||
scripts: { test: "vitest run" },
|
||||
});
|
||||
tree["packages/a/src/a.test.ts"] = "";
|
||||
tree["packages/a/vite.config.ts"] =
|
||||
'export default { test: { include: ["src/**/*.test.ts"], exclude: ["src/a.test.ts"] } }';
|
||||
assert.match(check(tree)["packages/a/src/a.test.ts"][0], /no CI runner/);
|
||||
tree["packages/a/vite.config.ts"] =
|
||||
'export default { test: { include: ["src/**/*.test.ts"], coverage: { include: ["missing/**"] } } }';
|
||||
assert.deepEqual(check(tree), {});
|
||||
});
|
||||
|
||||
test("job dependencies can prevent an otherwise unfiltered job from running", () => {
|
||||
const tree = fixture("node --test scripts/parity.test.mjs", '"**"');
|
||||
tree[".github/workflows/ci.yml"] =
|
||||
tree[".github/workflows/ci.yml"].replace(" needs: changes", " needs: disabled") +
|
||||
" disabled:\n if: false\n steps: []\n";
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"].join("\n"), /CI filters exclude/);
|
||||
});
|
||||
|
||||
test("folded commands select tests but conditional steps are not assumed to run", () => {
|
||||
const tree = fixture(">-\n node --test\n scripts/parity.test.mjs", '"**"');
|
||||
assert.deepEqual(check(tree), {});
|
||||
tree[".github/workflows/ci.yml"] += " if: false\n";
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("workflow path restrictions cannot silently manufacture reachability", () => {
|
||||
const tree = fixture();
|
||||
tree[".github/workflows/ci.yml"] =
|
||||
"on:\n pull_request:\n paths: [docs/**]\n" + tree[".github/workflows/ci.yml"];
|
||||
assert.throws(() => check(tree), /trigger restrictions/);
|
||||
});
|
||||
|
||||
test("unknown runner options and config formats fail closed", () => {
|
||||
const tree = fixture("vitest run --exclude scripts/parity.test.mjs", '"**"');
|
||||
assert.throws(() => check(tree), /Unsupported test option/);
|
||||
tree[".github/workflows/ci.yml"] = fixture("vitest run", '"**"')[".github/workflows/ci.yml"];
|
||||
tree["vitest.config.js"] = 'export default { test: { exclude: ["**"] } }';
|
||||
assert.throws(() => check(tree), /Unsupported runner config/);
|
||||
});
|
||||
|
||||
test("custom runner mappings require matching commands and unchanged producer sources", () => {
|
||||
const tree = fixture("node custom.mjs", '"**"');
|
||||
tree["custom.mjs"] = "original runner";
|
||||
const manifest = {
|
||||
guards: {},
|
||||
runners: [
|
||||
{
|
||||
cwd: ".",
|
||||
command: "node custom.mjs",
|
||||
tests: ["scripts/*.test.mjs"],
|
||||
sources: { "custom.mjs": digest(tree["custom.mjs"]) },
|
||||
reason: "fixture",
|
||||
},
|
||||
],
|
||||
};
|
||||
assert.deepEqual(check(tree, manifest), {});
|
||||
tree["custom.mjs"] = "changed selection";
|
||||
assert.throws(() => check(tree, manifest), /mapping needs review/);
|
||||
});
|
||||
|
||||
test("zero orphans passes and any orphan fails", () => {
|
||||
assert.deepEqual(verdict({}), []);
|
||||
assert.deepEqual(verdict({ "a.test.ts": ["orphan"] }), ["a.test.ts: orphan"]);
|
||||
});
|
||||
|
||||
test("a baseline file is forbidden even with zero orphans", () => {
|
||||
assert.match(verdict({}, true)[0], /baseline is forbidden/);
|
||||
});
|
||||
|
||||
test("conditions in the first step key are never credited", () => {
|
||||
const tree = fixture("node --test scripts/parity.test.mjs", '"**"');
|
||||
tree[".github/workflows/ci.yml"] = tree[".github/workflows/ci.yml"].replace(
|
||||
" - run:",
|
||||
" - if: false\n run:",
|
||||
);
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("block dependency syntax fails closed instead of losing the dependency", () => {
|
||||
const tree = fixture();
|
||||
tree[".github/workflows/ci.yml"] = tree[".github/workflows/ci.yml"].replace(
|
||||
"needs: changes",
|
||||
"needs:\n - disabled",
|
||||
);
|
||||
assert.throws(() => check(tree), /Block job/);
|
||||
});
|
||||
|
||||
test("runner excludes after nested coverage options still apply", () => {
|
||||
const tree = fixture("vitest run", '"**"');
|
||||
tree["vitest.config.ts"] =
|
||||
'export default { test: { coverage: { include: ["**"] }, exclude: ["**"] } }';
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("a disabled change detector prevents dependent tests from running", () => {
|
||||
const tree = fixture("node --test scripts/parity.test.mjs", '"**"');
|
||||
tree[".github/workflows/ci.yml"] = tree[".github/workflows/ci.yml"].replace(
|
||||
" changes:\n",
|
||||
" changes:\n if: false\n",
|
||||
);
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"].join("\n"), /CI filters exclude/);
|
||||
});
|
||||
|
||||
test("quoted runner selection keys cannot silently change collection", () => {
|
||||
const tree = fixture("vitest run", '"**"');
|
||||
tree["vitest.config.ts"] = 'export default { test: { "exclude": ["**"] } }';
|
||||
assert.throws(() => check(tree), /Quoted test selection/);
|
||||
});
|
||||
|
||||
test("quoted comments do not widen path filters", () => {
|
||||
const tree = fixture("node --test scripts/parity.test.mjs", '"scripts/**" # "skills/**"');
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"].join("\n"), /CI filters exclude skills/);
|
||||
});
|
||||
|
||||
test("runner verbs must match exactly", () => {
|
||||
const tree = fixture("vitest run-anything", '"**"');
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("conditional shell blocks are not split into unconditional runners", () => {
|
||||
const tree = fixture(
|
||||
"|\n if false; then\n true && node --test scripts/parity.test.mjs && true\n fi",
|
||||
'"**"',
|
||||
);
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("single-line shell conditions cannot credit their guarded runner", () => {
|
||||
const tree = fixture("test -f dist/bundle.js && node --test scripts/parity.test.mjs", '"**"');
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("folded shell conditions cannot credit their guarded runner", () => {
|
||||
const tree = fixture(
|
||||
">-\n test -f dist/bundle.js &&\n node --test scripts/parity.test.mjs",
|
||||
'"**"',
|
||||
);
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("directory changes cannot credit a runner at the original working directory", () => {
|
||||
const tree = fixture("cd elsewhere && node --test scripts/parity.test.mjs", '"**"');
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("fallback shell branches cannot credit conditional runners", () => {
|
||||
const tree = fixture("false || true && node --test scripts/parity.test.mjs", '"**"');
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("ordinary sequential runners remain reachable", () => {
|
||||
const tree = fixture("node --test scripts/parity.test.mjs && vitest run", '"**"');
|
||||
assert.deepEqual(check(tree), {});
|
||||
});
|
||||
|
||||
test("known false commands cannot credit later runners", () => {
|
||||
const tree = fixture("false && node --test scripts/parity.test.mjs", '"**"');
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("negated shell commands cannot credit later runners", () => {
|
||||
const tree = fixture("! true && node --test scripts/parity.test.mjs", '"**"');
|
||||
assert.match(check(tree)["scripts/parity.test.mjs"][0], /no CI runner/);
|
||||
});
|
||||
|
||||
test("a missing pinned package gives the runner mapping diagnostic", () => {
|
||||
assert.throws(
|
||||
() => pinnedSource("missing/package.json#script#test", () => undefined),
|
||||
/Runner mapping needs review: missing\/package.json#script#test/,
|
||||
);
|
||||
});
|
||||
|
||||
test("report CLI prints diagnostics without applying the gate verdict", (t) => {
|
||||
const cwd = mkdtempSync(join(tmpdir(), "reachability-"));
|
||||
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
||||
const tree = fixture("node --test scripts/parity.test.mjs", '"**"');
|
||||
tree["scripts/test-reachability.json"] = JSON.stringify({ guards: {}, runners: [] });
|
||||
for (const [path, text] of Object.entries(tree)) {
|
||||
mkdirSync(dirname(join(cwd, path)), { recursive: true });
|
||||
writeFileSync(join(cwd, path), text);
|
||||
}
|
||||
execFileSync("git", ["init", "--quiet"], { cwd });
|
||||
execFileSync("git", ["add", "."], { cwd });
|
||||
const script = fileURLToPath(new URL("./check-test-reachability.mjs", import.meta.url));
|
||||
const run = () => spawnSync(process.execPath, [script, "--report"], { cwd, encoding: "utf8" });
|
||||
const clean = run();
|
||||
assert.equal(clean.status, 0, clean.stderr);
|
||||
const baseline = join(cwd, "scripts/test-reachability-baseline.json");
|
||||
writeFileSync(baseline, '{"total":0,"files":{}}');
|
||||
const restored = run();
|
||||
assert.equal(restored.status, 0, restored.stderr);
|
||||
assert.deepEqual(JSON.parse(restored.stdout), {});
|
||||
rmSync(baseline);
|
||||
writeFileSync(join(cwd, "scripts/orphan.test.mjs"), "");
|
||||
execFileSync("git", ["add", "."], { cwd });
|
||||
const orphan = run();
|
||||
assert.equal(orphan.status, 0, orphan.stderr);
|
||||
assert.match(orphan.stdout, /orphan.test.mjs/);
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"dark/ruler-ticks": 3.0215661841856103,
|
||||
"dark/pending-track-label": 2.2095660952157443,
|
||||
"dark/clip-timecode": 2.9640400066983745,
|
||||
"dark/active-clip-timecode": 2.44310754684879,
|
||||
"dark/clip-border-exterior": 2.8019036818215706,
|
||||
"dark/selected-handle": 2.3925236869074467,
|
||||
"dark/active-selected-handle": 2.0618519389873913,
|
||||
"dark/hovered-handle": 2.1777784316890663,
|
||||
"dark/active-hovered-handle": 1.8873389821795008,
|
||||
"dark/dragging-handle": 2.7718581542466456,
|
||||
"dark/active-dragging-handle": 2.3310570156777346
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
{
|
||||
"themes": [
|
||||
{
|
||||
"id": "dark",
|
||||
"selector": "@theme static",
|
||||
"canvas": "--timeline-shell-bg",
|
||||
"pairs": [
|
||||
{
|
||||
"id": "ruler-ticks",
|
||||
"foreground": "--timeline-tick-text",
|
||||
"background": ["--timeline-shell-bg"],
|
||||
"role": "text",
|
||||
"minimum": 4.5,
|
||||
"sources": [
|
||||
"packages/studio/src/player/components/TimelineRuler.tsx:105",
|
||||
"packages/studio/src/player/components/TimelineRuler.tsx:133"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "group-secondary-label",
|
||||
"foreground": "--timeline-text-secondary",
|
||||
"background": ["--timeline-gutter-bg"],
|
||||
"role": "text",
|
||||
"minimum": 4.5,
|
||||
"sources": [
|
||||
"packages/studio/src/player/components/TimelineLayerGroupHeader.tsx:62",
|
||||
"packages/studio/src/player/components/TimelineLayerGroupHeader.tsx:86"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "pending-track-label",
|
||||
"foreground": "--timeline-track-label",
|
||||
"background": ["--timeline-row-bg"],
|
||||
"role": "text",
|
||||
"minimum": 4.5,
|
||||
"sources": [
|
||||
"packages/studio/src/player/components/TimelineLanes.tsx:270",
|
||||
"packages/studio/src/player/components/TimelineLanes.tsx:353",
|
||||
"packages/studio/src/player/components/TimelineLanes.tsx:357"
|
||||
],
|
||||
"opacity": 0.5
|
||||
},
|
||||
{
|
||||
"id": "clip-label",
|
||||
"foreground": "--timeline-clip-chip-text",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-bg", "--timeline-clip-chip-bg"],
|
||||
"role": "text",
|
||||
"minimum": 4.5,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/studio.css:203",
|
||||
"packages/studio/src/styles/studio.css:286"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "audio-clip-label",
|
||||
"foreground": "--timeline-clip-chip-text",
|
||||
"background": [
|
||||
"--timeline-row-bg",
|
||||
"--timeline-clip-audio-bg",
|
||||
"--timeline-clip-chip-audio-bg"
|
||||
],
|
||||
"role": "text",
|
||||
"minimum": 4.5,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/studio.css:230",
|
||||
"packages/studio/src/styles/studio.css:300"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "clip-timecode",
|
||||
"foreground": "--timeline-tick-text",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-bg"],
|
||||
"role": "text",
|
||||
"minimum": 4.5,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/studio.css:203",
|
||||
"packages/studio/src/styles/studio.css:305"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "active-clip-timecode",
|
||||
"foreground": "--timeline-tick-text",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-bg", "--timeline-clip-bg-active"],
|
||||
"role": "text",
|
||||
"minimum": 4.5,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/studio.css:203",
|
||||
"packages/studio/src/styles/studio.css:213",
|
||||
"packages/studio/src/styles/studio.css:305"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "clip-border-exterior",
|
||||
"foreground": "--timeline-clip-border",
|
||||
"background": ["--timeline-row-bg"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/studio.css:203",
|
||||
"packages/studio/src/styles/studio.css:204",
|
||||
"packages/studio/src/player/components/TimelineLanes.tsx:270"
|
||||
],
|
||||
"paintBacking": ["--timeline-row-bg", "--timeline-clip-bg"]
|
||||
},
|
||||
{
|
||||
"id": "active-border-exterior",
|
||||
"foreground": "--timeline-clip-border-active",
|
||||
"background": ["--timeline-row-bg"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/studio.css:203",
|
||||
"packages/studio/src/styles/studio.css:219",
|
||||
"packages/studio/src/player/components/TimelineLanes.tsx:270"
|
||||
],
|
||||
"paintBacking": ["--timeline-row-bg", "--timeline-clip-bg"]
|
||||
},
|
||||
{
|
||||
"id": "selected-outline",
|
||||
"foreground": "--timeline-clip-selection",
|
||||
"background": ["--timeline-row-bg"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/studio.css:251",
|
||||
"packages/studio/src/player/components/TimelineLanes.tsx:270"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "selected-handle",
|
||||
"foreground": "--timeline-handle",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-bg"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:160",
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:161",
|
||||
"packages/studio/src/player/components/timelineTheme.ts:86",
|
||||
"packages/studio/src/styles/studio.css:203"
|
||||
],
|
||||
"opacity": 0.492
|
||||
},
|
||||
{
|
||||
"id": "active-selected-handle",
|
||||
"foreground": "--timeline-handle",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-bg", "--timeline-clip-bg-active"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:160",
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:161",
|
||||
"packages/studio/src/player/components/timelineTheme.ts:86",
|
||||
"packages/studio/src/styles/studio.css:203",
|
||||
"packages/studio/src/styles/studio.css:213",
|
||||
"packages/studio/src/styles/studio.css:223"
|
||||
],
|
||||
"opacity": 0.492
|
||||
},
|
||||
{
|
||||
"id": "hovered-handle",
|
||||
"foreground": "--timeline-handle",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-bg-hover"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:160",
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:161",
|
||||
"packages/studio/src/player/components/timelineTheme.ts:87",
|
||||
"packages/studio/src/styles/studio.css:243"
|
||||
],
|
||||
"opacity": 0.456
|
||||
},
|
||||
{
|
||||
"id": "active-hovered-handle",
|
||||
"foreground": "--timeline-handle",
|
||||
"background": [
|
||||
"--timeline-row-bg",
|
||||
"--timeline-clip-bg-hover",
|
||||
"--timeline-clip-bg-active"
|
||||
],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:160",
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:161",
|
||||
"packages/studio/src/player/components/timelineTheme.ts:87",
|
||||
"packages/studio/src/styles/studio.css:243",
|
||||
"packages/studio/src/styles/studio.css:213",
|
||||
"packages/studio/src/styles/studio.css:223"
|
||||
],
|
||||
"opacity": 0.456
|
||||
},
|
||||
{
|
||||
"id": "dragging-handle",
|
||||
"foreground": "--timeline-handle",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-bg-dragging"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:160",
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:161",
|
||||
"packages/studio/src/player/components/timelineTheme.ts:85",
|
||||
"packages/studio/src/styles/studio.css:261"
|
||||
],
|
||||
"opacity": 0.57
|
||||
},
|
||||
{
|
||||
"id": "active-dragging-handle",
|
||||
"foreground": "--timeline-handle",
|
||||
"background": [
|
||||
"--timeline-row-bg",
|
||||
"--timeline-clip-bg-dragging",
|
||||
"--timeline-clip-bg-active"
|
||||
],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:160",
|
||||
"packages/studio/src/player/components/TimelineClip.tsx:161",
|
||||
"packages/studio/src/player/components/timelineTheme.ts:85",
|
||||
"packages/studio/src/styles/studio.css:261",
|
||||
"packages/studio/src/styles/studio.css:213",
|
||||
"packages/studio/src/styles/studio.css:223"
|
||||
],
|
||||
"opacity": 0.57
|
||||
},
|
||||
{
|
||||
"id": "quiet-waveform",
|
||||
"foreground": "--timeline-waveform-bar-rgb",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-audio-bg"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/studio.css:230",
|
||||
"packages/studio/src/styles/studio.css:213",
|
||||
"packages/studio/src/player/components/AudioWaveform.tsx:139",
|
||||
"packages/studio/src/player/components/AudioWaveform.tsx:145"
|
||||
],
|
||||
"opacity": 0.64,
|
||||
"format": "rgb-channels"
|
||||
},
|
||||
{
|
||||
"id": "active-quiet-waveform",
|
||||
"foreground": "--timeline-waveform-bar-rgb",
|
||||
"background": [
|
||||
"--timeline-row-bg",
|
||||
"--timeline-clip-audio-bg",
|
||||
"--timeline-clip-bg-active"
|
||||
],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/studio.css:230",
|
||||
"packages/studio/src/styles/studio.css:213",
|
||||
"packages/studio/src/player/components/AudioWaveform.tsx:139",
|
||||
"packages/studio/src/player/components/AudioWaveform.tsx:145"
|
||||
],
|
||||
"opacity": 0.64,
|
||||
"format": "rgb-channels"
|
||||
},
|
||||
{
|
||||
"id": "quiet-muted-waveform",
|
||||
"foreground": "--timeline-waveform-muted-rgb",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-audio-muted-bg"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/studio.css:246",
|
||||
"packages/studio/src/player/components/AudioWaveform.tsx:144"
|
||||
],
|
||||
"opacity": 0.64,
|
||||
"format": "rgb-channels"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "paper",
|
||||
"selector": ":root[data-theme=\"paper\"]",
|
||||
"canvas": "--timeline-shell-bg",
|
||||
"pairs": [
|
||||
{
|
||||
"id": "quiet-waveform",
|
||||
"foreground": "--timeline-waveform-bar-rgb",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-audio-bg"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/theme.css:336",
|
||||
"packages/studio/src/player/components/AudioWaveform.tsx:144"
|
||||
],
|
||||
"opacity": 0.64,
|
||||
"format": "rgb-channels"
|
||||
},
|
||||
{
|
||||
"id": "quiet-muted-waveform",
|
||||
"foreground": "--timeline-waveform-muted-rgb",
|
||||
"background": ["--timeline-row-bg", "--timeline-clip-audio-muted-bg"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/theme.css:340",
|
||||
"packages/studio/src/player/components/AudioWaveform.tsx:144"
|
||||
],
|
||||
"opacity": 0.64,
|
||||
"format": "rgb-channels"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "paper",
|
||||
"selector": ":root[data-theme=\"paper\"]",
|
||||
"canvas": "--timeline-row-bg",
|
||||
"pairs": [
|
||||
{
|
||||
"id": "clip-label",
|
||||
"foreground": "--timeline-clip-chip-text",
|
||||
"background": ["--timeline-clip-bg", "--timeline-clip-chip-bg"],
|
||||
"role": "text",
|
||||
"minimum": 4.5,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/theme.css",
|
||||
"packages/studio/src/styles/studio.css"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "selected-outline",
|
||||
"foreground": "--timeline-clip-selection",
|
||||
"background": ["--timeline-row-bg"],
|
||||
"role": "graphic",
|
||||
"minimum": 3,
|
||||
"sources": [
|
||||
"packages/studio/src/styles/theme.css",
|
||||
"packages/studio/src/styles/studio.css"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
type Color = readonly [number, number, number, number];
|
||||
type Role = "text" | "large-text" | "graphic";
|
||||
export interface ContrastPair {
|
||||
id: string;
|
||||
foreground: string;
|
||||
background: string[];
|
||||
paintBacking: string[];
|
||||
opacity: number;
|
||||
format: "color" | "rgb-channels";
|
||||
role: Role;
|
||||
minimum: number;
|
||||
sources: string[];
|
||||
}
|
||||
export interface ContrastTheme {
|
||||
id: string;
|
||||
selector: string;
|
||||
canvas: string;
|
||||
pairs: ContrastPair[];
|
||||
}
|
||||
export interface Measurement {
|
||||
id: string;
|
||||
ratio: number;
|
||||
minimum: number;
|
||||
}
|
||||
export type ContrastBaseline = Record<string, number>;
|
||||
|
||||
function record(value: unknown): Record<string, unknown> {
|
||||
if (typeof value !== "object" || value === null || Array.isArray(value))
|
||||
throw new Error("Expected object");
|
||||
return value as Record<string, unknown>;
|
||||
}
|
||||
function string(value: unknown): string {
|
||||
if (typeof value !== "string" || !value.trim()) throw new Error("Expected nonempty string");
|
||||
return value;
|
||||
}
|
||||
function array(value: unknown): unknown[] {
|
||||
if (!Array.isArray(value)) throw new Error("Expected array");
|
||||
return value;
|
||||
}
|
||||
function number(value: unknown): number {
|
||||
if (typeof value !== "number" || !Number.isFinite(value))
|
||||
throw new Error("Expected finite number");
|
||||
return value;
|
||||
}
|
||||
function opacity(value: unknown): number {
|
||||
const result = number(value);
|
||||
if (result < 0 || result > 1) throw new Error("Opacity outside 0..1");
|
||||
return result;
|
||||
}
|
||||
function role(value: unknown): Role {
|
||||
if (value === "text" || value === "large-text" || value === "graphic") return value;
|
||||
throw new Error("Unknown contrast role");
|
||||
}
|
||||
function roleMinimum(row: Record<string, unknown>) {
|
||||
const kind = role(row.role);
|
||||
const minimum = number(row.minimum);
|
||||
if (minimum !== (kind === "text" ? 4.5 : 3)) throw new Error("Minimum must match WCAG AA role");
|
||||
return { role: kind, minimum };
|
||||
}
|
||||
function format(value: unknown): ContrastPair["format"] {
|
||||
if (value === undefined) return "color";
|
||||
if (value === "color" || value === "rgb-channels") return value;
|
||||
throw new Error("Unknown color format");
|
||||
}
|
||||
function strings(value: unknown): string[] {
|
||||
const entries = array(value).map(string);
|
||||
if (!entries.length) throw new Error("Expected nonempty list");
|
||||
return entries;
|
||||
}
|
||||
function parsePair(input: unknown): ContrastPair {
|
||||
const row = record(input);
|
||||
return {
|
||||
id: string(row.id),
|
||||
foreground: string(row.foreground),
|
||||
background: strings(row.background),
|
||||
paintBacking: strings(row.paintBacking ?? row.background),
|
||||
opacity: opacity(row.opacity ?? 1),
|
||||
format: format(row.format),
|
||||
...roleMinimum(row),
|
||||
sources: strings(row.sources),
|
||||
};
|
||||
}
|
||||
export function parseManifest(text: string): ContrastTheme[] {
|
||||
const themes = array(record(JSON.parse(text)).themes).map((input) => {
|
||||
const theme = record(input);
|
||||
return {
|
||||
id: string(theme.id),
|
||||
selector: string(theme.selector),
|
||||
canvas: string(theme.canvas),
|
||||
pairs: array(theme.pairs).map(parsePair),
|
||||
};
|
||||
});
|
||||
const ids = themes.flatMap((theme) => theme.pairs.map((pair) => `${theme.id}/${pair.id}`));
|
||||
if (!ids.length || new Set(ids).size !== ids.length)
|
||||
throw new Error("Empty or duplicate contrast pairs");
|
||||
return themes;
|
||||
}
|
||||
export function parseBaseline(text: string): ContrastBaseline {
|
||||
return Object.fromEntries(
|
||||
Object.entries(record(JSON.parse(text))).map(([key, value]) => [key, number(value)]),
|
||||
);
|
||||
}
|
||||
|
||||
function hexColor(hex: string): Color {
|
||||
const expanded = hex.length < 5 ? [...hex].map((digit) => digit + digit).join("") : hex;
|
||||
const rgba = expanded.padEnd(8, "f");
|
||||
const part = (at: number) => parseInt(rgba.slice(at, at + 2), 16) / 255;
|
||||
return [part(0), part(2), part(4), part(6)];
|
||||
}
|
||||
function channel(value: string, divisor: number): number {
|
||||
const numeric = value.endsWith("%") ? Number(value.slice(0, -1)) / 100 : Number(value) / divisor;
|
||||
if (![Number.isFinite(numeric), numeric >= 0, numeric <= 1].every(Boolean))
|
||||
throw new Error(`Invalid color channel ${value}`);
|
||||
return numeric;
|
||||
}
|
||||
function rgbColor(value: string): Color {
|
||||
const parts = value.trim().split(/[\s,/]+/);
|
||||
if (![3, 4].includes(parts.length)) throw new Error(`Invalid RGB color: ${value}`);
|
||||
return [
|
||||
channel(parts[0]!, 255),
|
||||
channel(parts[1]!, 255),
|
||||
channel(parts[2]!, 255),
|
||||
channel(parts[3] ?? "1", 1),
|
||||
];
|
||||
}
|
||||
export function parseColor(value: string): Color {
|
||||
const hex = value.match(/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i);
|
||||
if (hex) return hexColor(hex[1]!);
|
||||
const rgb = value.match(/^rgba?\(([^)]+)\)$/);
|
||||
if (!rgb) throw new Error(`Unsupported sRGB color: ${value}`);
|
||||
return rgbColor(rgb[1]!);
|
||||
}
|
||||
export function composite(foreground: Color, background: Color): Color {
|
||||
if (background[3] !== 1) throw new Error("Compositing requires an opaque backing");
|
||||
const mix = (at: 0 | 1 | 2) =>
|
||||
foreground[at] * foreground[3] + background[at] * (1 - foreground[3]);
|
||||
return [mix(0), mix(1), mix(2), 1];
|
||||
}
|
||||
function linear(channel: number): number {
|
||||
return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
||||
}
|
||||
function luminance(color: Color): number {
|
||||
return 0.2126 * linear(color[0]) + 0.7152 * linear(color[1]) + 0.0722 * linear(color[2]);
|
||||
}
|
||||
export function contrast(a: Color, b: Color): number {
|
||||
const x = luminance(a);
|
||||
const y = luminance(b);
|
||||
return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);
|
||||
}
|
||||
function tokensFor(css: string, selector: string): Map<string, string> {
|
||||
const clean = css.replace(/\/\*[\s\S]*?\*\//g, "");
|
||||
const blocks = [...clean.matchAll(/([^{}]+)\{([^{}]*)\}/g)].filter(
|
||||
(match) => match[1]!.trim() === selector,
|
||||
);
|
||||
if (blocks.length !== 1) throw new Error(`Expected exactly one theme block: ${selector}`);
|
||||
const entries = [...blocks[0]![2]!.matchAll(/(--[\w-]+)\s*:\s*([^;]+);/g)].map(
|
||||
(match) => [match[1]!, match[2]!.trim()] as const,
|
||||
);
|
||||
const tokens = new Map(entries);
|
||||
if (tokens.size !== entries.length) throw new Error("Duplicate token declaration");
|
||||
return tokens;
|
||||
}
|
||||
function tokenValue(name: string, tokens: Map<string, string>, seen: string[] = []): string {
|
||||
if (seen.includes(name)) throw new Error(`Token cycle: ${name}`);
|
||||
const value = tokens.get(name);
|
||||
if (value === undefined) throw new Error(`Missing token: ${name}`);
|
||||
const alias = value.match(/^var\((--[\w-]+)\)$/);
|
||||
return alias ? tokenValue(alias[1]!, tokens, [...seen, name]) : value;
|
||||
}
|
||||
function surface(layers: string[], canvas: Color, tokens: Map<string, string>): Color {
|
||||
return layers.reduce(
|
||||
(backing, name) => composite(parseColor(tokenValue(name, tokens)), backing),
|
||||
canvas,
|
||||
);
|
||||
}
|
||||
function measurePair(
|
||||
pair: ContrastPair,
|
||||
theme: ContrastTheme,
|
||||
tokens: Map<string, string>,
|
||||
): Measurement {
|
||||
const canvas = parseColor(tokenValue(theme.canvas, tokens));
|
||||
if (canvas[3] !== 1) throw new Error("Theme canvas must be opaque");
|
||||
const value = tokenValue(pair.foreground, tokens);
|
||||
const fg = pair.format === "rgb-channels" ? rgbColor(value) : parseColor(value);
|
||||
const paint: Color = [fg[0], fg[1], fg[2], fg[3] * pair.opacity];
|
||||
const backing = surface(pair.paintBacking, canvas, tokens);
|
||||
const background = surface(pair.background, canvas, tokens);
|
||||
return {
|
||||
id: `${theme.id}/${pair.id}`,
|
||||
minimum: pair.minimum,
|
||||
ratio: contrast(composite(paint, backing), background),
|
||||
};
|
||||
}
|
||||
export function measure(css: string, themes: ContrastTheme[]): Measurement[] {
|
||||
return themes.flatMap((theme) => {
|
||||
const tokens = tokensFor(css, theme.selector);
|
||||
return theme.pairs.map((pair) => measurePair(pair, theme, tokens));
|
||||
});
|
||||
}
|
||||
function newDebt(row: Measurement): string[] {
|
||||
return row.ratio < row.minimum ? [`${row.id}: new contrast debt ${row.ratio}`] : [];
|
||||
}
|
||||
function debtIssue(row: Measurement, baseline: ContrastBaseline): string[] {
|
||||
const previous = baseline[row.id];
|
||||
if (previous === undefined) return newDebt(row);
|
||||
if (previous === 0) return [`${row.id}: remove zero entry from baseline`];
|
||||
if (row.ratio >= row.minimum) return [`${row.id}: remove passing pair from baseline`];
|
||||
return changedRatioIssue(row, previous);
|
||||
}
|
||||
function changedRatioIssue(row: Measurement, previous: number): string[] {
|
||||
if (Math.abs(row.ratio - previous) > 1e-10)
|
||||
return [
|
||||
`${row.id}: ratio ${row.ratio}, baseline ${previous}; bank improvements, reject regressions`,
|
||||
];
|
||||
return [];
|
||||
}
|
||||
function baselineDirection(id: string, ratio: number, previous: ContrastBaseline): string[] {
|
||||
return ratio < (previous[id] ?? Infinity) ? [`${id}: baseline may only improve`] : [];
|
||||
}
|
||||
export function verdict(
|
||||
rows: Measurement[],
|
||||
baseline: ContrastBaseline,
|
||||
previous = baseline,
|
||||
): string[] {
|
||||
const issues = rows.flatMap((row) => debtIssue(row, baseline));
|
||||
const ids = new Set(rows.map((row) => row.id));
|
||||
for (const [id, ratio] of Object.entries(baseline)) {
|
||||
if (!ids.has(id)) issues.push(`${id}: stale baseline pair`);
|
||||
issues.push(...baselineDirection(id, ratio, previous));
|
||||
}
|
||||
return issues;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
// guards: packages/studio/src/styles/**
|
||||
import { readFileSync } from "node:fs";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
composite,
|
||||
contrast,
|
||||
measure,
|
||||
parseBaseline,
|
||||
parseColor,
|
||||
parseManifest,
|
||||
verdict,
|
||||
} from "./contrast";
|
||||
|
||||
const read = (file: string) => readFileSync(new URL(file, import.meta.url), "utf8");
|
||||
const pair = {
|
||||
id: "label",
|
||||
foreground: "--fg",
|
||||
background: ["--bg"],
|
||||
role: "text",
|
||||
minimum: 4.5,
|
||||
sources: ["fixture.css:1"],
|
||||
};
|
||||
const themes = (pairs: unknown[] = [pair]) =>
|
||||
parseManifest(
|
||||
JSON.stringify({ themes: [{ id: "dark", selector: ":root", canvas: "--bg", pairs }] }),
|
||||
);
|
||||
const css = (fg: string) => `:root { --fg: ${fg}; --bg: #000; }`;
|
||||
|
||||
function previousBaseline(fallback: ReturnType<typeof parseBaseline>, base = "origin/main") {
|
||||
const path = "scripts/contrast-baseline.json";
|
||||
const files = execFileSync("git", ["ls-tree", "--full-tree", "--name-only", base, "--", path], {
|
||||
encoding: "utf8",
|
||||
});
|
||||
if (!files.trim()) return fallback;
|
||||
return parseBaseline(execFileSync("git", ["show", `${base}:${path}`], { encoding: "utf8" }));
|
||||
}
|
||||
|
||||
describe("WCAG contrast calculation", () => {
|
||||
it("matches the independent black/white reference ratio of 21", () => {
|
||||
expect(contrast(parseColor("#fff"), parseColor("#000"))).toBe(21);
|
||||
expect(contrast(parseColor("#000"), parseColor("#000"))).toBe(1);
|
||||
});
|
||||
it("normalizes short hex, alpha hex and percentage RGB without rounding", () => {
|
||||
expect(parseColor("#fff3")).toEqual([1, 1, 1, 0.2]);
|
||||
expect(parseColor("rgb(100% 0% 0% / 20%)")).toEqual([1, 0, 0, 0.2]);
|
||||
expect(parseColor("rgba(255, 0, 0, 0.101)")[3]).toBe(0.101);
|
||||
});
|
||||
it("parses channel tokens directly and rejects incomplete triplets", () => {
|
||||
const config = themes([{ ...pair, format: "rgb-channels" }]);
|
||||
expect(measure(css("255, 255, 255"), config)[0]!.ratio).toBe(21);
|
||||
expect(() => measure(css("255, 255"), config)).toThrow("Invalid RGB");
|
||||
});
|
||||
it("composites a translucent foreground after all backdrop layers", () => {
|
||||
expect(composite(parseColor("rgba(255,255,255,0.5)"), parseColor("#000"))).toEqual([
|
||||
0.5, 0.5, 0.5, 1,
|
||||
]);
|
||||
const config = themes([{ ...pair, background: ["--layer"], opacity: 0.5 }]);
|
||||
const source = ":root { --bg: #000; --layer: rgba(255,255,255,0.5); --fg: #fff; }";
|
||||
const expected = contrast([0.75, 0.75, 0.75, 1], [0.5, 0.5, 0.5, 1]);
|
||||
expect(measure(source, config)[0]!.ratio).toBe(expected);
|
||||
});
|
||||
it("compares border paint on clip fill against the adjacent exterior", () => {
|
||||
const config = themes([{ ...pair, paintBacking: ["--fill"] }]);
|
||||
const source = ":root { --bg: #000; --fill: #fff; --fg: rgba(0,0,0,0.5); }";
|
||||
expect(measure(source, config)[0]!.ratio).toBeCloseTo(5.2808228096, 9);
|
||||
});
|
||||
it("resolves aliases and rejects missing or cyclic tokens", () => {
|
||||
expect(measure(":root {--fg:var(--white);--white:#fff;--bg:#000;}", themes())[0]!.ratio).toBe(
|
||||
21,
|
||||
);
|
||||
expect(() => measure(":root {--bg:#000;}", themes())).toThrow("Missing token");
|
||||
expect(() => measure(":root {--fg:var(--fg);--bg:#000;}", themes())).toThrow("cycle");
|
||||
});
|
||||
it("rejects unsupported colors and invalid channels instead of guessing", () => {
|
||||
expect(() => parseColor("currentColor")).toThrow("Unsupported");
|
||||
expect(() => parseColor("rgb(300,0,0)")).toThrow("Invalid");
|
||||
expect(() => measure(":root {--bg:rgba(0,0,0,.5);--fg:#fff;}", themes())).toThrow("opaque");
|
||||
});
|
||||
it("keeps themes isolated in one manifest", () => {
|
||||
const config = parseManifest(
|
||||
JSON.stringify({
|
||||
themes: [
|
||||
{ id: "dark", selector: ":root", canvas: "--bg", pairs: [pair] },
|
||||
{ id: "light", selector: ".light", canvas: "--bg", pairs: [pair] },
|
||||
],
|
||||
}),
|
||||
);
|
||||
expect(
|
||||
measure(":root{--bg:#000;--fg:#fff;} .light{--bg:#fff;--fg:#000;}", config).map(
|
||||
(row) => row.ratio,
|
||||
),
|
||||
).toEqual([21, 21]);
|
||||
});
|
||||
it("rejects lowered role thresholds and duplicate manifest ids", () => {
|
||||
expect(() => themes([{ ...pair, minimum: 3 }])).toThrow("WCAG");
|
||||
expect(() => themes([pair, pair])).toThrow("duplicate");
|
||||
});
|
||||
});
|
||||
|
||||
describe("contrast ratchet", () => {
|
||||
it("reads a committed baseline using repository paths", () => {
|
||||
expect(previousBaseline({}, "HEAD")).toEqual(parseBaseline(read("contrast-baseline.json")));
|
||||
});
|
||||
|
||||
it("rejects a planted low-contrast value and passes after restoring contrast", () => {
|
||||
expect(verdict(measure(css("#111"), themes()), {}).join("\n")).toContain("new contrast debt");
|
||||
expect(verdict(measure(css("#fff"), themes()), {})).toEqual([]);
|
||||
});
|
||||
it("banks improvements and never lowers a committed ratio", () => {
|
||||
const row = { id: "dark/label", ratio: 2, minimum: 4.5 };
|
||||
expect(verdict([row], { "dark/label": 2 })).toEqual([]);
|
||||
expect(verdict([{ ...row, ratio: 1.5 }], { "dark/label": 2 }).join("\n")).toContain(
|
||||
"reject regressions",
|
||||
);
|
||||
expect(verdict([{ ...row, ratio: 3 }], { "dark/label": 2 }).join("\n")).toContain(
|
||||
"bank improvements",
|
||||
);
|
||||
expect(verdict([{ ...row, ratio: 3 }], { "dark/label": 3 }, { "dark/label": 2 })).toEqual([]);
|
||||
expect(verdict([row], { "dark/label": 2 }, { "dark/label": 3 }).join("\n")).toContain(
|
||||
"only improve",
|
||||
);
|
||||
});
|
||||
it("removes passing and stale baseline entries and forbids fresh debt allowances", () => {
|
||||
const row = { id: "dark/label", ratio: 4.5, minimum: 4.5 };
|
||||
expect(verdict([row], { "dark/label": 2 }).join("\n")).toContain("remove passing");
|
||||
expect(verdict([], { "dark/label": 2 }).join("\n")).toContain("stale");
|
||||
expect(verdict([{ ...row, ratio: 2 }], { "dark/label": 2 }, {}).join("\n")).toContain(
|
||||
"only improve",
|
||||
);
|
||||
});
|
||||
it("requires a zero baseline entry to be removed", () => {
|
||||
const row = { id: "dark/label", ratio: 2, minimum: 4.5 };
|
||||
expect(verdict([row], { "dark/label": 0 })).toEqual([
|
||||
"dark/label: remove zero entry from baseline",
|
||||
]);
|
||||
});
|
||||
it("holds every declared timeline state at its committed contrast", () => {
|
||||
const manifest = parseManifest(read("contrast-pairs.json"));
|
||||
const baseline = parseBaseline(read("contrast-baseline.json"));
|
||||
const rows = measure(read("../packages/studio/src/styles/theme.css"), manifest);
|
||||
expect(verdict(rows, baseline, previousBaseline(baseline))).toEqual([]);
|
||||
console.log(
|
||||
`Contrast ratchet verified: ${rows.length} pairs, ${Object.keys(baseline).length} baseline debts.`,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -96,7 +96,8 @@ test("keyframes states truthful creator capabilities and ownership boundaries",
|
||||
);
|
||||
assert.match(keyframes, /non-timed|non-clip/);
|
||||
assert.match(keyframes, /wrapper inside the clip|inner.*wrapper/i);
|
||||
assert.match(keyframes, /speed ramps?[\s\S]{0,300}(not supported|preprocess)/i);
|
||||
assert.match(keyframes, /speed ramps?[\s\S]{0,80}`rate` lane in `data-automation`/i);
|
||||
assert.match(keyframes, /speed ramps?[\s\S]{0,220}wins over the constant/i);
|
||||
assert.match(keyframes, /arbitrary mid-source freeze[\s\S]{0,300}(not supported|preprocess)/i);
|
||||
assert.doesNotMatch(keyframes, /keyframe(?:d|ing)?\s+(?:the\s+)?data-playback-rate/i);
|
||||
});
|
||||
@@ -132,7 +133,8 @@ test("audio skill owns placed-track fades, automation, ducking, and effects", as
|
||||
files.audio,
|
||||
);
|
||||
assert.match(audio, /constant.*playback rate|data-playback-rate/i);
|
||||
assert.match(audio, /speed ramps?[\s\S]{0,220}(not supported|preprocess)/i);
|
||||
assert.match(audio, /speed ramps?[\s\S]{0,80}`rate` lane in `data-automation`/i);
|
||||
assert.match(audio, /speed ramps?[\s\S]{0,220}wins over the constant/i);
|
||||
});
|
||||
|
||||
test("WebAudio scheduling combines per-element and global transport playback rates", async () => {
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"guards": {
|
||||
"scripts/check-media-use-copy-parity.test.mjs": [
|
||||
"skills/media-use/scripts/lib/**",
|
||||
"packages/cli/src/media-use/lib/**"
|
||||
],
|
||||
"scripts/check-test-reachability.test.mjs": [
|
||||
".github/workflows/ci.yml",
|
||||
"**/package.json",
|
||||
"**/*.test.{mjs,ts,tsx}"
|
||||
],
|
||||
"scripts/creator-editing-capabilities.test.mjs": [
|
||||
"skills/**",
|
||||
"packages/core/**",
|
||||
"packages/engine/**"
|
||||
],
|
||||
"scripts/registry-primitive-payloads.test.ts": ["registry/**"],
|
||||
"scripts/generate-catalog-previews.test.ts": [
|
||||
"registry/**",
|
||||
"scripts/**",
|
||||
"packages/producer/**"
|
||||
],
|
||||
"scripts/generate-catalog-payloads.test.ts": ["registry/**", "scripts/**"]
|
||||
},
|
||||
"runners": [
|
||||
{
|
||||
"cwd": ".",
|
||||
"command": "set -euo pipefail\nmapfile -t SKILLS_TESTS < <(find skills packages/cli/src/media-use -type f -name \"*.test.mjs\" | sort)\nif [ \"${#SKILLS_TESTS[@]}\" -eq 0 ]; then\necho \"::error::No skills/**/*.test.mjs files found. Did the layout change?\"\nexit 1\nfi\nSKILLS_TESTS+=(scripts/check-media-use-copy-parity.test.mjs scripts/creator-editing-capabilities.test.mjs)\nprintf 'Running %d skills test file(s):\\n' \"${#SKILLS_TESTS[@]}\"\nprintf ' * %s\\n' \"${SKILLS_TESTS[@]}\"\nnode --test \"${SKILLS_TESTS[@]}\"",
|
||||
"tests": [
|
||||
"skills/**/*.test.mjs",
|
||||
"packages/cli/src/media-use/**/*.test.mjs",
|
||||
"scripts/check-media-use-copy-parity.test.mjs",
|
||||
"scripts/creator-editing-capabilities.test.mjs"
|
||||
],
|
||||
"sources": {},
|
||||
"reason": "Shell find plus an explicit parity file; exact command match invalidates this mapping on edits."
|
||||
},
|
||||
{
|
||||
"cwd": ".",
|
||||
"command": "bun run producer:test:${{ matrix.lane }}",
|
||||
"tests": [
|
||||
"packages/producer/src/**/*.test.ts",
|
||||
"packages/producer/scripts/test-classification.test.mjs",
|
||||
"packages/producer/tests/**/*.test.ts"
|
||||
],
|
||||
"sources": {
|
||||
"packages/producer/scripts/run-test-lane.mjs": "bff02680f19eebcce0df72cdeedbbc05edfdcede3f3f60658fc0cb18ed8c59f6",
|
||||
"packages/producer/scripts/test-classification.mjs": "f7a1129f49d86fe4a1429dc8b9b75168b25540e1c63242fc79376ae02cf5d0de",
|
||||
".github/workflows/ci.yml#job#producer-source-tests": "3709c6ac6c9f5c7c66f57fc6c1c106aec4ffe906f919eb7cdf2a6ce1d4e0974c",
|
||||
"packages/producer/package.json#script#test:unit": "ae6beda8319d166774be958ea5593cd27dbf7f6c9bce1d787a3fe28dfc3477b1",
|
||||
"packages/producer/package.json#script#test:integration": "008589f37d026877595a13501cbb66abd5cbe50e21fdcac6904f45466c3f475d",
|
||||
"packages/producer/package.json#script#test:classification": "4ad50d88c81de374dd6ef8a53d702a4b1901483837ecd3d833b1cb0c9a29a058",
|
||||
"package.json#script#producer:test:unit": "ded6d4183d455d1f414e41d15794c1aef5323e53b5ea5e2ff349e3bb049c18db",
|
||||
"package.json#script#producer:test:integration": "8bb545947f4f8fef3bd5c6c9b1bcb394c7c942d7a3ab90cf4540c662572a278e"
|
||||
},
|
||||
"reason": "Both unit and integration matrix lanes discover tests under src and tests; workflow and runner sources are pinned to invalidate changed selection."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
# Test reachability manifest
|
||||
|
||||
`test-reachability.json` supplies guards and reviewed runner mappings for
|
||||
`check-test-reachability.mjs`. Only `.github/workflows/ci.yml` is modelled.
|
||||
A test selected only by another workflow is reported as unreachable by this check.
|
||||
For example, `windows-render.yml` selects four tests that are also routed by `ci.yml`.
|
||||
|
||||
`guards` maps test paths to the source paths that must trigger them. Custom runner
|
||||
entries name the exact command, selected tests, and hashes of the source that owns
|
||||
selection. A changed or missing pinned source requires the mapping to be reviewed.
|
||||
Reference in New Issue
Block a user