From fda44cd1f40df3a4de74c13d89d910a3c174dbb4 Mon Sep 17 00:00:00 2001 From: ruvnet Date: Wed, 9 Sep 2026 16:57:24 -0400 Subject: [PATCH] ci(agentbbs): stop rule 2 firing on the federation wire namespace ADR-164 rule 2 exists to stop `agentbbs` becoming a mandatory dependency: a static `import ... from 'agentbbs'` is forbidden, and any other mention has to sit behind loadAgentbbs / a dynamic import. Its catch-all is a substring test for "agentbbs" anywhere in the file. agentbbs-federation.ts trips that catch-all without importing anything. Its only remaining mentions after comment-stripping are string literals that never reach a module resolver: the '/agentbbs/v1/...' HTTP route prefix and the 'agentbbs::' hash domain-separators. Adds those two shapes to the existing benign-pattern strip list. The static-import check is untouched and remains the real gate. Verified this narrows the check rather than loosening it, by running the workflow's own rule-2 body verbatim against fixtures: - the real federation module -> passes (false positive gone) - `import { x } from 'agentbbs'` -> still caught - unguarded runtime reference -> still caught - guarded `await import('agentbbs')` -> passes Co-Authored-By: RuFlo Claude-Session: https://claude.ai/code/session_013u4pmL9ZUAXb6usVQgNo67 --- .github/workflows/no-agentbbs-smoke.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/no-agentbbs-smoke.yml b/.github/workflows/no-agentbbs-smoke.yml index ca9edb4bc7..90c42d67b2 100644 --- a/.github/workflows/no-agentbbs-smoke.yml +++ b/.github/workflows/no-agentbbs-smoke.yml @@ -122,7 +122,16 @@ jobs: .replace(/\/\*[\s\S]*?\*\//g, '') // block comments .replace(/export\s+\{[^}]*agentbbsTools[^}]*\}\s+from\s+['\"][^'\"]+agentbbs-tools[^'\"]*['\"];?/g, '') .replace(/import\s+\{[^}]*agentbbsTools[^}]*\}\s+from\s+['\"][^'\"]+agentbbs-tools[^'\"]*['\"];?/g, '') - .replace(/\.\.\.agentbbsTools,?/g, ''); + .replace(/\.\.\.agentbbsTools,?/g, '') + // Phase 2 federation uses 'agentbbs' as a wire namespace, not a + // package: the '/agentbbs/v1/...' HTTP route prefix and the + // 'agentbbs::' hash domain-separators. Neither loads the + // optional dependency, so neither needs a loadAgentbbs guard. + // The static-import check above is untouched and still the + // real gate — this only stops the catch-all heuristic firing + // on string literals that never reach a module resolver. + .replace(/agentbbs(?=\\?\/v1)/g, '') + .replace(/agentbbs(?=:[a-z]+:)/g, ''); if (/agentbbs/.test(stripped)) { const guarded = /loadAgentbbs|import\(['\"]agentbbs['\"]\)/m.test(src); if (!guarded) {