23f7624596
🔄 Automated Rollback Manager / 🔄 Execute Rollback (push) Blocked by required conditions
🔄 Automated Rollback Manager / ✅ Post-Rollback Verification (push) Blocked by required conditions
🔄 Automated Rollback Manager / 📊 Rollback Monitoring (push) Blocked by required conditions
🔄 Automated Rollback Manager / ⏳ Manual Rollback Approval (push) Blocked by required conditions
V3 CI/CD Pipeline / MCP protocol smoke / macos-latest (push) Waiting to run
V3 CI/CD Pipeline / Memory import smoke / macos-latest (push) Waiting to run
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / macos-latest (push) Waiting to run
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / windows-latest (push) Waiting to run
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / macos-latest (push) Waiting to run
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / windows-latest (push) Waiting to run
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / macos-latest (push) Waiting to run
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / windows-latest (push) Waiting to run
V3 CI/CD Pipeline / Witness verify (signed manifest) / macos-latest (push) Blocked by required conditions
V3 CI/CD Pipeline / Witness verify (signed manifest) / ubuntu-latest (push) Blocked by required conditions
V3 CI/CD Pipeline / Witness verify (signed manifest) / windows-latest (push) Blocked by required conditions
V3 CI/CD Pipeline / Publish to npm (alpha) (push) Blocked by required conditions
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / macos-latest / Node 22 (push) Waiting to run
V3 CI/CD Pipeline / Plugin hooks smoke / macos-latest / Node 22 (push) Waiting to run
ADR-166 MCP Bridge Security Lock / Static-source security lock (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / Compose default binds loopback + Mongo has auth (push) Failing after 2s
CodeQL Advanced / Analyze (rust) (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / plugin-agent-federation bindHost default (push) Failing after 1s
ADR-166 MCP Bridge Security Lock / Runtime behavior — 401 + terminal gate + fail-closed (push) Failing after 4s
business-pods-smoke / smoke (push) Failing after 1s
all-plugins-smoke / smoke-all (push) Failing after 2s
CI/CD Pipeline / Security & Code Quality (push) Failing after 1s
CI/CD Pipeline / Test Suite (ubuntu-latest) (push) Failing after 1s
CI/CD Pipeline / Build & Package (macos-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (ubuntu-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (windows-latest) (push) Has been skipped
CI/CD Pipeline / Deploy & Release (push) Waiting to run
CI/CD Pipeline / CI Status (push) Waiting to run
CI/CD Pipeline / Documentation & Examples (push) Failing after 1s
Clone Tracker (14-day rolling) / Snapshot clones for ruflo ecosystem (push) Failing after 1s
CodeQL Advanced / Analyze (actions) (push) Failing after 1s
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 1s
federation-peer-rust / stable-noop (push) Failing after 1s
metaharness-ci / score (push) Failing after 1s
metaharness-ci / router-compat (push) Failing after 0s
metaharness-ci / similarity-tests (push) Failing after 0s
no-agentbbs-smoke / smoke-without-agentbbs (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (windows-latest) (push) Has been skipped
codex-integration-audit / Codex integration audit (push) Failing after 1s
helpers-manifest-guard / guard (push) Failing after 1s
🔗 Cross-Agent Integration Tests / 🤝 Agent Coordination Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🧠 Memory Sharing Integration (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🛡️ Fault Tolerance Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / ⚡ Performance Integration Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / 📊 Integration Test Report (push) Waiting to run
metaharness-ci / mcp-scan (push) Failing after 1s
metaharness-ci / eject-dryrun (push) Failing after 1s
metaharness-ci / metaharness-real-data (push) Failing after 0s
no-cli-optdep-bloat-2561 / guard (push) Failing after 1s
no-metaharness-smoke / smoke-without-metaharness (push) Failing after 1s
no-phantom-agentic-flow-subpath / guard (push) Failing after 1s
🔄 Automated Rollback Manager / 🚨 Failure Detection (push) Failing after 1s
V3 CI/CD Pipeline / Plugin hooks smoke / ubuntu-latest / Node 22 (push) Failing after 1s
V3 CI/CD Pipeline / ruflo-graph-intelligence build + test smoke (#2044, ADR-123) (push) Failing after 1s
CVE Audit Gate / Audit root (critical-blocking) (push) Failing after 2s
cost-tracker-smoke / smoke (push) Failing after 3s
oia-audit-weekly / audit (push) Failing after 2s
ruflo-agent-smoke / ruflo-agent structural smoke (push) Failing after 1s
📊 Status Badges Update / 📊 Update Status Badges (push) Failing after 1s
V3 CI/CD Pipeline / Static regression guards (#2267 YAML + (push) Failing after 1s
V3 CI/CD Pipeline / Test V3 Packages (push) Failing after 0s
V3 CI/CD Pipeline / agent_execute provider routing smoke (#2042) (push) Failing after 0s
CVE Audit Gate / Audit v3 (critical-blocking) (push) Failing after 1s
federation-peer-rust / stable-native (push) Failing after 2s
🔗 Cross-Agent Integration Tests / 🚀 Integration Test Setup (push) Failing after 2s
neural-trader-smoke / runtime-smoke (push) Failing after 1s
🔄 Automated Rollback Manager / 🔍 Pre-Rollback Validation (push) Waiting to run
V3 CI/CD Pipeline / Build V3 (macos-latest) (push) Has been skipped
V3 CI/CD Pipeline / Build V3 (ubuntu-latest) (push) Has been skipped
V3 CI/CD Pipeline / Type Check V3 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 24 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 22 (push) Failing after 2s
V3 CI/CD Pipeline / browser rvf create flag smoke (#2015) (push) Failing after 0s
V3 CI/CD Pipeline / Dependency review (#2046) (push) Has been skipped
V3 CI/CD Pipeline / Supply-chain audit (#2046) (push) Failing after 0s
V3 CI/CD Pipeline / witness marker drift smoke (#2021) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader portfolio CG smoke (#2068, ADR-126 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader backtest signing smoke (#2068, ADR-126 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / kg-extract type-import classification smoke (#2049) (push) Failing after 0s
V3 CI/CD Pipeline / witness verify precondition smoke (#1880) (push) Failing after 2s
V3 CI/CD Pipeline / neural-trader pipeline risk-gate smoke (#2068, ADR-126 Phase 5) (push) Failing after 0s
V3 CI/CD Pipeline / neural-trader feature attribution smoke (#2068, ADR-126 Phase 6) (push) Failing after 0s
V3 CI/CD Pipeline / plugin-registry signature verification smoke (#1922, CWE-347) (push) Failing after 4s
V3 CI/CD Pipeline / memory stats legacy-DB smoke (#2120) (push) Failing after 4s
V3 CI/CD Pipeline / github deprecated actions smoke (#2089, ADR-127 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / graph query + pathfinder smoke (ADR-130 P2+P5) (push) Has been skipped
V3 CI/CD Pipeline / graph trajectory hooks smoke (ADR-130 P3) (push) Has been skipped
V3 CI/CD Pipeline / graph plugin adapter smoke (ADR-130 P4) (push) Has been skipped
V3 CI/CD Pipeline / graph benchmark (ADR-130 P6) (push) Has been skipped
V3 CI/CD Pipeline / statusline generator delegation smoke (#2195) (push) Failing after 1s
V3 CI/CD Pipeline / wizard init regression guard (#2206 (push) Failing after 1s
V3 CI/CD Pipeline / memory no-stray-db smoke (ADR-125 P7) (push) Failing after 1s
V3 CI/CD Pipeline / github-safe injection smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github actions pin smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github attribution opt-in smoke (#2089, ADR-127 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / pre-bash hook safety smoke (#2017) (push) Failing after 1s
V3 CI/CD Pipeline / Memory import smoke / ubuntu-latest (push) Failing after 0s
V3 CI/CD Pipeline / MCP protocol smoke / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / ruvllm WASM auto-init smoke (#2086) (push) Failing after 4s
V3 CI/CD Pipeline / MCP paired-tool round-trip smoke (#1889) (push) Failing after 1s
V3 CI/CD Pipeline / Plugin package install-safety (#1902/#1903/#1904) (push) Failing after 1s
V3 CI/CD Pipeline / Tool description discoverability (ADR-112) (push) Failing after 3s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (22) (push) Failing after 1s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (24) (push) Failing after 1s
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Vector-index dimension audit (#1947) (push) Failing after 0s
V3 CI/CD Pipeline / Hook-command install safety (#1921) (push) Failing after 1s
V3 CI/CD Pipeline / ToolOutputGuardrail smoke (ADR-131, (push) Failing after 1s
V3 CI/CD Pipeline / init-bundle invariants smoke (#2095, ADR-128 Phase 5) (push) Failing after 1s
V3 CI/CD Pipeline / wasm provider bridge smoke (ADR-129 P1) (push) Failing after 2s
V3 CI/CD Pipeline / wasm gallery CRUD smoke (ADR-129 P3) (push) Failing after 1s
V3 CI/CD Pipeline / wasm plugin bridge smoke (ADR-129 P4) (push) Failing after 0s
V3 CI/CD Pipeline / wasm compose smoke (ADR-129 P2) (push) Failing after 4s
V3 CI/CD Pipeline / graph schema smoke (ADR-130 P1) (push) Failing after 0s
Validate Marketplace / validate (push) Failing after 1s
🔍 Verification Pipeline / 🚀 Setup Verification (push) Failing after 1s
🔍 Verification Pipeline / 🛡️ Security Verification (push) Has been skipped
🔍 Verification Pipeline / 📝 Code Quality (push) Has been skipped
🔍 Verification Pipeline / 🧪 Test Verification (${{ matrix.os }}, Node ${{ matrix.node }}) (push) Has been skipped
🔍 Verification Pipeline / 🏗️ Build Verification (push) Has been skipped
🔍 Verification Pipeline / 📚 Documentation Verification (push) Has been skipped
🔍 Verification Pipeline / ⚡ Performance Verification (push) Waiting to run
🔍 Verification Pipeline / 📊 Verification Report (push) Waiting to run
CVE Audit Gate / High-severity report (warn only) (push) Has been cancelled
359 lines
17 KiB
JavaScript
Executable File
359 lines
17 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
/**
|
|
* Fix-invariants audit — guards against silent regression of the recent
|
|
* critical fixes that don't have a dedicated audit script.
|
|
*
|
|
* Each entry pins one or more substrings/regexes that MUST exist in a
|
|
* specific source file. The substring is the load-bearing line from the
|
|
* fix — if a refactor accidentally removes it, the bug returns silently
|
|
* (no test failure, just wrong runtime behavior).
|
|
*
|
|
* This is intentionally a presence-check (not a behavior test). Behavior
|
|
* is covered by the dedicated audits (audit-vector-dim, audit-hook-
|
|
* handler-prompt) and unit tests; this script is the cheap last-mile
|
|
* guard for fixes whose dedicated test wasn't worth writing alone.
|
|
*
|
|
* Usage:
|
|
* node scripts/audit-fix-invariants.mjs # exit 1 on any miss
|
|
* node scripts/audit-fix-invariants.mjs --json # machine-readable report
|
|
*/
|
|
|
|
import { readFileSync, existsSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
|
|
const REPO_ROOT = process.cwd();
|
|
const JSON_OUT = process.argv.includes('--json');
|
|
|
|
/**
|
|
* Each entry: a fix-issue, the file the invariant lives in, and either a
|
|
* `substring` (must appear verbatim) or a `regex` (must match). Add a
|
|
* short `why` so the failure message tells the next developer what
|
|
* runtime behavior breaks if they remove the line.
|
|
*
|
|
* @typedef {Object} Invariant
|
|
* @property {string} issue — e.g. '#1945' (for failure messages)
|
|
* @property {string} file — repo-relative path
|
|
* @property {string} [substring] — must appear verbatim
|
|
* @property {RegExp} [regex] — must match somewhere in the file
|
|
* @property {string} why — what breaks if this line is removed
|
|
*/
|
|
/** @type {Invariant[]} */
|
|
const INVARIANTS = [
|
|
// #1939 — Win32 cwd → Claude Code slug
|
|
{
|
|
issue: '#1939',
|
|
file: 'v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts',
|
|
regex: /\/\^\[A-Za-z\]:\[\\\\\/\]\//,
|
|
why: 'Win32 slug candidate regex (`^[A-Za-z]:[\\/]`) — without it, memory_import_claude({allProjects:false}) returns 0 on Win32 paths like `C:\\Users\\…\\Claude Stuff`.',
|
|
},
|
|
{
|
|
issue: '#1939',
|
|
file: 'v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts',
|
|
substring: "replace(/[:\\\\/]/g, '-')",
|
|
why: 'Win32 slug normalization — drops `:` / `\\` / `/` so `C:\\Users\\…\\Claude Stuff` → `C--Users-…-Claude-Stuff`.',
|
|
},
|
|
|
|
// #1941 — provision per-namespace vector_indexes row before entry insert
|
|
{
|
|
issue: '#1941',
|
|
file: 'v3/@claude-flow/cli/src/memory/memory-bridge.ts',
|
|
substring: 'INSERT OR IGNORE INTO vector_indexes (id, name, dimensions)',
|
|
why: 'Per-namespace vector_indexes provisioning in bridgeStoreEntry — without it, memory_search({namespace:"X"}) returns 0 for any non-default namespace.',
|
|
},
|
|
{
|
|
issue: '#1941',
|
|
file: 'v3/@claude-flow/cli/src/memory/memory-initializer.ts',
|
|
substring: 'INSERT OR IGNORE INTO vector_indexes (id, name, dimensions)',
|
|
why: 'Per-namespace vector_indexes provisioning in storeEntry (sql.js fallback) — same root cause as the bridge path; one needs both branches.',
|
|
},
|
|
|
|
// #1943 — settings-generator project-local OR $HOME probe
|
|
{
|
|
issue: '#1943',
|
|
file: 'v3/@claude-flow/cli/src/init/settings-generator.ts',
|
|
substring: '[ -f "$D/',
|
|
why: 'POSIX sh probe in hookCmd() — without it, global-install hook paths anchor at `${CLAUDE_PROJECT_DIR}` only and every Bash/Edit/Session hook fires MODULE_NOT_FOUND.',
|
|
},
|
|
{
|
|
issue: '#1943',
|
|
file: 'v3/@claude-flow/cli/src/init/settings-generator.ts',
|
|
substring: 'IF EXIST',
|
|
why: 'Windows `cmd /c IF EXIST … ELSE …` fallback — Win32 equivalent of the sh probe.',
|
|
},
|
|
|
|
// #1945 / #1946 — memory bridge + doctor honor CLAUDE_FLOW_MEMORY_PATH
|
|
{
|
|
issue: '#1945',
|
|
file: 'v3/@claude-flow/cli/src/memory/memory-bridge.ts',
|
|
substring: 'getMemoryRoot',
|
|
why: 'getDbPath() routes through getMemoryRoot() — without it, the bridge hard-codes `<cwd>/.swarm/memory.db` and CLI store writes to a different file than memory init created.',
|
|
},
|
|
{
|
|
issue: '#1946',
|
|
file: 'v3/@claude-flow/cli/src/commands/doctor.ts',
|
|
substring: 'getMemoryRoot',
|
|
why: 'doctor.checkMemoryDatabase() routes through getMemoryRoot() — without it, doctor reports "Not initialized" on any DB at a non-default path.',
|
|
},
|
|
|
|
// #1951 — statusline reads installed version from plugin package.json
|
|
{
|
|
issue: '#1951',
|
|
file: 'v3/@claude-flow/cli/.claude/helpers/statusline.cjs',
|
|
substring: 'RUFLO_VERSION',
|
|
why: 'Startup version-probe variable in the deployed statusline — without it the header reverts to a hard-coded `RuFlo V3.5`.',
|
|
},
|
|
{
|
|
issue: '#1951',
|
|
file: 'v3/@claude-flow/cli/.claude/helpers/statusline.cjs',
|
|
// Regex matches the path.join(home, '.claude', 'plugins', 'marketplaces', 'ruflo', …) form.
|
|
// The original substring form happened to hit because of a comment in the v3 snapshot,
|
|
// not the actual code path; switch to a regex that catches the real call site.
|
|
regex: /['"]marketplaces['"]\s*,\s*['"]ruflo['"]/,
|
|
why: 'Plugin-install candidate path probed first — without it, plugin users always fall through to the hardcoded default.',
|
|
},
|
|
{
|
|
issue: '#1951',
|
|
file: '.claude/helpers/statusline.cjs',
|
|
regex: /['"]marketplaces['"]\s*,\s*['"]ruflo['"]/,
|
|
why: 'Same plugin-install candidate in the root statusline copy.',
|
|
},
|
|
{
|
|
issue: '#1951',
|
|
file: 'v3/@claude-flow/cli/src/init/statusline-generator.ts',
|
|
regex: /['"]marketplaces['"]\s*,\s*['"]ruflo['"]/,
|
|
why: 'Same plugin-install candidate in the init template that generates project-local statuslines.',
|
|
},
|
|
|
|
// #1953 — hooks_pretrain code-file budget + code-dir-first traversal
|
|
{
|
|
issue: '#1953',
|
|
file: 'v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts',
|
|
substring: 'codeFilesScanned',
|
|
why: 'Separate code-file budget counter — without it, the 50-file budget is burned by .md/.yaml/.db files and patternsExtracted: 0 on docs-heavy repos.',
|
|
},
|
|
|
|
// #1968 — daemon launcher forwards --workers / --headless / --sandbox
|
|
{
|
|
issue: '#1968',
|
|
file: 'v3/@claude-flow/cli/src/commands/daemon.ts',
|
|
regex: /forkArgs\.push\(['"]--workers['"]/,
|
|
why: 'Daemon launcher forwards --workers to the forked child — without it, `daemon start --workers map` silently uses the default worker set.',
|
|
},
|
|
{
|
|
issue: '#1968',
|
|
file: 'v3/@claude-flow/cli/src/commands/daemon.ts',
|
|
regex: /forkArgs\.push\(['"]--headless['"]\)/,
|
|
why: 'Daemon launcher forwards --headless — same family as the --workers gap.',
|
|
},
|
|
|
|
// #1989 — statusline previously guarded raw SQLite header reads against
|
|
// RFE1-encrypted memory.db (the bug rendered 3.3B `patterns` and cascaded
|
|
// into fake DDD 5/5 / 100% / 🧠 100%). Superseded by #2196's delegation
|
|
// refactor: statusline-generator.ts no longer reads .swarm/memory.db
|
|
// bytes directly — it delegates to `hooks-statusline --json`, which
|
|
// queries AgentDB via the typed SDK and never touches raw SQLite pages.
|
|
// The regression vector is closed by ARCHITECTURE: if a future refactor
|
|
// reintroduces raw-bytes reading from a memory.db path, the #2196 guard
|
|
// (presence of the delegation pattern) catches it before the SQLite
|
|
// magic-check would ever be relevant. See ruvnet/ruflo#2216 for the
|
|
// user-deployed (pre-#2196) statusline still having the bug.
|
|
{
|
|
issue: '#2196',
|
|
file: 'v3/@claude-flow/cli/src/init/statusline-generator.ts',
|
|
regex: /hooks[- ]statusline|hooksStatusline/,
|
|
why: 'Statusline-generator must delegate to hooks-statusline rather than re-implementing memory.db readers (#2195/#1989 supersession). Without delegation, the regenerated statusline.cjs goes back to raw-bytes reading which broke for encrypted RFE1 DBs.',
|
|
},
|
|
|
|
// #1987 — memory stats uses persistent HNSW count from MCP tool, not
|
|
// the in-process JS state (which is always 0 from a fresh CLI invocation).
|
|
{
|
|
issue: '#1987',
|
|
file: 'v3/@claude-flow/cli/src/commands/memory.ts',
|
|
substring: 'statsResult.entriesWithEmbeddings',
|
|
why: 'memory stats reads persistent entriesWithEmbeddings, not in-process hnsw.entryCount. Without this, `memory stats` shows HNSW (0 entries) even when the DB has thousands of vectors.',
|
|
},
|
|
|
|
// #1948 — Windows-specific statusLine command (no `sh` required)
|
|
{
|
|
issue: '#1948',
|
|
file: 'v3/@claude-flow/cli/src/init/settings-generator.ts',
|
|
regex: /process\.platform === ['"]win32['"]/,
|
|
why: 'Platform-aware statusLine emission. On native Windows we emit `node -e "…"` instead of `sh -c …` so missing/mangled-quoting `sh` no longer produces stray repo-root files.',
|
|
},
|
|
|
|
// #1937 — exclusion patterns for memory_import_claude (voice-fidelity)
|
|
{
|
|
issue: '#1937',
|
|
file: 'v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts',
|
|
substring: 'excludeFilePatterns',
|
|
why: 'memory_import_claude accepts excludeFilePatterns (glob) for voice-fidelity / persona-restricted operators. Per-file granularity beyond the coarse allProjects:true/false.',
|
|
},
|
|
|
|
// #1921 — override @opentelemetry/core to dodge arborist Invalid Version
|
|
{
|
|
issue: '#1921',
|
|
file: 'package.json',
|
|
substring: '"@opentelemetry/core": ">=2.8.0"',
|
|
why: 'overrides entry for @opentelemetry/core (originally an exact 1.25.1 pin, raised to a >=2.8.0 floor in #2547 for the OTel 2.x audit fix). Keeping a single resolvable @opentelemetry/core in overrides eliminates the npm 10.8.x arborist `Invalid Version: ` placeholder that fails every `npx claude-flow@alpha …` install (including all 5 hook fires). Do not delete the override — retune the range instead.',
|
|
},
|
|
|
|
// #1910 — MCP stdio mode protects stdout from stray console.log
|
|
{
|
|
issue: '#1910',
|
|
file: 'v3/@claude-flow/cli/src/mcp-server.ts',
|
|
substring: 'process.env.MCP_STDIO_MODE',
|
|
why: 'stdio MCP server hijacks console.log/info/debug → stderr so lazy-loaded module diagnostics never corrupt the JSON-RPC stream. Without this, hooks_route lazy-loads transformers.js/ONNX whose init prints to stdout and closes the Codex transport mid-batch.',
|
|
},
|
|
{
|
|
issue: '#1910',
|
|
file: 'v3/@claude-flow/cli/src/mcp-server.ts',
|
|
substring: 'uncaughtException',
|
|
why: 'stdio MCP server installs uncaughtException + unhandledRejection handlers so a lazy-loaded native init failure goes to stderr instead of crashing the transport silently.',
|
|
},
|
|
|
|
// #1872 — SwarmCoordinator scaleAgents targets total, executeTask catches throws
|
|
{
|
|
issue: '#1872',
|
|
file: 'v3/src/coordination/application/SwarmCoordinator.ts',
|
|
substring: 'TARGET TOTAL',
|
|
why: 'scaleAgents({type, count}) treats count as the target total, not a delta. Without this, repeated scaleAgents calls accumulate (1 → 4 → 6 instead of 1 → 4 → 2).',
|
|
},
|
|
{
|
|
issue: '#1872',
|
|
file: 'v3/src/coordination/application/SwarmCoordinator.ts',
|
|
regex: /try\s*\{[\s\S]{0,200}agent\.executeTask\(task\)/,
|
|
why: 'executeTask wraps agent.executeTask in try/catch so a thrown error becomes a structured TaskResult{status:"failed", error} instead of crashing the swarm.',
|
|
},
|
|
|
|
// ADR-120 Step 2 — midstream-aware federation loader prefers
|
|
// midstreamer's real QUIC build when MIDSTREAMER_QUIC_NATIVE=1,
|
|
// falls back to agentic-flow's loader otherwise. Without this
|
|
// invariant, a refactor could silently re-introduce the bare
|
|
// loadQuicTransport import that bypasses the midstream preference.
|
|
{
|
|
issue: 'ADR-120',
|
|
file: 'v3/@claude-flow/plugin-agent-federation/src/transport/midstream-aware-loader.ts',
|
|
substring: 'MIDSTREAMER_QUIC_NATIVE',
|
|
why: 'midstream-aware loader probes MIDSTREAMER_QUIC_NATIVE first; without this env flag check, the federation transport silently stays on agentic-flow even after midstream@0.3.0 ships real QUIC.',
|
|
},
|
|
{
|
|
issue: 'ADR-120',
|
|
file: 'v3/@claude-flow/plugin-agent-federation/src/plugin.ts',
|
|
substring: 'loadFederationTransport',
|
|
why: 'plugin.ts dispatches through the midstream-aware loader. Reverting to the bare loadQuicTransport import bypasses the ADR-120 preference layer entirely.',
|
|
},
|
|
|
|
// Issue #1949 — agentic-flow is an OPTIONAL peer dependency, not a
|
|
// hard runtime dep. Hardened npm registries that block the deep
|
|
// koa-router → cookies@0.9.1 transitive chain (under agentic-flow ->
|
|
// fastmcp -> mcp-proxy -> pipenet -> koa) can otherwise reject the
|
|
// plugin install with a 403 even on a clean checkout.
|
|
{
|
|
issue: '#1949',
|
|
file: 'v3/@claude-flow/plugin-agent-federation/package.json',
|
|
regex: /"peerDependencies"[\s\S]*?"agentic-flow"/,
|
|
why: 'agentic-flow must be a peer dependency (not a hard runtime dep) so hardened npm registries that block cookies@0.9.1 transitively can still install the federation plugin (issue #1949).',
|
|
},
|
|
{
|
|
issue: '#1949',
|
|
file: 'v3/@claude-flow/plugin-agent-federation/package.json',
|
|
regex: /"peerDependenciesMeta"[\s\S]*?"agentic-flow"[\s\S]*?"optional"\s*:\s*true/,
|
|
why: 'agentic-flow must be marked optional in peerDependenciesMeta so npm doesn\'t warn or fail when the peer is missing (#1949).',
|
|
},
|
|
{
|
|
issue: '#1949',
|
|
file: 'v3/@claude-flow/plugin-agent-federation/src/transport/midstream-aware-loader.ts',
|
|
substring: "import type {",
|
|
why: 'midstream-aware-loader.ts must use TYPE-ONLY imports from agentic-flow (which are erased at compile time). Reverting to a static value import would force users to install agentic-flow even when only midstreamer is needed (#1949).',
|
|
},
|
|
{
|
|
issue: '#1949',
|
|
file: 'v3/@claude-flow/plugin-agent-federation/src/transport/midstream-aware-loader.ts',
|
|
substring: "loadAgenticFlowQuicTransport",
|
|
why: 'midstream-aware-loader.ts must lazy-load agentic-flow via loadAgenticFlowQuicTransport so it can degrade gracefully when the peer dep is absent (#1949).',
|
|
},
|
|
|
|
// ADR-120 Step 3 — ruflo-federation-peer Rust crate composes the
|
|
// QUIC transport (midstreamer-quic) with the AIMDS 3-gate pipeline.
|
|
{
|
|
issue: 'ADR-120',
|
|
file: 'v3/crates/ruflo-federation-peer/Cargo.toml',
|
|
substring: 'name = "ruflo-federation-peer"',
|
|
why: 'Step 3 crate name pin. The crate composes midstreamer-quic + aimds-* into a single Rust process per federation peer.',
|
|
},
|
|
{
|
|
issue: 'ADR-120',
|
|
file: 'v3/crates/ruflo-federation-peer/Cargo.toml',
|
|
substring: 'midstreamer-quic = { version = "0.3.0"',
|
|
why: 'Step 3 crate pins midstreamer-quic@0.3.0 (ruvnet/midstream PR #82 added the QuicTransport embedding trait this crate needs for its TransportProvider blanket impl).',
|
|
},
|
|
{
|
|
issue: 'ADR-120',
|
|
file: 'v3/crates/ruflo-federation-peer/Cargo.toml',
|
|
substring: 'aimds-core = { version = "0.2.0"',
|
|
why: 'Step 3 crate pins aimds-core@0.2.0 (ruvnet/midstream PR #82 added the SafetyGate composing trait this crate adapts in native_gate).',
|
|
},
|
|
{
|
|
issue: 'ADR-120',
|
|
file: 'v3/crates/ruflo-federation-peer/src/lib.rs',
|
|
substring: 'midstreamer_quic::{QuicConnection, QuicTransport}',
|
|
why: 'Step 3 native_transport must import the upstream QuicTransport trait (not just QuicConnection) so MidstreamerTransport is generic over any embedder-supplied transport.',
|
|
},
|
|
{
|
|
issue: 'ADR-120',
|
|
file: 'v3/crates/ruflo-federation-peer/src/lib.rs',
|
|
substring: 'aimds_core::{PromptInput, SafetyGate as AimdsSafetyGate, SafetyVerdict as AimdsVerdict}',
|
|
why: 'Step 3 native_gate must adapt aimds_core::SafetyGate to the peer-local SafetyGate trait — without this import the adapter degrades to a typed placeholder.',
|
|
},
|
|
{
|
|
issue: 'ADR-120',
|
|
file: 'v3/crates/ruflo-federation-peer/src/lib.rs',
|
|
substring: 'pub trait TransportProvider',
|
|
why: 'Step 3 trait surface: TransportProvider abstracts the QUIC backend so the Peer dispatch loop is testable without the upstream Rust deps materialized.',
|
|
},
|
|
{
|
|
issue: 'ADR-120',
|
|
file: 'v3/crates/ruflo-federation-peer/src/lib.rs',
|
|
substring: 'pub trait SafetyGate',
|
|
why: 'Step 3 trait surface: SafetyGate abstracts the AIMDS 3-gate pipeline so the Peer dispatch loop is testable without the upstream aimds-* deps materialized.',
|
|
},
|
|
];
|
|
|
|
const offenders = [];
|
|
for (const inv of INVARIANTS) {
|
|
const p = join(REPO_ROOT, inv.file);
|
|
if (!existsSync(p)) {
|
|
offenders.push({ ...inv, error: 'file missing' });
|
|
continue;
|
|
}
|
|
const src = readFileSync(p, 'utf8');
|
|
const found = inv.substring
|
|
? src.includes(inv.substring)
|
|
: inv.regex
|
|
? inv.regex.test(src)
|
|
: false;
|
|
if (!found) {
|
|
offenders.push({ ...inv, error: 'invariant missing' });
|
|
}
|
|
}
|
|
|
|
if (JSON_OUT) {
|
|
process.stdout.write(JSON.stringify({ checked: INVARIANTS.length, offenders }, null, 2) + '\n');
|
|
process.exit(offenders.length === 0 ? 0 : 1);
|
|
}
|
|
|
|
console.log(`fix-invariants audit — ${INVARIANTS.length} invariants across ${new Set(INVARIANTS.map(i => i.file)).size} file(s)`);
|
|
if (offenders.length === 0) {
|
|
console.log(` ✓ all invariants present`);
|
|
process.exit(0);
|
|
}
|
|
|
|
console.error(`\n ✗ ${offenders.length} missing invariant(s):`);
|
|
for (const o of offenders) {
|
|
console.error(`\n [${o.issue}] ${o.file}`);
|
|
console.error(` ${o.error}: ${o.substring ?? o.regex}`);
|
|
console.error(` why this matters: ${o.why}`);
|
|
}
|
|
console.error('\n If the fix moved to a different file or got refactored, update the invariant in scripts/audit-fix-invariants.mjs to point at the new location — do NOT delete it without confirming the regression is impossible by another mechanism.');
|
|
process.exit(1);
|