Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(ci): cover process statics in self-hosted lanes

Steven Enamakelf48788567b42
diff --git a/scripts/__tests__/process-statics.test.mjs b/scripts/__tests__/process-statics.test.mjs
index e190c74eeb..a70a833392 100644
--- a/scripts/__tests__/process-statics.test.mjs
+++ b/scripts/__tests__/process-statics.test.mjs
@@ -109,7 +109,10 @@ test("lifetimes and associated types are not declarations", () => {
});
test("raw and Unicode identifiers cannot bypass ownership review", () => {
const current = scan("static r#type: Alias = x; static 缓存: Alias = x;");
- assert.deepEqual(current.map(({ name }) => name), ["r#type", "缓存"]);
+ assert.deepEqual(
+ current.map(({ name }) => name),
+ ["r#type", "缓存"],
+ );
assert.equal(reviewChanges([], current, []).length, 2);
});
test("const generic equality and function arrows do not terminate a type", () => {
diff --git a/scripts/__tests__/self-hosted-lanes.test.mjs b/scripts/__tests__/self-hosted-lanes.test.mjs
index 7550bdb7d0..3133369a22 100644
--- a/scripts/__tests__/self-hosted-lanes.test.mjs
+++ b/scripts/__tests__/self-hosted-lanes.test.mjs
@@ -164,9 +164,14 @@ test("core doctests remain outside PR coverage; embed doctests and tui tests run
assert.equal(cov.env.OH_COV_TUI, "1");
const runs = allRuns(plan).join("\n");
assert.doesNotMatch(runs, /cargo test -p openhuman --doc/);
- assert.doesNotMatch(runs, /cargo test -p openhuman-(embed|tinyhumans)\b(?! --doc)/);
+ assert.doesNotMatch(
+ runs,
+ /cargo test -p openhuman-(embed|tinyhumans)\b(?! --doc)/,
+ );
assert.match(runs, /cargo test -p openhuman-embed --doc/);
- const doc = plan.lanes.find(l => l.name === "rust-lint").checks.find(c => c.name === "embed-rustdoc");
+ const doc = plan.lanes
+ .find((l) => l.name === "rust-lint")
+ .checks.find((c) => c.name === "embed-rustdoc");
assert.equal(doc.env.RUSTDOCFLAGS, "-D warnings");
assert.match(doc.run, /cargo doc -p openhuman-embed --no-deps/);
assert.match(runs, /node scripts\/run-embed-examples.mjs/);
@@ -231,6 +236,7 @@ test("untouched areas leave only the always-on gates", () => {
"static:orch-ip-gate",
"static:feature-forwarding",
"static:crate-chain",
+ "static:process-statics",
"static:module-pins",
"static:submodule-monotonic",
]);
@@ -267,6 +273,7 @@ test("the storage area arms only the storage-drivers lane, with the sqlite and f
"static:orch-ip-gate",
"static:feature-forwarding",
"static:crate-chain",
+ "static:process-statics",
"static:module-pins",
"static:submodule-monotonic",
],
@@ -660,18 +667,31 @@ test("module boundaries run for Rust and scripts changes in both profiles", () =
areas: { ...NONE, [area]: true },
env: profile === "ex63" ? EX63_ENV : {},
});
- const check = plan.lanes.flatMap(lane => lane.checks).find(check => check.name === "module-boundaries");
+ const check = plan.lanes
+ .flatMap((lane) => lane.checks)
+ .find((check) => check.name === "module-boundaries");
assert.equal(check.when, true, `${profile}:${area}`);
- assert.equal(check.run, "bash scripts/ci-cancel-aware.sh node scripts/ci/check-module-boundaries.mjs");
+ assert.equal(
+ check.run,
+ "bash scripts/ci-cancel-aware.sh node scripts/ci/check-module-boundaries.mjs",
+ );
}
}
});
-
test("module boundary policy and checker changes arm their own scripts lane", () => {
- const filters = fs.readFileSync(path.join(repoRoot, ".github/ci-paths-filter.yml"), "utf8");
+ const filters = fs.readFileSync(
+ path.join(repoRoot, ".github/ci-paths-filter.yml"),
+ "utf8",
+ );
const scripts = filters.split(/^scripts:\s*$/m)[1].split(/^\S[^\n]*:/m)[0];
- for (const file of ["scripts/ci/check-module-boundaries.mjs", "scripts/ci/module-boundaries.json"]) {
- assert.ok(scripts.includes(`'${file}'`), `${file} must arm the scripts area`);
+ for (const file of [
+ "scripts/ci/check-module-boundaries.mjs",
+ "scripts/ci/module-boundaries.json",
+ ]) {
+ assert.ok(
+ scripts.includes(`'${file}'`),
+ `${file} must arm the scripts area`,
+ );
}
});
diff --git a/scripts/ci/check-process-statics.mjs b/scripts/ci/check-process-statics.mjs
index f99a18f703..a2e7a59075 100644
--- a/scripts/ci/check-process-statics.mjs
+++ b/scripts/ci/check-process-statics.mjs
@@ -20,7 +20,7 @@ export function declarations(text, file) {
const code = stripRustComments(text);
const found = [];
const pattern =
- /(?<!')\bstatic\s+(?:(mut|ref)\s+)?([A-Za-z_][A-Za-z_0-9]*)\s*:(?!:)/g;
+ /(?<!')\bstatic\s+(?:(mut|ref)\s+)?((?:r#)?[_\p{ID_Start}][_\p{ID_Continue}]*)\s*:(?!:)/gu;
for (const match of code.matchAll(pattern)) {
let end = match.index + match[0].length;
const start = end;