The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(ci): handle removed declarations in process-statics review
Steven Enamakel44acdefa708f
diff --git a/scripts/__tests__/process-statics.test.mjs b/scripts/__tests__/process-statics.test.mjsindex ab66738f3a..72e3044aca 100644--- a/scripts/__tests__/process-statics.test.mjs+++ b/scripts/__tests__/process-statics.test.mjs@@ -25,16 +25,35 @@ const scan = (text) => declarations(text, file);function withRepository(initialSource, approvals, callback) {const root = mkdtempSync(join(tmpdir(), "process-statics-review-"));- const git = (...args) => execFileSync("git", args, { cwd: root, stdio: "pipe" }).toString().trim();+ const git = (...args) =>+ execFileSync("git", args, { cwd: root, stdio: "pipe" }).toString().trim();try {- mkdirSync(join(root, "crates/openhuman-core/src/example"), { recursive: true });+ mkdirSync(join(root, "crates/openhuman-core/src/example"), {+ recursive: true,+ });mkdirSync(join(root, "scripts/ci"), { recursive: true });writeFileSync(join(root, file), initialSource);- writeFileSync(join(root, "scripts/ci/process-statics.json"), JSON.stringify(approvals));- git("init"); git("add", ".");- git("-c", "user.name=Test", "-c", "[email protected]", "-c", "core.hooksPath=/dev/null", "commit", "-m", "base");+ writeFileSync(+ join(root, "scripts/ci/process-statics.json"),+ JSON.stringify(approvals),+ );+ git("init");+ git("add", ".");+ git(+ "-c",+ "user.name=Test",+ "-c",+ "[email protected]",+ "-c",+ "core.hooksPath=/dev/null",+ "commit",+ "-m",+ "base",+ );return callback(root, git, git("rev-parse", "HEAD"));- } finally { rmSync(root, { recursive: true, force: true }); }+ } finally {+ rmSync(root, { recursive: true, force: true });+ }}test("previous ownership records cannot be removed while the declaration survives", () => {@@ -52,6 +71,29 @@ test("non-ASCII and newline filenames cannot bypass the tracked source scan", ()git("add", path);}assert.equal(checkRepository(root, base).errors.length, 2);+ git(+ "-c",+ "user.name=Test",+ "-c",+ "[email protected]",+ "-c",+ "core.hooksPath=/dev/null",+ "commit",+ "-m",+ "legacy paths",+ );+ assert.deepEqual(+ checkRepository(root, git("rev-parse", "HEAD")).errors,+ [],+ );+ });+});++test("prior ownership records can be removed when their declaration disappears", () => {+ withRepository(source, [entry], (root, _git, base) => {+ writeFileSync(join(root, file), "pub fn example() {}");+ writeFileSync(join(root, "scripts/ci/process-statics.json"), "[]");+ assert.deepEqual(checkRepository(root, base).errors, []);});});diff --git a/scripts/__tests__/self-hosted-lanes.test.mjs b/scripts/__tests__/self-hosted-lanes.test.mjsindex 96b9cad3aa..2871218758 100644--- a/scripts/__tests__/self-hosted-lanes.test.mjs+++ b/scripts/__tests__/self-hosted-lanes.test.mjs@@ -715,8 +715,17 @@ test("process-static policy and checker changes arm their own scripts lane", ()test("process-static scan uses cancellation supervision in both profiles", () => {for (const profile of ["hosted", "ex63"]) {- const plan = buildPlan({ profile, areas: NONE, env: profile === "ex63" ? EX63_ENV : {} });- const check = plan.lanes.flatMap(lane => lane.checks).find(check => check.name === "process-statics");- assert.equal(check.run, "bash scripts/ci-cancel-aware.sh node scripts/ci/check-process-statics.mjs");+ const plan = buildPlan({+ profile,+ areas: NONE,+ env: profile === "ex63" ? EX63_ENV : {},+ });+ const check = plan.lanes+ .flatMap((lane) => lane.checks)+ .find((check) => check.name === "process-statics");+ assert.equal(+ check.run,+ "bash scripts/ci-cancel-aware.sh node scripts/ci/check-process-statics.mjs",+ );}});diff --git a/scripts/ci/check-process-statics.mjs b/scripts/ci/check-process-statics.mjsindex 528d93271f..e268247089 100644--- a/scripts/ci/check-process-statics.mjs+++ b/scripts/ci/check-process-statics.mjs@@ -72,7 +72,12 @@ function counts(entries) {}/** Require exact, non-stale ownership records for added or changed declaration types. */-export function reviewChanges(before, after, approvals, previousApprovals = []) {+export function reviewChanges(+ before,+ after,+ approvals,+ previousApprovals = [],+) {if (!Array.isArray(approvals))throw new Error("process-statics.json must contain an array");const oldCounts = counts(before);@@ -118,7 +123,9 @@ export function reviewChanges(before, after, approvals, previousApprovals = [])for (const entry of previousApprovals) {const key = signature(entry);if (newCounts.has(key) && !reviewed.has(key)) {- errors.push(`Prior ownership record must remain while its declaration survives: ${key}`);+ errors.push(+ `Prior ownership record must remain while its declaration survives: ${key}`,+ );}}return errors;@@ -152,7 +159,15 @@ export function checkRepository(root, baseRef) {`Cannot resolve merge base ${baseRef}; fetch the base with full history before running this gate.`,);}- const previousFiles = git(["ls-tree", "-r", "--name-only", base, "--", CORE])+ const previousFiles = git([+ "ls-tree",+ "-r",+ "-z",+ "--name-only",+ base,+ "--",+ CORE,+ ]).split("\0").filter(production);const currentFiles = git(["ls-files", "-z", "--", CORE])@@ -169,9 +184,18 @@ export function checkRepository(root, baseRef) {declarations(readFileSync(resolve(root, file), "utf8"), file),);const approvals = JSON.parse(readFileSync(resolve(root, MANIFEST), "utf8"));- const hasPreviousManifest = git(["ls-tree", "--name-only", base, "--", MANIFEST]);- const previousApprovals = hasPreviousManifest ? JSON.parse(git(["show", `${base}:${MANIFEST}`])) : [];- if (!Array.isArray(previousApprovals)) throw new Error("Base ownership manifest must contain an array");+ const hasPreviousManifest = git([+ "ls-tree",+ "--name-only",+ base,+ "--",+ MANIFEST,+ ]);+ const previousApprovals = hasPreviousManifest+ ? JSON.parse(git(["show", `${base}:${MANIFEST}`]))+ : [];+ if (!Array.isArray(previousApprovals))+ throw new Error("Base ownership manifest must contain an array");return {base,files: currentFiles.length,