Skip to content

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

chore: files changed scripts/ci/check-module-pins.mjs,scripts/lib/module-pins.mjs

Steven Enamakeld019b94e1323
diff --git a/scripts/ci/check-module-pins.mjs b/scripts/ci/check-module-pins.mjs
index e96eb4bc34..5b9a8c0746 100755
--- a/scripts/ci/check-module-pins.mjs
+++ b/scripts/ci/check-module-pins.mjs
@@ -60,6 +60,7 @@ import { fileURLToPath } from "node:url";
import {
checkPinMapCoverage,
classifyPin,
+ classifyProviderPin,
expandRustIncludes,
parseAllList,
parseArtifactCapabilitiesPin,
@@ -73,9 +74,11 @@ const ROOT = resolve(process.argv[2] ?? join(HERE, "..", ".."));
// Record id -> the submodule that is the source of truth for its version.
//
// `submodule: null` means "this record has no submodule of its own", and needs a
-// reason. It is NOT an exemption from drift — the two runtime providers below
-// ship out of the tinyruntime release, so they are checked against
-// `vendor/tinyruntime` via `sharesWith`.
+// reason. It is NOT an exemption from drift. The two runtime providers below are
+// released from their own repositories on their own version line, so their
+// version cannot equal a submodule tag; `provider` instead checks them against
+// scripts/ci/module-provider-pins.json (their release, and the commit of
+// `builtAgainst` that release was built from, which must be the host's pin).
const PIN_MAP = {
tinysearch: { submodule: "vendor/tinysearch" },
tinycomputer: { submodule: "vendor/tinycomputer" },
@@ -95,13 +98,15 @@ const PIN_MAP = {
tinyhosts: { submodule: "vendor/tinyhosts" },
"tinyruntime-nodejs": {
submodule: null,
- sharesWith: "vendor/tinyruntime",
- reason: "published from the tinyruntime release; no repository of its own",
+ provider: { builtAgainst: "vendor/tinyruntime" },
+ reason:
+ "released from tinyhumansai/tinyruntime-nodejs on its own version line; checked via module-provider-pins.json",
},
"tinyruntime-python": {
submodule: null,
- sharesWith: "vendor/tinyruntime",
- reason: "published from the tinyruntime release; no repository of its own",
+ provider: { builtAgainst: "vendor/tinyruntime" },
+ reason:
+ "released from tinyhumansai/tinyruntime-python on its own version line; checked via module-provider-pins.json",
},
};
@@ -266,9 +271,37 @@ function describeCached(path) {
return describeCache.get(path);
}
+function headCommit(submodulePath) {
+ describeCached(submodulePath); // fails closed when it is not checked out
+ return mustRun(
+ "git",
+ ["rev-parse", "HEAD"],
+ join(ROOT, submodulePath),
+ `rev-parse ${submodulePath}`,
+ );
+}
+
+const providerLocks = JSON.parse(
+ readOrDie(join(HERE, "module-provider-pins.json"), "provider pins"),
+).providers;
+
for (const rec of active) {
const entry = PIN_MAP[rec.id];
if (!entry) continue; // already reported above
+ if (entry.provider) {
+ const lock = providerLocks[rec.id];
+ const src = entry.provider.builtAgainst;
+ const verdict = classifyProviderPin({
+ id: rec.id,
+ version: rec.version,
+ releaseUrl: rec.releaseUrl,
+ lock,
+ sourceSubmodule: src,
+ sourceHead: headCommit(src),
+ });
+ if (!verdict.ok) fail(verdict.message);
+ continue;
+ }
const path = entry.submodule ?? entry.sharesWith;
if (!path) {
fail(`PIN_MAP["${rec.id}"] has neither submodule nor sharesWith`);
diff --git a/scripts/lib/module-pins.mjs b/scripts/lib/module-pins.mjs
index a95c57f2b1..68c5a9eb45 100644
--- a/scripts/lib/module-pins.mjs
+++ b/scripts/lib/module-pins.mjs
@@ -176,6 +176,68 @@ export function classifyPin({ id, version, submodulePath, actual, exemption }) {
};
}
+/**
+ * Decide what a provider record's pin state means.
+ *
+ * A provider module (tinyruntime-nodejs, tinyruntime-python) is released from
+ * its OWN repository on its OWN version line, so its version can never equal
+ * the tag of the shared source submodule it is built against. What can be
+ * checked offline is: (1) the registry record names the release that
+ * module-provider-pins.json declares, and (2) that release was built against
+ * the commit the host's submodule is at now.
+ *
+ * `lock` is the provider's entry from module-provider-pins.json, `sourceHead`
+ * the full commit of the submodule it is built against.
+ */
+export function classifyProviderPin({
+ id,
+ version,
+ releaseUrl,
+ lock,
+ sourceSubmodule,
+ sourceHead,
+}) {
+ if (!lock || !lock.repo || !lock.version || !lock.built_against) {
+ return {
+ ok: false,
+ message:
+ `"${id}" is a provider record but module-provider-pins.json has no complete ` +
+ `entry (repo, version, built_against) for it.`,
+ };
+ }
+ const problems = [];
+ if (lock.version !== version) {
+ problems.push(
+ `registry.rs version is ${version} but module-provider-pins.json says the ` +
+ `provider release is ${lock.version}.`,
+ );
+ }
+ const wantedUrl = `https://github.com/${lock.repo}/releases/tag/v${lock.version}`;
+ if (releaseUrl !== wantedUrl) {
+ problems.push(
+ `registry.rs release_url is ${releaseUrl ?? "(none)"} but the provider pin implies ${wantedUrl}.`,
+ );
+ }
+ if (!/^[0-9a-f]{40}$/.test(lock.built_against)) {
+ problems.push(
+ `module-provider-pins.json built_against must be a full 40-hex commit, got "${lock.built_against}".`,
+ );
+ } else if (lock.built_against !== sourceHead) {
+ problems.push(
+ `provider release v${lock.version} was built against ${sourceSubmodule} ${lock.built_against.slice(0, 8)}, ` +
+ `but the host pins ${sourceHead.slice(0, 8)}. Re-release the provider from ${lock.repo} ` +
+ `against the new source and re-pin it.`,
+ );
+ }
+ if (problems.length > 0) {
+ return {
+ ok: false,
+ message: `"${id}" provider pin is inconsistent:\n ${problems.join("\n ")}`,
+ };
+ }
+ return { ok: true };
+}
+
/**
* Every record in `ALL` must be known to the pin map, and every pin-map entry
* must still be a record.