Skip to content

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

test(tests): add test for linked bridge closure edge cases

Steven Enamakelc61eaa28f507
diff --git a/scripts/__tests__/check-module-boundaries.test.mjs b/scripts/__tests__/check-module-boundaries.test.mjs
index 4fb804cd89..3c94a15d61 100644
--- a/scripts/__tests__/check-module-boundaries.test.mjs
+++ b/scripts/__tests__/check-module-boundaries.test.mjs
@@ -175,11 +175,30 @@ test('a legal direct bridge edge does not hide a second path through a wrapper',
[['openhuman-cli', 'wrapper', 'openhuman-modules-linked']],
);
assert.deepEqual(
- linkedHostAudit(m, 'openhuman-cli', linked).map(v => v.path),
+ linkedHostAudit(m, 'openhuman-cli', linked).violations.map(v => v.path),
[['openhuman-cli', 'wrapper', 'openhuman-modules-linked']],
);
});
+test('linked bridge closure does not excuse an unrelated implementation edge or bus source mismatch', () => {
+ const linked = {
+ ...strict,
+ linkedHost: { package: 'openhuman-modules-linked', allowedParents: ['openhuman-cli'] },
+ contractManifests: { 'tinyflows-bus': '/canonical/tinyflows-bus/Cargo.toml' },
+ };
+ const m = metadata({
+ 'openhuman-cli': [['openhuman-modules-linked'], ['openhuman'], ['tinyflows']],
+ 'openhuman-modules-linked': [['tinyflows-import']],
+ openhuman: [['tinyflows-import']],
+ 'tinyflows-import': [['tinyflows'], ['tinyflows-bus']],
+ });
+ const findings = linkedHostAudit(m, 'openhuman-cli', linked).violations;
+ assert.deepEqual(findings.map(v => [v.package, v.path]), [
+ ['tinyflows', ['openhuman-cli', 'tinyflows']],
+ ['tinyflows-bus', ['openhuman-cli', 'openhuman', 'tinyflows-import', 'tinyflows-bus']],
+ ]);
+});
+
test('deliberate violation: the bridge reached from the app, the TUI, the core or through a wrapper fails', () => {
const linked = { ...strict, linkedHost: { package: 'openhuman-modules-linked', allowedParents: ['openhuman-cli'] } };
for (const host of ['openhuman-app', 'openhuman-tui', 'openhuman']) {
@@ -330,6 +349,7 @@ test('host boundary audit ignores writer features unified only by unrelated work
cargoArgs[cargoArgs.indexOf('--features') + 1].split(',').includes('linked-modules');
if (packageName === 'openhuman-cli' && !links && cargoArgs.includes('--features')) {
const selected = cargoArgs[cargoArgs.indexOf('--features') + 1].split(',');
+ assert.ok(selected.includes('default'), 'CLI default-only feature edges remain covered');
assert.ok(selected.includes('flow-write'), 'all non-bridge CLI features remain covered');
assert.ok(!selected.includes('linked-modules'), 'linked-modules is isolated from the shipping graph');
}