The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(scripts): require every module declaration to imply the claimed gate\n\nCodex, fourth round. A module can be declared more than once under mutually\nexclusive predicates, and it then exists in BOTH configurations:\n\n #[cfg(feature = "e2e-test-support")] pub mod test_support;\n #[cfg(not(feature = "e2e-test-support"))] pub mod test_support;\n\n`exec` returned only the first declaration, so the check saw the gate and\ncalled the module absent while it is in fact always present — the exclusion\nwould then have removed reachable controllers from the denominator.\n\nThe module exists if ANY of its declarations compiles, so requiring it means\nevery declaration must imply the feature. One unproven declaration settles the\nlevel; the walk still continues upward, because an ancestor `mod` may be gated\nand would make the file unreachable regardless.\n\nTwo tests: the mutually exclusive pair must fail, and a per-platform split\nwhere both declarations require the feature must still be accepted — otherwise\nthe rule would reject legitimate `unix`/`windows` splits.\n
Shanub11c1280006d
diff --git a/scripts/__tests__/domain-e2e-coverage-gate.test.mjs b/scripts/__tests__/domain-e2e-coverage-gate.test.mjsindex 513032a33a..0ce1e75e1a 100644--- a/scripts/__tests__/domain-e2e-coverage-gate.test.mjs+++ b/scripts/__tests__/domain-e2e-coverage-gate.test.mjs@@ -532,3 +532,70 @@ for (const [description, attribute] of IS_A_GATE) {);});}++// Codex, PR #6092 (fourth round). A module can be declared more than once under+// mutually exclusive predicates, and it then exists in BOTH configurations:+//+// #[cfg(feature = "x")] mod test_support;+// #[cfg(not(feature = "x"))] mod test_support;+//+// Reading only the first declaration sees the gate and calls the module absent+// when it is in fact always present.+test('fails when a second declaration makes the module reachable anyway', (t) => {+ const root = fixture(t, { withExcludedNamespaces: false });+ write(+ root,+ 'src/openhuman/test_support/schemas.rs',+ controller('test', 'reset') + controller('test_support', 'workspace_root'),+ );+ write(root, 'src/openhuman/test_support/mod.rs', 'mod schemas;\n');+ write(+ root,+ 'src/openhuman/mod.rs',+ '#[cfg(feature = "e2e-test-support")]\npub mod test_support;\n' ++ '#[cfg(not(feature = "e2e-test-support"))]\npub mod test_support;\n',+ );+ write(root, 'src/openhuman/widgets/schemas_part_01.rs', controller('widgets', 'list'));+ write(root, 'tests/widgets_e2e.rs', 'let m = "openhuman.widgets_list";');++ const result = runGate(root);++ assert.match(+ result.stderr,+ /no longer behind the gate they claim/,+ `a module declared in both configurations is always present; got:\n${result.stderr}`,+ );+});++// The same shape where both declarations DO require the feature stays accepted+// — otherwise the rule would reject every legitimate platform split.+test('accepts repeated declarations when every one of them requires the gate', (t) => {+ const root = fixture(t, { withExcludedNamespaces: false });+ write(+ root,+ 'src/openhuman/test_support/schemas.rs',+ controller('test', 'reset') + controller('test_support', 'workspace_root'),+ );+ write(root, 'src/openhuman/test_support/mod.rs', 'mod schemas;\n');+ write(+ root,+ 'src/openhuman/mod.rs',+ '#[cfg(all(feature = "e2e-test-support", unix))]\npub mod test_support;\n' ++ '#[cfg(all(feature = "e2e-test-support", windows))]\npub mod test_support;\n',+ );+ write(root, 'src/openhuman/widgets/schemas_part_01.rs', controller('widgets', 'list'));+ write(root, 'tests/widgets_e2e.rs', 'let m = "openhuman.widgets_list";');++ const result = runGate(root);++ assert.doesNotMatch(+ result.stderr,+ /no longer behind the gate they claim/,+ `a per-platform split that always requires the feature is still a gate; got:\n${result.stderr}`,+ );+ assert.match(+ result.stdout,+ /Excluded 2 controller\(s\)/,+ `the exclusion must still apply; got:\n${result.stdout}`,+ );+});diff --git a/scripts/check-domain-e2e-coverage.mjs b/scripts/check-domain-e2e-coverage.mjsindex 02982356f7..b397a40a29 100644--- a/scripts/check-domain-e2e-coverage.mjs+++ b/scripts/check-domain-e2e-coverage.mjs@@ -392,13 +392,29 @@ function moduleGateProves(file, feature) {if (fs.existsSync(declaringFile)) {const text = read(declaringFile);- const declaration = new RegExp(`^[ \\t]*(?:pub(?:\\([^)]*\\))?[ \\t]+)?mod[ \\t]+${name}[ \\t]*;`, 'm');- const found = declaration.exec(text);- if (found) {- for (const attribute of attributesBefore(text, found.index)) {- const inner = attribute.match(/^\s*cfg\s*\(([\s\S]*)\)\s*$/)?.[1];- if (inner && cfgProvesFeature(parseCfgPredicate(inner), feature)) return true;- }+ const declaration = new RegExp(`^[ \\t]*(?:pub(?:\\([^)]*\\))?[ \\t]+)?mod[ \\t]+${name}[ \\t]*;`, 'gm');+ // EVERY declaration has to imply the feature, not merely the first one.+ // A module may be declared more than once under mutually exclusive+ // predicates —+ //+ // #[cfg(feature = "x")] mod test_support;+ // #[cfg(not(feature = "x"))] mod test_support;+ //+ // — and it then exists in BOTH configurations. Reading only the first+ // declaration sees the gate and calls the module absent when it is+ // always present, so the test is "does every path to this module require+ // the feature", and one unproven declaration settles it.+ const declarations = [...text.matchAll(declaration)];+ if (declarations.length > 0) {+ const everyPathRequiresIt = declarations.every((found) =>+ attributesBefore(text, found.index).some((attribute) => {+ const inner = attribute.match(/^\s*cfg\s*\(([\s\S]*)\)\s*$/)?.[1];+ return Boolean(inner) && cfgProvesFeature(parseCfgPredicate(inner), feature);+ }),+ );+ // Not proving it here is not a verdict: an ancestor `mod` may still be+ // gated, and that would make the file unreachable all the same.+ if (everyPathRequiresIt) return true;}}