Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

chore(ci): one local entry for script tests, and trim what they pin (MUL-8995) (#10337)

Jiayuan Zhang3da2cf8a15a8
diff --git a/.github/actions/frontend-quality/action.yml b/.github/actions/frontend-quality/action.yml
index 06c3c00f86..d5f6d4e617 100644
--- a/.github/actions/frontend-quality/action.yml
+++ b/.github/actions/frontend-quality/action.yml
@@ -3,28 +3,23 @@ description: Shared UI checks using the caller's installed dependencies
runs:
using: composite
steps:
+ # Same entry point as local runs, so a new scripts/**/*.test.mjs file is
+ # picked up here without being listed.
+ - name: Test repository scripts
+ shell: bash
+ run: pnpm test:scripts
+
- name: Check packages/ui wildcard exports
shell: bash
- run: |
- bash scripts/check-ui-wildcard-exports.test.sh
- node scripts/check-ui-wildcard-exports.mjs
+ run: node scripts/check-ui-wildcard-exports.mjs
- name: Check UI radius tokens
shell: bash
- run: |
- node --test scripts/check-ui-radius-tokens.test.mjs
- node scripts/check-ui-radius-tokens.mjs
+ run: node scripts/check-ui-radius-tokens.mjs
- name: Check shared dependencies use the pnpm catalog
shell: bash
- run: |
- node --test scripts/check-dependency-catalog.test.mjs
- node scripts/check-dependency-catalog.mjs
-
- - name: Check the theme validator CLI
- shell: bash
- run: |
- node --test scripts/theme-check.test.mjs
+ run: node scripts/check-dependency-catalog.mjs
- name: Check for dead code and phantom dependencies (knip)
shell: bash
diff --git a/.github/ci-paths.json b/.github/ci-paths.json
index eb58d9f213..8540c5e303 100644
--- a/.github/ci-paths.json
+++ b/.github/ci-paths.json
@@ -69,7 +69,9 @@
"knip.jsonc",
"scripts/*.mjs",
"scripts/brand/*.mjs",
- "scripts/check-ui-wildcard-exports.test.sh",
+ "scripts/pr-shots",
+ "server/cmd/multica/cmd_auth.go",
+ "docs/assets/logo-*.svg",
".github/workflows/mobile-verify.yml",
".github/workflows/ci.yml",
".github/ci-paths.json"
@@ -85,8 +87,6 @@
"scripts/dev-env.test.sh",
"scripts/perf-compare.mjs",
"scripts/perf-compare.test.sh",
- "scripts/desktop-window-capture.mjs",
- "scripts/desktop-window-capture.test.mjs",
"scripts/selfhost-wait.sh",
"scripts/install.sh",
"scripts/install.ps1",
@@ -95,7 +95,6 @@
"scripts/dev.sh",
"scripts/local-env.sh",
"scripts/init-worktree-env.sh",
- "scripts/local-env.test.sh",
"scripts/helm-config.test.sh",
"scripts/entrypoint.test.sh",
"scripts/makefile-build.test.sh",
@@ -110,14 +109,6 @@
"packages/views/editor/utils/text-preview-whitelist.generated.ts",
"packages/core/paths/reserved-slugs.ts",
"server/cmd/server/router.go",
- "scripts/brand/**",
- "packages/ui/lib/multica-brand.ts",
- "apps/mobile/components/brand/multica-logo.tsx",
- "server/cmd/multica/cmd_auth.go",
- "apps/web/public/favicon.svg",
- "apps/web/public/icons/icon.svg",
- "apps/docs/app/icon.svg",
- "docs/assets/logo-*.svg",
".github/workflows/ci.yml",
".github/ci-paths.json",
"scripts/ci-scope.mjs",
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ff23f9c1f5..d984a4a654 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -40,8 +40,11 @@ jobs:
with:
node-version: 22
- - name: Test CI selection and repository tooling
- run: node --test scripts/ci-scope.test.mjs scripts/check-image-budget.test.mjs scripts/pr-shots.test.mjs
+ # Path selection must be proven before it skips anything. Every other
+ # scripts/**/*.test.mjs suite runs through `pnpm test:scripts` in the
+ # frontend-quality action.
+ - name: Test CI selection
+ run: node --test scripts/ci-scope.test.mjs
- name: Filter paths
id: filter
@@ -917,9 +920,6 @@ jobs:
- name: Test UI performance comparison runner
run: bash scripts/perf-compare.test.sh
- - name: Test Desktop window capture
- run: node --test scripts/desktop-window-capture.test.mjs
-
- name: Verify reserved-slugs.ts is up to date
# Re-runs the generator and fails on any drift from the
# checked-in TypeScript output. The Go side embeds the JSON
@@ -936,13 +936,6 @@ jobs:
node scripts/generate-attachment-text-preview.mjs
git diff --exit-code -- packages/views/editor/utils/text-preview-whitelist.generated.ts
- - name: Verify brand copies match multica-brand.ts
- # The mobile wordmark, the CLI login page and the logo SVGs are text
- # copies of packages/ui/lib/multica-brand.ts; bitmaps are not rendered here.
- run: |
- node scripts/brand/sync.mjs --check
- node --test scripts/brand/sync.test.mjs
-
- name: Setup Helm
uses: azure/setup-helm@v4
diff --git a/AGENTS.md b/AGENTS.md
index e37fd1a5f5..e21eee2930 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -41,6 +41,7 @@ Run these from the repository root:
| Scope | Checks |
| --- | --- |
| Frontend excluding mobile | `pnpm typecheck`, `pnpm lint`, `pnpm test` |
+| `.github/` or `scripts/` | `pnpm test:scripts` (every `scripts/**/*.test.mjs`, including CI path selection and gates), plus `bash scripts/<name>.test.sh` for a shell script you changed |
| Go backend | `make test` |
| End-to-end | `pnpm exec playwright test` |
| Combined web/backend verification | `make check` |
diff --git a/package.json b/package.json
index d64bb20429..83cb35b714 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,7 @@
"build": "turbo build --filter=!@multica/mobile",
"typecheck": "turbo typecheck --filter=!@multica/mobile",
"test": "turbo test --filter=!@multica/mobile",
+ "test:scripts": "node --test \"scripts/**/*.test.mjs\"",
"lint": "turbo lint --filter=!@multica/mobile",
"knip": "knip",
"check:ui-exports": "node scripts/check-ui-wildcard-exports.mjs",
diff --git a/scripts/check-ui-wildcard-exports.test.mjs b/scripts/check-ui-wildcard-exports.test.mjs
new file mode 100644
index 0000000000..d46d134763
--- /dev/null
+++ b/scripts/check-ui-wildcard-exports.test.mjs
@@ -0,0 +1,116 @@
+// The check guards a blind spot that is invisible by construction: a component
+// under a wildcard export registers as a knip entry point, so knip reports it
+// as used no matter what. A guard for an invisible failure is worth exactly as
+// much as its proof that it still fires.
+import assert from "node:assert/strict";
+import { spawnSync } from "node:child_process";
+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join, resolve } from "node:path";
+import test from "node:test";
+
+const script = resolve(import.meta.dirname, "check-ui-wildcard-exports.mjs");
+
+// Keep fixture imports and wildcard exports shaped like the real workspaces.
+function fixture(t) {
+ const root = mkdtempSync(join(tmpdir(), "ui-exports-"));
+ t.after(() => rmSync(root, { recursive: true, force: true }));
+ const write = (rel, text) => {
+ mkdirSync(dirname(join(root, rel)), { recursive: true });
+ writeFileSync(join(root, rel), text);
+ };
+ const remove = (rel) => rmSync(join(root, rel));
+ write("packages/ui/package.json", JSON.stringify({
+ name: "@multica/ui",
+ exports: {
+ "./components/ui/*": "./components/ui/*.tsx",
+ "./components/common/*": "./components/common/*.tsx",
+ "./markdown/*": "./markdown/*.tsx",
+ "./hooks/*": "./hooks/*.ts",
+ },
+ }));
+ mkdirSync(join(root, "packages/views"), { recursive: true });
+ const check = () => {
+ const result = spawnSync(process.execPath, [script, root], { encoding: "utf8" });
+ return { status: result.status, output: result.stdout + result.stderr };
+ };
+ const passes = (message) => {
+ const { status, output } = check();
+ assert.equal(status, 0, `${message}\n${output}`);
+ };
+ const failsNaming = (names, message) => {
+ const { status, output } = check();
+ assert.equal(status, 1, `${message}\n${output}`);
+ for (const name of names) assert.ok(output.includes(name), `should name ${name}\n${output}`);
+ };
+ return { write, remove, passes, failsNaming };
+}
+
+const importer = "packages/views/zz-probe-importer.tsx";
+
+test("an unimported component fails and is named until a consumer imports it", (t) => {
+ const { write, passes, failsNaming } = fixture(t);
+ passes("a clean tree should pass");
+ write("packages/ui/components/ui/zz-unused-export-probe.tsx", "export function UnusedExportProbe() { return null; }\n");
+ failsNaming(["zz-unused-export-probe.tsx"], "a zero-reference component should fail");
+ write(importer, 'export { UnusedExportProbe } from "@multica/ui/components/ui/zz-unused-export-probe";\n');
+ passes("a real consumer should make the component live");
+});
+
+test("a relative import of a same-named file outside UI cannot vouch for it", (t) => {
+ const { write, failsNaming } = fixture(t);
+ write("packages/views/onboarding/components/option-card.tsx", "export function OptionCard() { return null; }\n");
+ write("packages/views/onboarding/steps/welcome.tsx", 'export { OptionCard } from "../components/option-card";\n');
+ write("packages/ui/components/ui/option-card.tsx", "export function OptionCard() { return null; }\n");
+ failsNaming(["components/ui/option-card.tsx"], "basename matching must not mark a dead component as used");
+});
+
+// Liveness is reachability from outside the guarded directories, not a
+// reference count.
+test("an unreachable import chain or cycle stays dead until something outside reaches it", (t) => {
+ const { write, passes, failsNaming } = fixture(t);
+ write("packages/ui/components/ui/zz-cycle-a.tsx", 'import { CycleB } from "./zz-cycle-b";\nexport const CycleA = () => CycleB();\n');
+ write("packages/ui/components/ui/zz-cycle-b.tsx", "export const CycleB = () => null;\n");
+ failsNaming(["zz-cycle-a.tsx", "zz-cycle-b.tsx"], "an A -> B chain must not vouch for itself");
+ write("packages/ui/components/ui/zz-cycle-b.tsx", 'import { CycleA } from "./zz-cycle-a";\nexport const CycleB = () => CycleA;\n');
+ failsNaming(["zz-cycle-a.tsx", "zz-cycle-b.tsx"], "an A <-> B cycle must not vouch for itself");
+ write(importer, 'export { CycleA } from "@multica/ui/components/ui/zz-cycle-a";\n');
+ passes("an external consumer should make both halves live");
+});
+
+// A component passes through this state the moment its last real importer is
+// deleted, so a text scan would keep vouching for it exactly when it stops
+// being used.
+test("commented-out, stringified and mock-only mentions are not imports", (t) => {
+ const { write, remove, failsNaming } = fixture(t);
+ write("packages/ui/components/ui/zz-comment-probe.tsx", "export function CommentProbe() { return null; }\n");
+ write(importer, [
+ '// import { CommentProbe } from "@multica/ui/components/ui/zz-comment-probe";',
+ 'export const note = \'import { CommentProbe } from "@multica/ui/components/ui/zz-comment-probe"\';',
+ ].join("\n"));
+ failsNaming(["zz-comment-probe.tsx"], "a comment or string must not count as an edge");
+ remove("packages/ui/components/ui/zz-comment-probe.tsx");
+ write("packages/ui/components/ui/zz-mock-only.tsx", "export function MockOnly() { return null; }\n");
+ write(importer, 'import { vi } from "vitest"; vi.mock("@multica/ui/components/ui/zz-mock-only");\n');
+ failsNaming(["zz-mock-only.tsx"], "a mock-only mention must not vouch for a product");
+});
+
+// Vitest discovers *.test.{ts,tsx} without product imports. Such files in
+// wildcard directories are exempt from reporting, but cannot vouch for unused
+// production files. Non-contract *.spec files remain guarded.
+for (const [dir, ext] of [["components/ui", "tsx"], ["components/common", "tsx"], ["markdown", "tsx"], ["hooks", "ts"]]) {
+ test(`colocated tests in ${dir} are exempt but cannot vouch for a product`, (t) => {
+ const { write, remove, passes, failsNaming } = fixture(t);
+ const testFile = `packages/ui/${dir}/zz-unused-runtime.test.${ext}`;
+ write(testFile, 'import { it } from "vitest";\nit("discovered", () => {});\n');
+ passes(`a Vitest-discovered test in ${dir} should not need a product import`);
+ write(`packages/ui/${dir}/zz-unused-runtime.${ext}`, "export function RuntimeProbe() { return null; }\n");
+ write(testFile, 'import { RuntimeProbe } from "./zz-unused-runtime";\nimport { it } from "vitest";\nit("probe", () => RuntimeProbe());\n');
+ failsNaming([`${dir}/zz-unused-runtime.${ext}`], `a colocated test in ${dir} must not vouch for an unused product`);
+ write(importer, `export { RuntimeProbe } from "@multica/ui/${dir}/zz-unused-runtime";\n`);
+ passes(`a real consumer should make the product in ${dir} live`);
+ for (const rel of [importer, testFile, `packages/ui/${dir}/zz-unused-runtime.${ext}`]) remove(rel);
+ write(`packages/ui/${dir}/zz-not-discovered.spec.${ext}`, "export function StillGuarded() { return null; }\n");
+ failsNaming([`${dir}/zz-not-discovered.spec.${ext}`], `a spec file in ${dir} must remain guarded`);
+ });
+}
diff --git a/scripts/check-ui-wildcard-exports.test.sh b/scripts/check-ui-wildcard-exports.test.sh
deleted file mode 100755
index 6ac1151dc5..0000000000
--- a/scripts/check-ui-wildcard-exports.test.sh
+++ /dev/null
@@ -1,205 +0,0 @@
-#!/usr/bin/env bash
-# Proves check-ui-wildcard-exports.mjs actually fails on the cases it exists for.
-#
-# The check guards a blind spot that is invisible by construction: a component
-# under a wildcard export registers as a knip entry point, so knip reports it
-# as used no matter what. A guard for an invisible failure is worth exactly as
-# much as its proof that it still fires, hence this test.
-set -euo pipefail
-
-source_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
-check="$source_root/scripts/check-ui-wildcard-exports.mjs"
-mkdir -p "$source_root/.turbo"
-root_dir="$(mktemp -d "$source_root/.turbo/ui-exports.XXXXXX")"
-ui_dir="$root_dir/packages/ui/components/ui"
-out="$root_dir/output.log"
-
-cleanup() {
- rm -rf "$root_dir"
-}
-trap cleanup EXIT
-
-# Keep fixture imports and wildcard exports shaped like the real workspaces.
-# The composite action checks the real repository once after these cases.
-mkdir -p "$ui_dir" "$root_dir/packages/views" \
- "$root_dir/packages/ui/components/common" \
- "$root_dir/packages/ui/markdown" "$root_dir/packages/ui/hooks"
-cat >"$root_dir/packages/ui/package.json" <<'EOF'
-{
- "name": "@multica/ui",
- "exports": {
- "./components/ui/*": "./components/ui/*.tsx",
- "./components/common/*": "./components/common/*.tsx",
- "./markdown/*": "./markdown/*.tsx",
- "./hooks/*": "./hooks/*.ts"
- }
-}
-EOF
-
-fail() {
- echo "FAIL: $*" >&2
- echo "Observed:" >&2
- cat "$out" >&2
- exit 1
-}
-
-expect_pass() {
- if ! node "$check" "$root_dir" >"$out" 2>&1; then fail "$1"; fi
-}
-
-expect_fail_naming() {
- if node "$check" "$root_dir" >"$out" 2>&1; then fail "$2"; fi
- if ! grep -Fq "$1" "$out"; then fail "check failed but did not name $1"; fi
-}
-
-# 1. The empty fixture passes before adding unused guarded files.
-expect_pass "check should pass on a clean tree"
-
-# 2. A component nothing imports fails the check and is named.
-probe="$ui_dir/zz-unused-export-probe.tsx"
-cat >"$probe" <<'EOF'
-export function UnusedExportProbe() {
- return null
-}
-EOF
-expect_fail_naming "zz-unused-export-probe.tsx" \
- "check should fail when packages/ui gains a zero-reference component"
-
-# 3. Importing it from a consumer clears the check — the guard tracks real
-# usage rather than just counting files.
-importer="$root_dir/packages/views/zz-probe-importer.tsx"
-cat >"$importer" <<'EOF'
-export { UnusedExportProbe } from "@multica/ui/components/ui/zz-unused-export-probe";
-EOF
-expect_pass "check should pass once a consumer imports the component"
-rm -f "$importer" "$probe"
-
-# 4. A relative import of a same-named file outside UI cannot vouch for it.
-mkdir -p "$root_dir/packages/views/onboarding/components" \
- "$root_dir/packages/views/onboarding/steps"
-cat >"$root_dir/packages/views/onboarding/components/option-card.tsx" <<'EOF'
-export function OptionCard() { return null; }
-EOF
-cat >"$root_dir/packages/views/onboarding/steps/welcome.tsx" <<'EOF'
-export { OptionCard } from "../components/option-card";
-EOF
-collide="$ui_dir/option-card.tsx"
-cat >"$collide" <<'EOF'
-export function OptionCard() {
- return null
-}
-EOF
-expect_fail_naming "components/ui/option-card.tsx" \
- "a same-named file elsewhere must not mark a dead ui component as used"
-rm -f "$collide"
-
-# 5. An unreachable A -> B chain is still dead. Liveness is reachability
-# from outside the guarded directories, not a reference count.
-pair_a="$ui_dir/zz-cycle-a.tsx"
-pair_b="$ui_dir/zz-cycle-b.tsx"
-cat >"$pair_a" <<'EOF'
-import { CycleB } from "./zz-cycle-b";
-export function CycleA() {
- return CycleB();
-}
-EOF
-cat >"$pair_b" <<'EOF'
-export function CycleB() {
- return null;
-}
-EOF
-expect_fail_naming "zz-cycle-a.tsx" "an unreachable import chain must not vouch for itself"
-if ! grep -Fq "zz-cycle-b.tsx" "$out"; then
- fail "both files in an unreachable import chain should be reported"
-fi
-rm -f "$pair_a" "$pair_b"
-
-# 6. A commented-out import is not an edge. This is the state a component
-# passes through the moment its last real importer is deleted, so a text
-# scan would keep vouching for it exactly when it stops being used.
-comment_probe="$ui_dir/zz-comment-probe.tsx"
-mention="$root_dir/packages/views/zz-probe-mention.ts"
-cat >"$comment_probe" <<'EOF'
-export function CommentProbe() {
- return null
-}
-EOF
-cat >"$mention" <<'EOF'
-// import { CommentProbe } from "@multica/ui/components/ui/zz-comment-probe";
-const note = 'import { CommentProbe } from "@multica/ui/components/ui/zz-comment-probe"';
-export const probeNote = note;
-EOF
-expect_fail_naming "zz-comment-probe.tsx" \
- "a commented-out or stringified import must not count as a real edge"
-rm -f "$comment_probe" "$mention"
-
-expect_pass "check should pass again once every probe is removed"
-
-# 7. Vitest discovers *.test.{ts,tsx} without product imports. Such files in
-# wildcard directories are exempt from reporting, but cannot vouch for
-# unused production files. Non-contract *.spec files remain guarded.
-for entry in components/ui:tsx components/common:tsx markdown:tsx hooks:ts; do
- dir="${entry%:*}"
- ext="${entry#*:}"
- test_file="$root_dir/packages/ui/$dir/zz-unused-runtime.test.$ext"
- product="$root_dir/packages/ui/$dir/zz-unused-runtime.$ext"
- spec="$root_dir/packages/ui/$dir/zz-not-discovered.spec.$ext"
- cat >"$test_file" <<'EOF'
-import { it, expect } from "vitest";
-it("discovered", () => { expect(true).toBe(true); });
-EOF
- expect_pass "Vitest-discovered tests in $dir should not require product imports"
- cat >"$product" <<'EOF'
-export function RuntimeProbe() { return null; }
-EOF
- cat >"$test_file" <<'EOF'
-import { RuntimeProbe } from "./zz-unused-runtime";
-import { it, expect } from "vitest";
-it("probe", () => { expect(RuntimeProbe()).toBe(null); });
-EOF
- expect_fail_naming "$dir/zz-unused-runtime.$ext" \
- "a colocated test in $dir must not vouch for an unused product"
- cat >"$importer" <<EOF
-export { RuntimeProbe } from "@multica/ui/$dir/zz-unused-runtime";
-EOF
- expect_pass "a real external consumer should make the product in $dir live"
- rm -f "$importer" "$test_file" "$product"
- cat >"$spec" <<'EOF'
-export function StillGuarded() { return null; }
-EOF
- expect_fail_naming "$dir/zz-not-discovered.spec.$ext" \
- "non-contract spec files in $dir must remain guarded"
- rm -f "$spec"
-done
-
-# 8. A true A <-> B cycle stays dead until an external consumer reaches it.
-cat >"$pair_a" <<'EOF'
-import { B } from "./zz-cycle-b"; export const A = () => B;
-EOF
-cat >"$pair_b" <<'EOF'
-import { A } from "./zz-cycle-a"; export const B = () => A;
-EOF
-expect_fail_naming "zz-cycle-a.tsx" "a true dead cycle must not vouch for itself"
-if ! grep -Fq "zz-cycle-b.tsx" "$out"; then
- fail "both halves of a true dead cycle should be reported"
-fi
-cat >"$importer" <<'EOF'
-export { A } from "@multica/ui/components/ui/zz-cycle-a";
-EOF
-expect_pass "an external consumer should make both halves of a cycle live"
-rm -f "$pair_a" "$pair_b" "$importer"
-
-# 9. Mock-only mentions do not import a product module.
-mock_probe="$ui_dir/zz-mock-only.tsx"
-cat >"$mock_probe" <<'EOF'
-export function MockOnly() { return null; }
-EOF
-cat >"$importer" <<'EOF'
-import { vi } from "vitest"; vi.mock("@multica/ui/components/ui/zz-mock-only");
-EOF
-expect_fail_naming "zz-mock-only.tsx" "a mock-only mention must not vouch for a product"
-rm -f "$mock_probe" "$importer"
-
-expect_pass "check should pass again once every additional probe is removed"
-
-echo "PASS: check-ui-wildcard-exports preserves product reachability and Vitest test discovery boundaries"
diff --git a/scripts/ci-scope.test.mjs b/scripts/ci-scope.test.mjs
index 623a8c1523..c54f3e330a 100644
--- a/scripts/ci-scope.test.mjs
+++ b/scripts/ci-scope.test.mjs
@@ -38,11 +38,12 @@ for (const [name, files, selected] of [
["reserved slug source", ["server/internal/handler/reserved_slugs.json"], ["backend", "runtime", "scripts"]],
["reserved slug output", ["packages/core/paths/reserved-slugs.ts"], ["frontend", "quality", "scripts"]],
["integration key gates", ["server/cmd/server/router.go"], ["backend", "runtime", "scripts"]],
- ["brand source", ["packages/ui/lib/multica-brand.ts"], ["frontend", "quality", "scripts"]],
- ["CLI brand copy", ["server/cmd/multica/cmd_auth.go"], ["backend", "runtime", "scripts"]],
- ["mobile brand copy", ["apps/mobile/components/brand/multica-logo.tsx"], ["quality", "scripts"]],
- ["README logo", ["docs/assets/logo-dark.svg"], ["scripts"]],
- ["brand generator", ["scripts/brand/sync.mjs"], ["quality", "scripts"]],
+ ["brand source", ["packages/ui/lib/multica-brand.ts"], ["frontend", "quality"]],
+ ["CLI brand copy", ["server/cmd/multica/cmd_auth.go"], ["backend", "runtime", "quality"]],
+ ["mobile brand copy", ["apps/mobile/components/brand/multica-logo.tsx"], ["quality"]],
+ ["README logo", ["docs/assets/logo-dark.svg"], ["quality"]],
+ ["brand generator", ["scripts/brand/sync.mjs"], ["quality"]],
+ ["PR evidence uploader", ["scripts/pr-shots"], ["quality"]],
["cross-module runtime contract", ["packages/core/runtimes/cli-version.ts"], ["frontend", "backend", "runtime", "quality"]],
["shared quick action body contract", ["server/internal/handler/testdata/quick_action_bodies.json"], ["frontend", "backend", "runtime"]],
["lockfile", ["pnpm-lock.yaml"], ["frontend", "quality"]],
@@ -172,18 +173,19 @@ for (const gate of ["frontend", "backend"]) {
});
}
-test("the backend gate owns the three-platform installer matrix", () => {
- assert.equal(productionMapping("backend").installer, "installer");
- assert.match(jobs.installer, /^ os: \[ubuntu-latest, macos-latest, windows-latest\]$/m);
- assert.doesNotMatch(jobs.installer, /continue-on-error:/);
+// The gates trust job results, and continue-on-error reports a failed step as
+// a success, so a gate cannot see a failure behind it.
+test("no gated job or shared quality step continues past a failure", () => {
+ const action = readFileSync(new URL("../.github/actions/frontend-quality/action.yml", import.meta.url), "utf8");
+ assert.doesNotMatch(workflow, /continue-on-error:/);
+ assert.doesNotMatch(action, /continue-on-error:/);
});
-test("quality checks have exactly one runner and reuse the product build install", () => {
+test("quality checks have exactly one runner", () => {
const invocation = "uses: ./.github/actions/frontend-quality";
const owners = Object.entries(jobs).filter(([, source]) => source.includes(invocation)).map(([job]) => job);
assert.deepEqual(owners.sort(), ["frontend-build", "frontend-quality"]);
assert.equal(productionMapping("frontend")["frontend-quality"], "quality_only");
- assert.match(jobs["frontend-build"], / - name: Check frontend quality\n uses: \.\/\.github\/actions\/frontend-quality\n/);
for (const frontend of ["true", "false"]) {
for (const quality of ["true", "false"]) {
const outputs = decideScopes("pull_request", { ...filterFiles([]), frontend, quality });
@@ -192,10 +194,6 @@ test("quality checks have exactly one runner and reuse the product build install
assert.equal(runners.length, frontend === "true" || quality === "true" ? 1 : 0);
}
}
- const action = readFileSync(new URL("../.github/actions/frontend-quality/action.yml", import.meta.url), "utf8");
- assert.match(action, /run: pnpm knip/);
- assert.doesNotMatch(action, /continue-on-error:/);
- assert.doesNotMatch(action, /pnpm install/);
});
test("the CLI writes real Actions outputs and exits nonzero on a failed gate", (t) => {