Skip to content

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

refactor(ci): share module pin inventory between gate and fetch script

Steven Enamakelf34f4ef5c085
diff --git a/scripts/ci/check-module-pins.mjs b/scripts/ci/check-module-pins.mjs
index 00e57219e3..8f2812e124 100755
--- a/scripts/ci/check-module-pins.mjs
+++ b/scripts/ci/check-module-pins.mjs
@@ -21,7 +21,7 @@
//
// 1. Every record in `ALL` sits on the tag its `version` names, unless it is
// declared in module-pin-exemptions.json with the exact drift it has.
-// 2. Every record in `ALL` is accounted for by the pin map below. A module
+// 2. Every record in `ALL` is accounted for by the shared module pin inventory. A module
// added without a decision here fails the gate rather than silently
// escaping it. Six vendored crates landed between 2026-08-20 and -27; a
// guard that enumerated today's modules would already be behind.
@@ -66,32 +66,8 @@ import {
const HERE = dirname(fileURLToPath(import.meta.url));
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 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" },
- tinybox: { submodule: "vendor/tinybox" },
- tinychannels: { submodule: "vendor/tinychannels" },
- tinyhosts: { submodule: "vendor/tinyhosts" },
- tinydocs: { submodule: "vendor/tinydocs" },
- tinywallet: { submodule: "vendor/tinywallet" },
- tinyjuice: { submodule: "vendor/tinyjuice" },
- tinyvoice: { submodule: "vendor/tinyvoice" },
- tinymcp: { submodule: "vendor/tinymcp" },
- tinyconnectors: { submodule: "vendor/tinyconnectors" },
- tinybox: { submodule: "vendor/tinybox" },
- tinychannels: { submodule: "vendor/tinychannels" },
- tinyhosts: { submodule: "vendor/tinyhosts" },
- tinymemes: { submodule: "vendor/tinymemes" },
- tinyflows: { submodule: "vendor/tinyflows" },
-};
+// The fetch bootstrap imports this same inventory without running the gate.
+import { PIN_MAP } from "../lib/module-pin-inventory.mjs";
const failures = [];
const notes = [];
diff --git a/scripts/ci/fetch-submodule-tags.sh b/scripts/ci/fetch-submodule-tags.sh
index c590b8e7ad..a0906ee7c2 100755
--- a/scripts/ci/fetch-submodule-tags.sh
+++ b/scripts/ci/fetch-submodule-tags.sh
@@ -10,15 +10,18 @@ set -euo pipefail
cd "$(dirname "$0")/../.."
-for module in \
- vendor/tinydocs vendor/tinywallet vendor/tinymemory vendor/tinyjuice \
- vendor/tinyvoice vendor/tinymcp vendor/tinyconnectors \
- vendor/tinysearch vendor/tinybox vendor/tinychannels vendor/tinyhosts vendor/tinymemes vendor/tinyflows
-do
+# Resolve the exact repositories the gate inspects, including shared sources
+# and providers, from its authoritative inventory. Keep inventory failures fatal.
+modules="$(node --input-type=module -e '
+ import { modulePinRepositories } from "./scripts/lib/module-pin-inventory.mjs";
+ console.log(modulePinRepositories().join("\n"));
+')"
+while IFS= read -r module; do
+ [ -n "$module" ] || continue
if [ "$(git -C "$module" rev-parse --is-shallow-repository)" = true ]; then
git -C "$module" fetch --quiet --no-recurse-submodules --unshallow --tags origin
else
git -C "$module" fetch --quiet --no-recurse-submodules --tags origin
fi
-done
+done <<< "$modules"
echo "[ci][submodule-tags] fetched tags for module submodules"
diff --git a/scripts/lib/module-pin-inventory.mjs b/scripts/lib/module-pin-inventory.mjs
new file mode 100644
index 0000000000..14864945a2
--- /dev/null
+++ b/scripts/lib/module-pin-inventory.mjs
@@ -0,0 +1,33 @@
+// Shared source inventory for the module-pin gate and its tag-fetch bootstrap.
+// This module has no filesystem, subprocess, or process-exit side effects.
+
+// 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. Runtime providers 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).
+export const PIN_MAP = {
+ tinysearch: { submodule: "vendor/tinysearch" },
+ tinycomputer: { submodule: "vendor/tinycomputer" },
+ tinybox: { submodule: "vendor/tinybox" },
+ tinychannels: { submodule: "vendor/tinychannels" },
+ tinyhosts: { submodule: "vendor/tinyhosts" },
+ tinydocs: { submodule: "vendor/tinydocs" },
+ tinywallet: { submodule: "vendor/tinywallet" },
+ tinyjuice: { submodule: "vendor/tinyjuice" },
+ tinyvoice: { submodule: "vendor/tinyvoice" },
+ tinymcp: { submodule: "vendor/tinymcp" },
+ tinyconnectors: { submodule: "vendor/tinyconnectors" },
+ tinymemes: { submodule: "vendor/tinymemes" },
+ tinyflows: { submodule: "vendor/tinyflows" },
+};
+
+/** Return each module repository needed by the pin gate, in stable order. */
+export function modulePinRepositories(pinMap = PIN_MAP) {
+ return [...new Set(Object.values(pinMap).map((entry) =>
+ entry.provider ? entry.provider.builtAgainst : (entry.submodule ?? entry.sharesWith),
+ ).filter(Boolean))].sort();
+}