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): preserve literals in static type signatures and keep prior ownership records
Steven Enamakelfa10031c67dd
diff --git a/scripts/ci/check-crate-chain.mjs b/scripts/ci/check-crate-chain.mjsindex b4125794ca..1a2d21e701 100644--- a/scripts/ci/check-crate-chain.mjs+++ b/scripts/ci/check-crate-chain.mjs@@ -127,8 +127,9 @@ export const HOST_RPC_INTERNAL_PATTERNS = [* Blank out Rust comments and string literals (contents only), keeping line* structure, so a banned path quoted in a doc, log message or fixture is not* mistaken for code. Handles nested block comments, escapes and raw strings.+ * Optional literal preservation supports type signatures; default masking is unchanged.*/-export function stripRustComments(text) {+export function stripRustComments(text, { preserveLiterals = false } = {}) {let out = '';let i = 0;const blank = chunk => chunk.replace(/[^\n]/g, ' ');@@ -159,15 +160,15 @@ export function stripRustComments(text) {const close = '"' + m[1];const end = text.indexOf(close, i + m[0].length);const stop = end === -1 ? text.length : end + close.length;- out += blank(text.slice(i, stop));+ out += preserveLiterals ? text.slice(i, stop) : blank(text.slice(i, stop));i = stop;} else if ((m = /^b?'(?:\\(?:x[0-9a-fA-F]{2}|u\{[0-9a-fA-F]+\}|.)|[^\\'])'/.exec(rest))) {- out += blank(m[0]);+ out += preserveLiterals ? m[0] : blank(m[0]);i += m[0].length;} else if (rest.startsWith('"') || rest.startsWith('b"')) {let j = i + (rest.startsWith('b') ? 2 : 1);while (j < text.length && text[j] !== '"') j += text[j] === '\\' ? 2 : 1;- out += blank(text.slice(i, j + 1));+ out += preserveLiterals ? text.slice(i, j + 1) : blank(text.slice(i, j + 1));i = j + 1;} else {out += text[i];diff --git a/scripts/ci/check-process-statics.mjs b/scripts/ci/check-process-statics.mjsindex be421c4946..528d93271f 100644--- a/scripts/ci/check-process-statics.mjs+++ b/scripts/ci/check-process-statics.mjs@@ -18,6 +18,7 @@ const signature = (entry) =>/** Source declarations only: includes aliases and lazy_static!, not macro expansion. */export function declarations(text, file) {const code = stripRustComments(text);+ const signatureCode = stripRustComments(text, { preserveLiterals: true });const found = [];const pattern =/(?<!')\bstatic\s+(?:(mut|ref)\s+)?((?:r#)?[_\p{ID_Start}][_\p{ID_Continue}]*)\s*:(?!:)/gu;@@ -49,7 +50,7 @@ export function declarations(text, file) {}if (end === code.length)throw new Error(`${file}: cannot parse static ${match[2]}`);- const type = code.slice(start, end).replace(/\s+/g, "");+ const type = signatureCode.slice(start, end).replace(/\s+/g, "");if (!type) throw new Error(`${file}: static ${match[2]} has no type`);found.push({file,@@ -71,7 +72,7 @@ function counts(entries) {}/** Require exact, non-stale ownership records for added or changed declaration types. */-export function reviewChanges(before, after, approvals) {+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);@@ -114,6 +115,12 @@ export function reviewChanges(before, after, approvals) {);}}+ 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}`);+ }+ }return errors;}@@ -146,10 +153,10 @@ export function checkRepository(root, baseRef) {);}const previousFiles = git(["ls-tree", "-r", "--name-only", base, "--", CORE])- .split("\n")+ .split("\0").filter(production);- const currentFiles = git(["ls-files", "--", CORE])- .split("\n")+ const currentFiles = git(["ls-files", "-z", "--", CORE])+ .split("\0").filter(production);if (!currentFiles.length)throw new Error(@@ -162,10 +169,13 @@ 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");return {base,files: currentFiles.length,- errors: reviewChanges(before, after, approvals),+ errors: reviewChanges(before, after, approvals, previousApprovals),};}diff --git a/scripts/ci/self-hosted/lanes-plan.mjs b/scripts/ci/self-hosted/lanes-plan.mjsindex 626de70b07..d5142ed627 100644--- a/scripts/ci/self-hosted/lanes-plan.mjs+++ b/scripts/ci/self-hosted/lanes-plan.mjs@@ -235,7 +235,7 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {{name: "process-statics",when: true,- run: "node scripts/ci/check-process-statics.mjs",+ run: "bash scripts/ci-cancel-aware.sh node scripts/ci/check-process-statics.mjs",},{name: "module-boundaries",