Skip to content

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

fix: follow split Rust includes in pin checks

Steven Enamakelb646869586ab
diff --git a/scripts/__tests__/module-pins.test.mjs b/scripts/__tests__/module-pins.test.mjs
index 5fb757ca55..08aa3b6189 100644
--- a/scripts/__tests__/module-pins.test.mjs
+++ b/scripts/__tests__/module-pins.test.mjs
@@ -2,13 +2,20 @@
//
// The pure logic is covered directly; the two CLIs are driven end-to-end against
// the real tree, including the two commits that actually shipped a regression.
-import assert from 'node:assert/strict';
-import { execFileSync, spawnSync } from 'node:child_process';
-import { mkdtempSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
-import { tmpdir } from 'node:os';
-import { dirname, join, resolve } from 'node:path';
-import { test } from 'node:test';
-import { fileURLToPath } from 'node:url';
+import assert from "node:assert/strict";
+import { execFileSync, spawnSync } from "node:child_process";
+import {
+ mkdtempSync,
+ mkdirSync,
+ readFileSync,
+ realpathSync,
+ rmSync,
+ writeFileSync,
+} from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join, resolve } from "node:path";
+import { test } from "node:test";
+import { fileURLToPath } from "node:url";
// Every name below is the SHIPPED implementation from scripts/lib/module-pins.mjs
// — the same module the two CLIs in scripts/ci/ import. Nothing in this file
@@ -18,6 +25,7 @@ import {
checkPinMapCoverage,
classifyMove,
classifyPin,
+ expandRustIncludes,
parseAllList,
parseArtifactCapabilitiesPin,
parseGitlinks,
@@ -25,16 +33,20 @@ import {
parseWorkflowMemoryBlocks,
rewindDeclared,
toplevelProvesSubmodule,
-} from '../lib/module-pins.mjs';
+} from "../lib/module-pins.mjs";
-const REPO_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
-const PINS_CLI = join(REPO_ROOT, 'scripts/ci/check-module-pins.mjs');
-const MONO_CLI = join(REPO_ROOT, 'scripts/ci/check-submodule-monotonic.mjs');
+const REPO_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
+const PINS_CLI = join(REPO_ROOT, "scripts/ci/check-module-pins.mjs");
+const MONO_CLI = join(REPO_ROOT, "scripts/ci/check-submodule-monotonic.mjs");
+const readRustModule = (relativePath) =>
+ expandRustIncludes(relativePath, (includedPath) =>
+ readFileSync(join(REPO_ROOT, includedPath), "utf8"),
+ );
const run = (cli, args = [], env = {}) =>
spawnSync(process.execPath, [cli, ...args], {
cwd: REPO_ROOT,
- encoding: 'utf8',
+ encoding: "utf8",
env: { ...process.env, ...env },
});
@@ -54,12 +66,16 @@ const run = (cli, args = [], env = {}) =>
* macOS resolves `/tmp/...` to `/private/tmp/...`.
*/
function submodulesPresent() {
- const path = join(REPO_ROOT, 'vendor/tinymemory');
+ const path = join(REPO_ROOT, "vendor/tinymemory");
try {
- const top = execFileSync('git', ['-C', path, 'rev-parse', '--show-toplevel'], {
- encoding: 'utf8',
- stdio: ['ignore', 'pipe', 'ignore'],
- }).trim();
+ const top = execFileSync(
+ "git",
+ ["-C", path, "rev-parse", "--show-toplevel"],
+ {
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "ignore"],
+ },
+ ).trim();
return toplevelProvesSubmodule(realpathSync(top), realpathSync(path));
} catch {
return false;
@@ -68,150 +84,194 @@ function submodulesPresent() {
// ── Registry parsing ──────────────────────────────────────────────────────────
-test('parses every record `ALL` lists out of the real registry', () => {
- const src = readFileSync(join(REPO_ROOT, 'src/openhuman/modules/registry.rs'), 'utf8');
+test("parses every record `ALL` lists out of the real registry", () => {
+ const src = readRustModule("src/openhuman/modules/registry.rs");
const names = parseAllList(src);
const records = parseRecords(src);
- assert.ok(names.length >= 9, `expected at least 9 records in ALL, got ${names.length}`);
+ assert.ok(
+ names.length >= 9,
+ `expected at least 9 records in ALL, got ${names.length}`,
+ );
for (const name of names) {
const rec = records.get(name);
assert.ok(rec, `ALL lists ${name} but no such ModuleRecord parsed`);
assert.ok(rec.id, `${name} has no id`);
- assert.match(rec.version, /^\d+\.\d+\.\d+$/, `${name} version looks wrong: ${rec.version}`);
+ assert.match(
+ rec.version,
+ /^\d+\.\d+\.\d+$/,
+ `${name} version looks wrong: ${rec.version}`,
+ );
}
});
-test('parses per-platform assets, digests included', () => {
- const src = readFileSync(join(REPO_ROOT, 'src/openhuman/modules/registry.rs'), 'utf8');
- const mem = [...parseRecords(src).values()].find((r) => r.id === 'tinymemory');
- assert.ok(mem, 'tinymemory record not found');
- assert.ok(mem.assets.length > 0, 'tinymemory publishes no assets?');
+test("parses per-platform assets, digests included", () => {
+ const src = readRustModule("src/openhuman/modules/registry.rs");
+ const mem = [...parseRecords(src).values()].find(
+ (r) => r.id === "tinymemory",
+ );
+ assert.ok(mem, "tinymemory record not found");
+ assert.ok(mem.assets.length > 0, "tinymemory publishes no assets?");
for (const a of mem.assets) {
assert.match(a.sha256, /^[0-9a-f]{64}$/, `bad digest for ${a.hostKey}`);
- assert.ok(a.archive.includes(mem.version), `${a.archive} does not carry version ${mem.version}`);
+ assert.ok(
+ a.archive.includes(mem.version),
+ `${a.archive} does not carry version ${mem.version}`,
+ );
}
});
-test('reading a registry with no ALL block throws rather than returning empty', () => {
- assert.throws(() => parseAllList('fn main() {}'), /could not find/);
- assert.throws(() => parseRecords('fn main() {}'), /parsed zero/);
+test("reading a registry with no ALL block throws rather than returning empty", () => {
+ assert.throws(() => parseAllList("fn main() {}"), /could not find/);
+ assert.throws(() => parseRecords("fn main() {}"), /parsed zero/);
});
-test('finds ARTIFACT_CAPABILITIES_PIN and the workflow memory blocks', () => {
- const memSrc = readFileSync(join(REPO_ROOT, 'src/openhuman/modules/memory.rs'), 'utf8');
+test("finds ARTIFACT_CAPABILITIES_PIN and the workflow memory blocks", () => {
+ const memSrc = readRustModule("src/openhuman/modules/memory.rs");
assert.match(parseArtifactCapabilitiesPin(memSrc), /^\d+\.\d+\.\d+$/);
- const wf = readFileSync(join(REPO_ROOT, '.github/workflows/ci-lite.yml'), 'utf8');
+ const wf = readFileSync(
+ join(REPO_ROOT, ".github/workflows/ci-lite.yml"),
+ "utf8",
+ );
const blocks = parseWorkflowMemoryBlocks(wf);
- assert.ok(blocks.versions.length > 0, 'ci-lite.yml has no memory_version block');
- assert.equal(blocks.versions.length, blocks.digests.length, 'version/digest blocks must pair');
+ assert.ok(
+ blocks.versions.length > 0,
+ "ci-lite.yml has no memory_version block",
+ );
+ assert.equal(
+ blocks.versions.length,
+ blocks.digests.length,
+ "version/digest blocks must pair",
+ );
});
// ── Classification ────────────────────────────────────────────────────────────
-const base = { id: 'tinyx', version: '1.2.3', submodulePath: 'vendor/tinyx' };
+const base = { id: "tinyx", version: "1.2.3", submodulePath: "vendor/tinyx" };
-test('a pin sitting on its tag passes', () => {
- const v = classifyPin({ ...base, actual: 'v1.2.3', exemption: undefined });
+test("a pin sitting on its tag passes", () => {
+ const v = classifyPin({ ...base, actual: "v1.2.3", exemption: undefined });
assert.equal(v.ok, true);
- assert.equal(v.kind, 'match');
+ assert.equal(v.kind, "match");
});
-test('a pin past its tag fails and names both sides', () => {
- const v = classifyPin({ ...base, actual: 'v1.2.3-7-gabc1234', exemption: undefined });
+test("a pin past its tag fails and names both sides", () => {
+ const v = classifyPin({
+ ...base,
+ actual: "v1.2.3-7-gabc1234",
+ exemption: undefined,
+ });
assert.equal(v.ok, false);
- assert.equal(v.kind, 'drift');
+ assert.equal(v.kind, "drift");
assert.match(v.message, /1\.2\.3/);
assert.match(v.message, /v1\.2\.3-7-gabc1234/);
});
-test('a declared exemption passes only for the exact drift it declares', () => {
- const exemption = { id: 'tinyx', expect: 'v1.2.3-7-gabc1234', reason: 'because' };
- const same = classifyPin({ ...base, actual: 'v1.2.3-7-gabc1234', exemption });
+test("a declared exemption passes only for the exact drift it declares", () => {
+ const exemption = {
+ id: "tinyx",
+ expect: "v1.2.3-7-gabc1234",
+ reason: "because",
+ };
+ const same = classifyPin({ ...base, actual: "v1.2.3-7-gabc1234", exemption });
assert.equal(same.ok, true);
- assert.equal(same.kind, 'exempt');
+ assert.equal(same.kind, "exempt");
// Drifting FURTHER is a new fact, and must be re-declared.
- const wider = classifyPin({ ...base, actual: 'v1.2.3-9-gdef5678', exemption });
+ const wider = classifyPin({
+ ...base,
+ actual: "v1.2.3-9-gdef5678",
+ exemption,
+ });
assert.equal(wider.ok, false);
- assert.equal(wider.kind, 'exemption-widened');
+ assert.equal(wider.kind, "exemption-widened");
});
-test('an exemption whose drift has been fixed fails, so it cannot linger', () => {
+test("an exemption whose drift has been fixed fails, so it cannot linger", () => {
const v = classifyPin({
...base,
- actual: 'v1.2.3',
- exemption: { id: 'tinyx', expect: 'v1.2.3-7-gabc1234', reason: 'because' },
+ actual: "v1.2.3",
+ exemption: { id: "tinyx", expect: "v1.2.3-7-gabc1234", reason: "because" },
});
assert.equal(v.ok, false);
- assert.equal(v.kind, 'stale-exemption');
+ assert.equal(v.kind, "stale-exemption");
});
// ── Coverage: the half that survives the next module ──────────────────────────
-test('a record the pin map has never heard of fails', () => {
- const f = checkPinMapCoverage(['tinymemory', 'tinyfuture'], ['tinymemory']);
+test("a record the pin map has never heard of fails", () => {
+ const f = checkPinMapCoverage(["tinymemory", "tinyfuture"], ["tinymemory"]);
assert.equal(f.length, 1);
assert.match(f[0], /tinyfuture/);
assert.match(f[0], /must not inherit an unchecked pin/);
});
-test('a pin-map entry for a removed record fails', () => {
- const f = checkPinMapCoverage(['tinymemory'], ['tinymemory', 'tinygone']);
+test("a pin-map entry for a removed record fails", () => {
+ const f = checkPinMapCoverage(["tinymemory"], ["tinymemory", "tinygone"]);
assert.equal(f.length, 1);
assert.match(f[0], /tinygone/);
});
-test('a fully covered set is clean', () => {
- assert.deepEqual(checkPinMapCoverage(['a', 'b'], ['b', 'a']), []);
+test("a fully covered set is clean", () => {
+ assert.deepEqual(checkPinMapCoverage(["a", "b"], ["b", "a"]), []);
});
// ── Gitlink parsing and the rewind marker ────────────────────────────────────
-test('reads gitlinks out of ls-tree and ignores ordinary blobs', () => {
+test("reads gitlinks out of ls-tree and ignores ordinary blobs", () => {
const out = [
- '100644 blob 1111111111111111111111111111111111111111\tCargo.toml',
- '160000 commit aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\tvendor/tinyagents',
- '160000 commit bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\tvendor/tinymemory',
- ].join('\n');
+ "100644 blob 1111111111111111111111111111111111111111\tCargo.toml",
+ "160000 commit aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\tvendor/tinyagents",
+ "160000 commit bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\tvendor/tinymemory",
+ ].join("\n");
const m = parseGitlinks(out);
assert.equal(m.size, 2);
- assert.equal(m.get('vendor/tinyagents'), 'a'.repeat(40));
+ assert.equal(m.get("vendor/tinyagents"), "a".repeat(40));
});
-test('the rewind marker is recognised anywhere on the branch, case-insensitively', () => {
- assert.equal(rewindDeclared('Revert the bump [pin-rewind] because X'), true);
- assert.equal(rewindDeclared('[PIN-REWIND]'), true);
- assert.equal(rewindDeclared('an ordinary bump'), false);
+test("the rewind marker is recognised anywhere on the branch, case-insensitively", () => {
+ assert.equal(rewindDeclared("Revert the bump [pin-rewind] because X"), true);
+ assert.equal(rewindDeclared("[PIN-REWIND]"), true);
+ assert.equal(rewindDeclared("an ordinary bump"), false);
assert.equal(rewindDeclared(undefined), false);
});
// ── End to end, against the real tree ─────────────────────────────────────────
-test('the pin gate passes on the tree as committed', { skip: submodulesPresent() ? false : 'submodules not checked out' }, () => {
- const r = run(PINS_CLI);
- assert.equal(r.status, 0, `expected pass, got:\n${r.stdout}${r.stderr}`);
-});
+test(
+ "the pin gate passes on the tree as committed",
+ { skip: submodulesPresent() ? false : "submodules not checked out" },
+ () => {
+ const r = run(PINS_CLI);
+ assert.equal(r.status, 0, `expected pass, got:\n${r.stdout}${r.stderr}`);
+ },
+);
-test('the monotonicity gate catches 14a23b994, which really did drop a shipped fix', () => {
+test("the monotonicity gate catches 14a23b994, which really did drop a shipped fix", () => {
// vendor/tinyagents e0f3210 (tinyagents#122) -> bbcd0a6 (#121). Restored by #5796.
- const r = run(MONO_CLI, ['14a23b994^', '14a23b994'], { PR_TITLE: '' });
+ const r = run(MONO_CLI, ["14a23b994^", "14a23b994"], { PR_TITLE: "" });
if (/cannot resolve base ref|not in the submodule/.test(r.stderr)) {
// Shallow clone or absent submodule: the gate correctly refused to answer.
- assert.equal(r.status, 1, 'an unverifiable pin must still fail, never pass');
+ assert.equal(
+ r.status,
+ 1,
+ "an unverifiable pin must still fail, never pass",
+ );
return;
}
assert.equal(r.status, 1, `expected failure, got:\n${r.stdout}${r.stderr}`);
assert.match(r.stderr, /vendor\/tinyagents moved BACKWARDS/);
});
-test('a rewind declared with [pin-rewind] is allowed through', () => {
- const r = run(MONO_CLI, ['14a23b994^', '14a23b994'], { PR_TITLE: 'undo the bad bump [pin-rewind]' });
+test("a rewind declared with [pin-rewind] is allowed through", () => {
+ const r = run(MONO_CLI, ["14a23b994^", "14a23b994"], {
+ PR_TITLE: "undo the bad bump [pin-rewind]",
+ });
if (/cannot resolve base ref|not in the submodule/.test(r.stderr)) return;
assert.equal(r.status, 0, `expected pass, got:\n${r.stdout}${r.stderr}`);
});
-test('an unresolvable base fails rather than passing on an empty comparison', () => {
- const r = run(MONO_CLI, ['origin/definitely-not-a-ref', 'HEAD']);
+test("an unresolvable base fails rather than passing on an empty comparison", () => {
+ const r = run(MONO_CLI, ["origin/definitely-not-a-ref", "HEAD"]);
assert.equal(r.status, 1);
assert.match(r.stderr, /Refusing to pass having compared\s+nothing/);
});
@@ -225,7 +285,7 @@ test('an unresolvable base fails rather than passing on an empty comparison', ()
/** A throwaway repo root the pins CLI can be pointed at via argv[2]. */
function fixtureRoot(files) {
- const root = mkdtempSync(join(tmpdir(), 'module-pins-'));
+ const root = mkdtempSync(join(tmpdir(), "module-pins-"));
for (const [rel, body] of Object.entries(files)) {
const abs = join(root, rel);
mkdirSync(dirname(abs), { recursive: true });
@@ -234,31 +294,45 @@ function fixtureRoot(files) {
return root;
}
-const MINIMAL_WORKFLOW = 'jobs:\n x:\n steps:\n - run: |\n memory_version="9.9.9"\n memory_sha256="' + 'f'.repeat(64) + '"\n';
+const MINIMAL_WORKFLOW =
+ 'jobs:\n x:\n steps:\n - run: |\n memory_version="9.9.9"\n memory_sha256="' +
+ "f".repeat(64) +
+ '"\n';
-test('an unparseable registry fails the gate instead of passing', () => {
+test("an unparseable registry fails the gate instead of passing", () => {
const root = fixtureRoot({
- 'src/openhuman/modules/registry.rs': '// everything here got deleted\n',
- 'src/openhuman/modules/memory.rs': 'pub(crate) const ARTIFACT_CAPABILITIES_PIN: &str = "9.9.9";\n',
- '.github/workflows/ci-full.yml': MINIMAL_WORKFLOW,
- '.github/workflows/ci-lite.yml': MINIMAL_WORKFLOW,
- '.github/workflows/e2e-reusable.yml': MINIMAL_WORKFLOW,
+ "src/openhuman/modules/registry.rs": "// everything here got deleted\n",
+ "src/openhuman/modules/memory.rs":
+ 'pub(crate) const ARTIFACT_CAPABILITIES_PIN: &str = "9.9.9";\n',
+ ".github/workflows/ci-full.yml": MINIMAL_WORKFLOW,
+ ".github/workflows/ci-lite.yml": MINIMAL_WORKFLOW,
+ ".github/workflows/e2e-reusable.yml": MINIMAL_WORKFLOW,
});
try {
const r = run(PINS_CLI, [root]);
- assert.notEqual(r.status, 0, `a registry it cannot parse must FAIL, got exit 0:\n${r.stdout}`);
+ assert.notEqual(
+ r.status,
+ 0,
+ `a registry it cannot parse must FAIL, got exit 0:\n${r.stdout}`,
+ );
assert.match(`${r.stdout}${r.stderr}`, /could not find|FAILED/);
- assert.doesNotMatch(r.stdout, /Module pin check OK/, 'must not claim OK on an unparseable registry');
+ assert.doesNotMatch(
+ r.stdout,
+ /Module pin check OK/,
+ "must not claim OK on an unparseable registry",
+ );
} finally {
rmSync(root, { recursive: true, force: true });
}
});
-test('a missing registry file fails the gate instead of passing', () => {
- const root = fixtureRoot({ '.github/workflows/ci-lite.yml': MINIMAL_WORKFLOW });
+test("a missing registry file fails the gate instead of passing", () => {
+ const root = fixtureRoot({
+ ".github/workflows/ci-lite.yml": MINIMAL_WORKFLOW,
+ });
try {
const r = run(PINS_CLI, [root]);
- assert.notEqual(r.status, 0, 'a missing registry must FAIL');
+ assert.notEqual(r.status, 0, "a missing registry must FAIL");
assert.match(`${r.stdout}${r.stderr}`, /missing|FAILED/);
assert.doesNotMatch(r.stdout, /Module pin check OK/);
} finally {
@@ -266,48 +340,56 @@ test('a missing registry file fails the gate instead of passing', () => {
}
});
-test('records with no checked-out submodule fail the gate instead of being skipped', () => {
+test("records with no checked-out submodule fail the gate instead of being skipped", () => {
// A well-formed registry whose vendor/ tree simply is not there — exactly the
// shape of a lane that forgot `submodules: recursive`. Skipping would report a
// clean scan of nothing.
const registry = [
- 'const TINYDOCS: ModuleRecord = ModuleRecord {',
+ "const TINYDOCS: ModuleRecord = ModuleRecord {",
' id: "tinydocs",',
' version: "0.1.14",',
- ' assets: &[],',
- '};',
- '',
- 'pub const ALL: &[ModuleRecord] = &[',
- ' TINYDOCS,',
- '];',
- '',
- ].join('\n');
+ " assets: &[],",
+ "};",
+ "",
+ "pub const ALL: &[ModuleRecord] = &[",
+ " TINYDOCS,",
+ "];",
+ "",
+ ].join("\n");
const root = fixtureRoot({
- 'src/openhuman/modules/registry.rs': registry,
- 'src/openhuman/modules/memory.rs': 'pub(crate) const ARTIFACT_CAPABILITIES_PIN: &str = "1.12.0";\n',
- '.github/workflows/ci-full.yml': MINIMAL_WORKFLOW,
- '.github/workflows/ci-lite.yml': MINIMAL_WORKFLOW,
- '.github/workflows/e2e-reusable.yml': MINIMAL_WORKFLOW,
+ "src/openhuman/modules/registry.rs": registry,
+ "src/openhuman/modules/memory.rs":
+ 'pub(crate) const ARTIFACT_CAPABILITIES_PIN: &str = "1.12.0";\n',
+ ".github/workflows/ci-full.yml": MINIMAL_WORKFLOW,
+ ".github/workflows/ci-lite.yml": MINIMAL_WORKFLOW,
+ ".github/workflows/e2e-reusable.yml": MINIMAL_WORKFLOW,
});
try {
const r = run(PINS_CLI, [root]);
- assert.notEqual(r.status, 0, 'an uninitialised submodule must FAIL, not skip');
- assert.match(`${r.stdout}${r.stderr}`, /not a checked-out submodule|submodules: recursive/);
+ assert.notEqual(
+ r.status,
+ 0,
+ "an uninitialised submodule must FAIL, not skip",
+ );
+ assert.match(
+ `${r.stdout}${r.stderr}`,
+ /not a checked-out submodule|submodules: recursive/,
+ );
assert.doesNotMatch(r.stdout, /Module pin check OK/);
} finally {
rmSync(root, { recursive: true, force: true });
}
});
-test('the monotonicity gate fails when run outside a git repo rather than passing', () => {
- const root = mkdtempSync(join(tmpdir(), 'module-pins-nogit-'));
+test("the monotonicity gate fails when run outside a git repo rather than passing", () => {
+ const root = mkdtempSync(join(tmpdir(), "module-pins-nogit-"));
try {
- const r = spawnSync(process.execPath, [MONO_CLI, 'origin/main', 'HEAD'], {
+ const r = spawnSync(process.execPath, [MONO_CLI, "origin/main", "HEAD"], {
cwd: root,
- encoding: 'utf8',
+ encoding: "utf8",
env: { ...process.env },
});
- assert.notEqual(r.status, 0, 'no git repo must FAIL, not pass');
+ assert.notEqual(r.status, 0, "no git repo must FAIL, not pass");
assert.doesNotMatch(r.stdout, /check OK/);
} finally {
rmSync(root, { recursive: true, force: true });
@@ -316,67 +398,94 @@ test('the monotonicity gate fails when run outside a git repo rather than passin
// ── Review findings from #5812 ────────────────────────────────────────────────
-test('a comment inside ALL does not swallow the record beneath it', () => {
+test("a comment inside ALL does not swallow the record beneath it", () => {
// CodeRabbit on #5812: splitting on commas before stripping comments puts the
// comment and the next record in one token, and filtering tokens beginning
// with `//` dropped both. A dropped record reads downstream as "missing from
// PIN_MAP" — CI fails while pointing at the wrong thing.
const src = [
- 'pub const ALL: &[ModuleRecord] = &[',
- ' // the codecs',
- ' TINYDOCS,',
- ' TINYWALLET, // lazy',
- ' // Eager, unlike the two codecs above.',
- ' TINYMEMORY,',
- '];',
- ].join('\n');
- assert.deepEqual(parseAllList(src), ['TINYDOCS', 'TINYWALLET', 'TINYMEMORY']);
+ "pub const ALL: &[ModuleRecord] = &[",
+ " // the codecs",
+ " TINYDOCS,",
+ " TINYWALLET, // lazy",
+ " // Eager, unlike the two codecs above.",
+ " TINYMEMORY,",
+ "];",
+ ].join("\n");
+ assert.deepEqual(parseAllList(src), ["TINYDOCS", "TINYWALLET", "TINYMEMORY"]);
});
-test('a divergent pin is not forward', () => {
+test("a divergent pin is not forward", () => {
// Codex on #5812: asking only "is head an ancestor of base?" reads the single
// failed query as forward, so siblings — a side branch, or a rebased submodule
// history — sail through. Divergence loses the base's commits exactly as a
// rewind does, and a rewind onto a sibling is one rebase away from 14a23b994.
- assert.equal(classifyMove({ headIsAncestorOfBase: true, baseIsAncestorOfHead: false }), 'rewind');
- assert.equal(classifyMove({ headIsAncestorOfBase: false, baseIsAncestorOfHead: true }), 'forward');
- assert.equal(classifyMove({ headIsAncestorOfBase: false, baseIsAncestorOfHead: false }), 'divergent');
+ assert.equal(
+ classifyMove({ headIsAncestorOfBase: true, baseIsAncestorOfHead: false }),
+ "rewind",
+ );
+ assert.equal(
+ classifyMove({ headIsAncestorOfBase: false, baseIsAncestorOfHead: true }),
+ "forward",
+ );
+ assert.equal(
+ classifyMove({ headIsAncestorOfBase: false, baseIsAncestorOfHead: false }),
+ "divergent",
+ );
});
-test('the submodule probe is not fooled by the superproject above it', () => {
+test("the submodule probe is not fooled by the superproject above it", () => {
// Codex on #5812. `rev-parse --git-dir` walks upward and succeeds from any
// directory inside a repository, submodule or not — so it cannot answer this.
- const root = mkdtempSync(join(tmpdir(), 'module-pins-super-'));
+ const root = mkdtempSync(join(tmpdir(), "module-pins-super-"));
try {
- execFileSync('git', ['init', '-q', root], { stdio: 'ignore' });
- const notASubmodule = join(root, 'vendor', 'tinymemory');
+ execFileSync("git", ["init", "-q", root], { stdio: "ignore" });
+ const notASubmodule = join(root, "vendor", "tinymemory");
mkdirSync(notASubmodule, { recursive: true });
// The old probe: succeeds, answering the SUPERPROJECT's git dir.
- const walked = execFileSync('git', ['-C', notASubmodule, 'rev-parse', '--git-dir'], {
- encoding: 'utf8',
- stdio: ['ignore', 'pipe', 'ignore'],
- }).trim();
- assert.ok(walked.length > 0, 'precondition: --git-dir does walk up, which is why it cannot be used');
+ const walked = execFileSync(
+ "git",
+ ["-C", notASubmodule, "rev-parse", "--git-dir"],
+ {
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "ignore"],
+ },
+ ).trim();
+ assert.ok(
+ walked.length > 0,
+ "precondition: --git-dir does walk up, which is why it cannot be used",
+ );
// The probe actually used: the toplevel is the superproject, not the path,
// so this correctly reports "not a checked-out submodule".
- const top = execFileSync('git', ['-C', notASubmodule, 'rev-parse', '--show-toplevel'], {
- encoding: 'utf8',
- stdio: ['ignore', 'pipe', 'ignore'],
- }).trim();
+ const top = execFileSync(
+ "git",
+ ["-C", notASubmodule, "rev-parse", "--show-toplevel"],
+ {
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "ignore"],
+ },
+ ).trim();
assert.equal(
toplevelProvesSubmodule(realpathSync(top), realpathSync(notASubmodule)),
false,
- 'a directory that merely sits inside a repo must not read as a checked-out submodule',
+ "a directory that merely sits inside a repo must not read as a checked-out submodule",
);
// ...and the positive case: the superproject root IS its own toplevel.
- const superTop = execFileSync('git', ['-C', root, 'rev-parse', '--show-toplevel'], {
- encoding: 'utf8',
- stdio: ['ignore', 'pipe', 'ignore'],
- }).trim();
- assert.equal(toplevelProvesSubmodule(realpathSync(superTop), realpathSync(root)), true);
+ const superTop = execFileSync(
+ "git",
+ ["-C", root, "rev-parse", "--show-toplevel"],
+ {
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "ignore"],
+ },
+ ).trim();
+ assert.equal(
+ toplevelProvesSubmodule(realpathSync(superTop), realpathSync(root)),
+ true,
+ );
} finally {
rmSync(root, { recursive: true, force: true });
}
diff --git a/scripts/ci/check-module-pins.mjs b/scripts/ci/check-module-pins.mjs
index 2d3d6ed1df..b771e08908 100755
--- a/scripts/ci/check-module-pins.mjs
+++ b/scripts/ci/check-module-pins.mjs
@@ -39,33 +39,36 @@
// swallowed a git error and reported clean having scanned nothing.
//
// Usage: check-module-pins.mjs [repo-root]
-import { readFileSync, existsSync } from 'node:fs';
-import { execFileSync } from 'node:child_process';
+import { readFileSync, existsSync } from "node:fs";
+import { execFileSync } from "node:child_process";
// Any throw below is a check that could not be COMPLETED, which is not the same
// as a check that passed. Report it as a failure with a legible message rather
// than a stack trace, and never exit 0. Two gates have shipped here that
// swallowed a git error and reported clean having scanned nothing.
-process.on('uncaughtException', (error) => {
+process.on("uncaughtException", (error) => {
console.error(`\nModule pin check FAILED\n`);
console.error(` \u2717 ${error.message}\n`);
- console.error(' This gate could not complete. That is a failure, not a pass.\n');
+ console.error(
+ " This gate could not complete. That is a failure, not a pass.\n",
+ );
process.exit(1);
});
-import { dirname, join, resolve } from 'node:path';
-import { fileURLToPath } from 'node:url';
+import { dirname, join, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
import {
checkPinMapCoverage,
classifyPin,
+ expandRustIncludes,
parseAllList,
parseArtifactCapabilitiesPin,
parseRecords,
parseWorkflowMemoryBlocks,
-} from '../lib/module-pins.mjs';
+} from "../lib/module-pins.mjs";
const HERE = dirname(fileURLToPath(import.meta.url));
-const ROOT = resolve(process.argv[2] ?? join(HERE, '..', '..'));
+const ROOT = resolve(process.argv[2] ?? join(HERE, "..", ".."));
// Record id -> the submodule that is the source of truth for its version.
//
@@ -74,23 +77,23 @@ const ROOT = resolve(process.argv[2] ?? join(HERE, '..', '..'));
// ship out of the tinyruntime release, so they are checked against
// `vendor/tinyruntime` via `sharesWith`.
const PIN_MAP = {
- tinydocs: { submodule: 'vendor/tinydocs' },
- tinywallet: { submodule: 'vendor/tinywallet' },
- tinymemory: { submodule: 'vendor/tinymemory' },
- tinyjuice: { submodule: 'vendor/tinyjuice' },
- tinyvoice: { submodule: 'vendor/tinyvoice' },
- tinyruntime: { submodule: 'vendor/tinyruntime' },
- tinymcp: { submodule: 'vendor/tinymcp' },
- tinyconnectors: { submodule: 'vendor/tinyconnectors' },
- 'tinyruntime-nodejs': {
+ tinydocs: { submodule: "vendor/tinydocs" },
+ tinywallet: { submodule: "vendor/tinywallet" },
+ tinymemory: { submodule: "vendor/tinymemory" },
+ tinyjuice: { submodule: "vendor/tinyjuice" },
+ tinyvoice: { submodule: "vendor/tinyvoice" },
+ tinyruntime: { submodule: "vendor/tinyruntime" },
+ tinymcp: { submodule: "vendor/tinymcp" },
+ tinyconnectors: { submodule: "vendor/tinyconnectors" },
+ "tinyruntime-nodejs": {
submodule: null,
- sharesWith: 'vendor/tinyruntime',
- reason: 'published from the tinyruntime release; no repository of its own',
+ sharesWith: "vendor/tinyruntime",
+ reason: "published from the tinyruntime release; no repository of its own",
},
- 'tinyruntime-python': {
+ "tinyruntime-python": {
submodule: null,
- sharesWith: 'vendor/tinyruntime',
- reason: 'published from the tinyruntime release; no repository of its own',
+ sharesWith: "vendor/tinyruntime",
+ reason: "published from the tinyruntime release; no repository of its own",
},
};
@@ -101,58 +104,99 @@ const fail = (m) => failures.push(m);
/** Run a command, or die. Never returns a sentinel a caller could mistake for success. */
function mustRun(cmd, args, cwd, what) {
try {
- return execFileSync(cmd, args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
+ return execFileSync(cmd, args, {
+ cwd,
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "pipe"],
+ }).trim();
} catch (error) {
// Fail closed. A gate that treats "could not look" as "nothing wrong" is
// worse than no gate: it reports a clean scan of nothing.
- const detail = (error.stderr || error.message || '').toString().trim().split('\n')[0];
- throw new Error(`${what}: \`${cmd} ${args.join(' ')}\` failed in ${cwd}: ${detail}`);
+ const detail = (error.stderr || error.message || "")
+ .toString()
+ .trim()
+ .split("\n")[0];
+ throw new Error(
+ `${what}: \`${cmd} ${args.join(" ")}\` failed in ${cwd}: ${detail}`,
+ );
}
}
function readOrDie(path, what) {
- if (!existsSync(path)) throw new Error(`${what}: expected file is missing: ${path}`);
- return readFileSync(path, 'utf8');
+ if (!existsSync(path))
+ throw new Error(`${what}: expected file is missing: ${path}`);
+ return readFileSync(path, "utf8");
+}
+
+function readRustModule(relativePath, what) {
+ return expandRustIncludes(relativePath, (includedPath) =>
+ readOrDie(join(ROOT, includedPath), `${what} include`),
+ );
}
// ── Parse the registry ────────────────────────────────────────────────────────
-const registrySrc = readOrDie(join(ROOT, 'src/openhuman/modules/registry.rs'), 'registry');
+const registrySrc = readRustModule(
+ "src/openhuman/modules/registry.rs",
+ "registry",
+);
const allNames = parseAllList(registrySrc);
const records = parseRecords(registrySrc);
const active = [];
for (const name of allNames) {
const rec = records.get(name);
- if (!rec) { fail(`registry.rs: \`ALL\` lists ${name}, but no such ModuleRecord was parsed`); continue; }
- if (!rec.id || !rec.version) { fail(`registry.rs: ${name} is missing an id or version`); continue; }
+ if (!rec) {
+ fail(
+ `registry.rs: \`ALL\` lists ${name}, but no such ModuleRecord was parsed`,
+ );
+ continue;
+ }
+ if (!rec.id || !rec.version) {
+ fail(`registry.rs: ${name} is missing an id or version`);
+ continue;
+ }
active.push(rec);
}
-if (active.length === 0) fail('registry.rs: `ALL` resolved to zero usable records');
+if (active.length === 0)
+ fail("registry.rs: `ALL` resolved to zero usable records");
// ── Check 3 first: is every record accounted for? ─────────────────────────────
//
// Before checking pins, check that we KNOW about every record. Running the pin
// checks first would report "all pins agree" on a tree containing a module this
// gate has never heard of.
-for (const f of checkPinMapCoverage(active.map((r) => r.id), Object.keys(PIN_MAP))) fail(f);
+for (const f of checkPinMapCoverage(
+ active.map((r) => r.id),
+ Object.keys(PIN_MAP),
+))
+ fail(f);
// ── Exemptions ────────────────────────────────────────────────────────────────
-const exemptionsRaw = readOrDie(join(HERE, 'module-pin-exemptions.json'), 'exemptions');
+const exemptionsRaw = readOrDie(
+ join(HERE, "module-pin-exemptions.json"),
+ "exemptions",
+);
let exemptions;
try {
exemptions = JSON.parse(exemptionsRaw).exemptions ?? [];
} catch (error) {
- throw new Error(`module-pin-exemptions.json is not valid JSON: ${error.message}`);
+ throw new Error(
+ `module-pin-exemptions.json is not valid JSON: ${error.message}`,
+ );
}
const exemptById = new Map(exemptions.map((e) => [e.id, e]));
for (const e of exemptions) {
if (!e.id || !e.expect || !e.reason) {
- fail(`module-pin-exemptions.json: entry ${JSON.stringify(e.id ?? e)} needs id, expect and reason`);
+ fail(
+ `module-pin-exemptions.json: entry ${JSON.stringify(e.id ?? e)} needs id, expect and reason`,
+ );
}
if (!active.some((r) => r.id === e.id)) {
- fail(`module-pin-exemptions.json: "${e.id}" is not a record in modules::registry::ALL. Remove it.`);
+ fail(
+ `module-pin-exemptions.json: "${e.id}" is not a record in modules::registry::ALL. Remove it.`,
+ );
}
}
@@ -160,7 +204,7 @@ for (const e of exemptions) {
function describe(submodulePath) {
const abs = join(ROOT, submodulePath);
- if (!existsSync(join(abs, '.git'))) {
+ if (!existsSync(join(abs, ".git"))) {
// Not "skip". A lane that runs this gate must check submodules out; if it
// does not, the gate has scanned nothing and must say so.
throw new Error(
@@ -171,7 +215,12 @@ function describe(submodulePath) {
// `--tags` so lightweight tags count; no `--exact-match`, because the drift we
// are hunting is exactly the "N commits past the tag" form and we want to
// report it rather than get an opaque failure.
- return mustRun('git', ['describe', '--tags', 'HEAD'], abs, `describe ${submodulePath}`);
+ return mustRun(
+ "git",
+ ["describe", "--tags", "HEAD"],
+ abs,
+ `describe ${submodulePath}`,
+ );
}
const describeCache = new Map();
@@ -198,8 +247,11 @@ for (const rec of active) {
});
if (!verdict.ok) {
fail(verdict.message);
- } else if (verdict.kind === 'exempt') {
- const why = verdict.reason.length > 96 ? `${verdict.reason.slice(0, 93)}...` : verdict.reason;
+ } else if (verdict.kind === "exempt") {
+ const why =
+ verdict.reason.length > 96
+ ? `${verdict.reason.slice(0, 93)}...`
+ : verdict.reason;
notes.push(` ~ ${rec.id}: ${actual} — declared exemption: ${why}`);
}
}
@@ -210,14 +262,21 @@ for (const rec of active) {
// only one with a spread this wide. Keyed off the record rather than a literal,
// so re-pinning tinymemory does not need this file edited.
-const memRec = active.find((r) => r.id === 'tinymemory');
+const memRec = active.find((r) => r.id === "tinymemory");
if (!memRec) {
- fail('modules::registry::ALL no longer has a "tinymemory" record; the tinymemory pin-set check cannot run');
+ fail(
+ 'modules::registry::ALL no longer has a "tinymemory" record; the tinymemory pin-set check cannot run',
+ );
} else {
- const memSrc = readOrDie(join(ROOT, 'src/openhuman/modules/memory.rs'), 'modules/memory.rs');
+ const memSrc = readRustModule(
+ "src/openhuman/modules/memory.rs",
+ "modules/memory.rs",
+ );
const pin = parseArtifactCapabilitiesPin(memSrc);
if (!pin) {
- fail('src/openhuman/modules/memory.rs: could not find ARTIFACT_CAPABILITIES_PIN');
+ fail(
+ "src/openhuman/modules/memory.rs: could not find ARTIFACT_CAPABILITIES_PIN",
+ );
} else if (pin !== memRec.version) {
fail(
`ARTIFACT_CAPABILITIES_PIN and the tinymemory registry record disagree.\n` +
@@ -228,7 +287,11 @@ if (!memRec) {
);
}
- const WORKFLOWS = ['.github/workflows/ci-full.yml', '.github/workflows/ci-lite.yml', '.github/workflows/e2e-reusable.yml'];
+ const WORKFLOWS = [
+ ".github/workflows/ci-full.yml",
+ ".github/workflows/ci-lite.yml",
+ ".github/workflows/e2e-reusable.yml",
+ ];
let sawAnyBlock = false;
for (const wf of WORKFLOWS) {
const src = readOrDie(join(ROOT, wf), `workflow ${wf}`);
@@ -237,11 +300,15 @@ if (!memRec) {
if (versions.length === 0) {
// The blocks are how CI gets a real module to test against. If one is
// renamed away this check must not quietly cover fewer files.
- fail(`${wf}: no \`memory_version="…"\` block found. If these moved, update WORKFLOWS in this script.`);
+ fail(
+ `${wf}: no \`memory_version="…"\` block found. If these moved, update WORKFLOWS in this script.`,
+ );
continue;
}
if (versions.length !== digests.length) {
- fail(`${wf}: ${versions.length} memory_version block(s) but ${digests.length} memory_sha256 — they pair up`);
+ fail(
+ `${wf}: ${versions.length} memory_version block(s) but ${digests.length} memory_sha256 — they pair up`,
+ );
}
sawAnyBlock = true;
@@ -270,27 +337,32 @@ if (!memRec) {
if (!memRec.assets.some((asset) => asset.archive === resolved)) {
fail(
`${wf}: builds archive name "${resolved}", which the tinymemory record does not publish.\n` +
- ` Known: ${memRec.assets.map((x) => x.archive).join(', ')}`,
+ ` Known: ${memRec.assets.map((x) => x.archive).join(", ")}`,
);
}
}
}
- if (!sawAnyBlock) fail('no workflow carried a memory_version block — this check scanned nothing');
+ if (!sawAnyBlock)
+ fail(
+ "no workflow carried a memory_version block — this check scanned nothing",
+ );
}
// ── Report ────────────────────────────────────────────────────────────────────
if (failures.length > 0) {
- console.error('\nModule pin check FAILED\n');
+ console.error("\nModule pin check FAILED\n");
for (const f of failures) console.error(` ✗ ${f}\n`);
console.error(
- 'Why this gate exists: a module is pinned twice — as a submodule (the contract this\n' +
- 'build compiles against) and as a version+digest in modules/registry.rs (the artifact\n' +
- 'loaded at runtime). When they disagree the build is green and the failure lands on a\n' +
+ "Why this gate exists: a module is pinned twice — as a submodule (the contract this\n" +
+ "build compiles against) and as a version+digest in modules/registry.rs (the artifact\n" +
+ "loaded at runtime). When they disagree the build is green and the failure lands on a\n" +
"user's machine. openhuman#5727.\n",
);
process.exit(1);
}
-console.log(`Module pin check OK — ${active.length} record(s) in modules::registry::ALL, all pins accounted for.`);
+console.log(
+ `Module pin check OK — ${active.length} record(s) in modules::registry::ALL, all pins accounted for.`,
+);
for (const n of notes) console.log(n);
diff --git a/scripts/lib/module-pins.mjs b/scripts/lib/module-pins.mjs
index 8d9865dad6..6315b2fd2a 100644
--- a/scripts/lib/module-pins.mjs
+++ b/scripts/lib/module-pins.mjs
@@ -4,6 +4,32 @@
// git tree; the two CLIs in scripts/ci/ own the git calls and the process exit.
// See scripts/ci/check-module-pins.mjs for what the gate is for.
+import { posix } from "node:path";
+
+/**
+ * Read a Rust module and the source fragments it brings in with `include!`.
+ *
+ * Large registry and module-client files are split into sibling fragments to
+ * keep source files reviewable. The pin gate still needs to inspect the module
+ * as Rust sees it, not just its small entrypoint. Keeping the reader callback
+ * injectable preserves this module's pure, fixture-friendly design.
+ */
+export function expandRustIncludes(entryPath, readSource, seen = new Set()) {
+ const normalized = posix.normalize(entryPath);
+ if (seen.has(normalized)) {
+ throw new Error(`recursive Rust include detected at ${normalized}`);
+ }
+
+ const nextSeen = new Set(seen).add(normalized);
+ const source = readSource(normalized);
+ const directory = posix.dirname(normalized);
+ const included = [...source.matchAll(/include!\(\s*"([^"]+)"\s*\);/g)].map(
+ (match) =>
+ expandRustIncludes(posix.join(directory, match[1]), readSource, nextSeen),
+ );
+ return [source, ...included].join("\n");
+}
+
/**
* The record names listed in `pub const ALL`, in order.
*
@@ -17,11 +43,13 @@
* pointing at the wrong thing entirely. Raised by CodeRabbit on #5812.
*/
export function parseAllList(src) {
- const block = src.match(/pub const ALL: &\[ModuleRecord\] = &\[([\s\S]*?)\];/);
- if (!block) throw new Error('registry.rs: could not find `pub const ALL`');
+ const block = src.match(
+ /pub const ALL: &\[ModuleRecord\] = &\[([\s\S]*?)\];/,
+ );
+ if (!block) throw new Error("registry.rs: could not find `pub const ALL`");
return block[1]
- .replace(/\/\/[^\n]*/g, '')
- .split(',')
+ .replace(/\/\/[^\n]*/g, "")
+ .split(",")
.map((s) => s.trim())
.filter((s) => s.length > 0);
}
@@ -29,11 +57,12 @@ export function parseAllList(src) {
/** Every `const NAME: ModuleRecord = ModuleRecord { … };`, keyed by NAME. */
export function parseRecords(src) {
const records = new Map();
- const re = /(?:pub )?const ([A-Z0-9_]+): ModuleRecord = ModuleRecord \{([\s\S]*?)\n\};/g;
+ const re =
+ /(?:pub )?const ([A-Z0-9_]+): ModuleRecord = ModuleRecord \{([\s\S]*?)\n\};/g;
for (const m of src.matchAll(re)) {
const [, name, body] = m;
const field = (f) => {
- const hit = body.match(new RegExp(`^\\s*${f}: "([^"]*)"`, 'm'));
+ const hit = body.match(new RegExp(`^\\s*${f}: "([^"]*)"`, "m"));
return hit ? hit[1] : null;
};
const assets = [];
@@ -42,9 +71,15 @@ export function parseRecords(src) {
for (const a of body.matchAll(assetRe)) {
assets.push({ hostKey: a[1], archive: a[2], sha256: a[3] });
}
- records.set(name, { name, id: field('id'), version: field('version'), assets });
+ records.set(name, {
+ name,
+ id: field("id"),
+ version: field("version"),
+ assets,
+ });
}
- if (records.size === 0) throw new Error('registry.rs: parsed zero ModuleRecord blocks');
+ if (records.size === 0)
+ throw new Error("registry.rs: parsed zero ModuleRecord blocks");
return records;
}
@@ -57,9 +92,17 @@ export function parseArtifactCapabilitiesPin(src) {
/** The `memory_version` / `memory_sha256` / `memory_archive` literals in a workflow. */
export function parseWorkflowMemoryBlocks(src) {
return {
- versions: [...src.matchAll(/^\s*memory_version="([^"]+)"/gm)].map((m) => m[1]),
- digests: [...src.matchAll(/^\s*memory_sha256="([^"]+)"/gm)].map((m) => m[1]),
- archives: [...src.matchAll(/^\s*memory_archive="[^"]*\/(tinymemory-module-[^"]+?)"/gm)].map((m) => m[1]),
+ versions: [...src.matchAll(/^\s*memory_version="([^"]+)"/gm)].map(
+ (m) => m[1],
+ ),
+ digests: [...src.matchAll(/^\s*memory_sha256="([^"]+)"/gm)].map(
+ (m) => m[1],
+ ),
+ archives: [
+ ...src.matchAll(
+ /^\s*memory_archive="[^"]*\/(tinymemory-module-[^"]+?)"/gm,
+ ),
+ ].map((m) => m[1]),
};
}
@@ -79,20 +122,20 @@ export function classifyPin({ id, version, submodulePath, actual, exemption }) {
if (exemption) {
return {
ok: false,
- kind: 'stale-exemption',
+ kind: "stale-exemption",
message:
`"${id}" is listed in module-pin-exemptions.json, but its pins now AGREE ` +
`(${submodulePath} is at ${actual}). Delete the exemption — a stale exemption ` +
`hides the next real drift.`,
};
}
- return { ok: true, kind: 'match' };
+ return { ok: true, kind: "match" };
}
if (exemption) {
if (exemption.expect !== actual) {
return {
ok: false,
- kind: 'exemption-widened',
+ kind: "exemption-widened",
message:
`"${id}" drift has CHANGED since it was accepted.\n` +
` registry.rs version : ${version} (expects tag ${wanted})\n` +
@@ -102,11 +145,11 @@ export function classifyPin({ id, version, submodulePath, actual, exemption }) {
` intended, update \`expect\` and the reason in module-pin-exemptions.json.`,
};
}
- return { ok: true, kind: 'exempt', reason: exemption.reason };
+ return { ok: true, kind: "exempt", reason: exemption.reason };
}
return {
ok: false,
- kind: 'drift',
+ kind: "drift",
message:
`"${id}" registry pin and submodule pin describe different releases.\n` +
` registry.rs version : ${version} (would download the v${version} artifact)\n` +
@@ -152,7 +195,7 @@ export function checkPinMapCoverage(activeIds, pinMapIds) {
/** path -> gitlink sha, parsed from `git ls-tree -r <ref>` output. */
export function parseGitlinks(lsTreeOutput) {
const map = new Map();
- for (const line of lsTreeOutput.split('\n')) {
+ for (const line of lsTreeOutput.split("\n")) {
const m = line.match(/^160000 commit ([0-9a-f]{40})\t(.+)$/);
if (m) map.set(m[2], m[1]);
}
@@ -161,7 +204,7 @@ export function parseGitlinks(lsTreeOutput) {
/** A deliberate rewind is declared on the branch that does it. */
export function rewindDeclared(text) {
- return /\[pin-rewind\]/i.test(text ?? '');
+ return /\[pin-rewind\]/i.test(text ?? "");
}
/**
@@ -181,9 +224,9 @@ export function rewindDeclared(text) {
* So both directions are asked and only a genuine descendant is forward.
*/
export function classifyMove({ headIsAncestorOfBase, baseIsAncestorOfHead }) {
- if (headIsAncestorOfBase) return 'rewind';
- if (baseIsAncestorOfHead) return 'forward';
- return 'divergent';
+ if (headIsAncestorOfBase) return "rewind";
+ if (baseIsAncestorOfHead) return "forward";
+ return "divergent";
}
/**