Skip to content

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

feat(ci): enforce linked-modules isolation in feature forwarding check

Steven Enamakele5b340e5a37c
diff --git a/scripts/ci/check-feature-forwarding.mjs b/scripts/ci/check-feature-forwarding.mjs
index 11b44dc1af..a8f935c629 100644
--- a/scripts/ci/check-feature-forwarding.mjs
+++ b/scripts/ci/check-feature-forwarding.mjs
@@ -31,6 +31,7 @@ import { fileURLToPath } from 'node:url';
import {
CHAIN_GATES_NOT_FORWARDED,
CHAIN_LOCAL_GATES,
+ checkLinkedModulesIsolation,
checkProductForwarding,
diffChainForwarding,
diffForwarding,
@@ -227,4 +228,14 @@ for (const result of chain) {
const chainOk = chain.every(result => result.ok);
-process.exit(product.ok && defaults.ok && chainOk ? 0 : 1);
+// The local-development linked-modules gate must stay out of every shipped path.
+const linkedViolations = checkLinkedModulesIsolation({ productFeatures, shellToml, cliFeatures });
+console.log('');
+if (linkedViolations.length === 0) {
+ console.log('linked-modules isolation: OK (not a product gate, not in the app manifest, not a CLI default).');
+} else {
+ console.log('linked-modules isolation: FAIL');
+ for (const violation of linkedViolations) console.log(` - ${violation}`);
+}
+
+process.exit(product.ok && defaults.ok && chainOk && linkedViolations.length === 0 ? 0 : 1);
diff --git a/scripts/lib/feature-forwarding.mjs b/scripts/lib/feature-forwarding.mjs
index 4c02b46cf4..75685c3b4b 100644
--- a/scripts/lib/feature-forwarding.mjs
+++ b/scripts/lib/feature-forwarding.mjs
@@ -498,9 +498,43 @@ export const CHAIN_LOCAL_GATES = {
},
'openhuman-cli': {
'bin-tools': 'CLI argument parsing + logger init for the `openhuman-fleet` binary.',
+ 'linked-modules':
+ 'Local development only: links module implementation crates into this binary through `openhuman-modules-linked`. Never a product gate (see checkLinkedModulesIsolation).',
},
};
+/** The non-product feature that links module implementations, and its crate. */
+export const LINKED_MODULES_FEATURE = 'linked-modules';
+export const LINKED_MODULES_CRATE = 'openhuman-modules-linked';
+
+/**
+ * `linked-modules` is a local-development gate and must never ship. Returns a
+ * list of human-readable violations:
+ *
+ * * it appears in the product feature set (`product-features.txt`), which the
+ * CI product lanes pass to cargo and the app must forward;
+ * * the desktop app manifest names the gate or the bridge crate at all;
+ * * the CLI's `default` features enable it (a bare `cargo build` would link
+ * every module).
+ */
+export function checkLinkedModulesIsolation({ productFeatures, shellToml, cliFeatures }) {
+ const violations = [];
+ if (productFeatures.includes(LINKED_MODULES_FEATURE)) {
+ violations.push(`${LINKED_MODULES_FEATURE} is listed in the product feature set`);
+ }
+ const shell = stripComments(shellToml);
+ for (const needle of [LINKED_MODULES_FEATURE, LINKED_MODULES_CRATE]) {
+ if (shell.includes(needle)) {
+ violations.push(`the desktop app manifest names \`${needle}\``);
+ }
+ }
+ const defaults = cliFeatures.get('default') ?? [];
+ if (defaults.includes(LINKED_MODULES_FEATURE)) {
+ violations.push(`the CLI's default features enable ${LINKED_MODULES_FEATURE}`);
+ }
+ return violations;
+}
+
/**
* The `[features]` table of any manifest, as `name -> [items]`.
*