Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(ci): run every root-suite test file and stop accepting a crashed run as a pass

Dragan Spiridonovde829e6faa47
diff --git a/.github/workflows/v3-ci.yml b/.github/workflows/v3-ci.yml
index 1c67101a0f..a9646facf3 100644
--- a/.github/workflows/v3-ci.yml
+++ b/.github/workflows/v3-ci.yml
@@ -391,14 +391,38 @@ jobs:
# known issue tracked elsewhere and shouldn't block CI when the
# actual test outcomes were captured. Any other non-zero exit
# (real test failures, vitest errors, etc.) still fails the job.
+ #
+ # "After all tests reported" is checked, not assumed. A crash mid-run
+ # prints no summary, and accepting it passed this job on runs that had
+ # executed a handful of the suite's files. The text summary is not
+ # enough on its own: tests that spawn vitest print their own "Test
+ # Files" lines into this log. So the run also writes a JSON report,
+ # which vitest emits once, when the top-level run ends; a crash before
+ # then leaves no report. A 139 is tolerated only when that report
+ # exists, counts at least one suite and says success (no failed files
+ # or tests), and the log has no unhandled or close-time errors, whose
+ # exit status the segfault replaces. Limits: a gracefully interrupted
+ # run also writes a report (in CI that is a cancelled job anyway), and
+ # coverage is written after the report, so it may be incomplete.
run: |
+ REPORT="$RUNNER_TEMP/vitest-report.json"
+ rm -f "$REPORT"
set +e
- pnpm test
- EXIT=$?
+ # The bin shim execs node, so a segfault surfaces as 139. Through
+ # `pnpm exec` a signalled child is reported as exit 1 instead.
+ ./node_modules/.bin/vitest run --reporter=default --reporter=json --outputFile.json="$REPORT" 2>&1 | tee "$RUNNER_TEMP/vitest-output.log"
+ EXIT=${PIPESTATUS[0]}
set -e
if [ "$EXIT" -eq 139 ]; then
- echo "::warning::pnpm test exited with SIGSEGV (139) after tests completed — tolerated as native-binding cleanup race"
- exit 0
+ # Count error lines explicitly: a scanner failure leaves ERRORS empty
+ # and fails closed instead of reading as "no errors".
+ ERRORS="$(sed -E 's/\x1b\[[0-9;]*m//g' "$RUNNER_TEMP/vitest-output.log" | grep -cE '^ *Errors +[0-9]+ errors?|Unhandled Errors|error during close' || true)"
+ if [ -s "$REPORT" ] && [ -s "$RUNNER_TEMP/vitest-output.log" ] && [ "$ERRORS" = "0" ] \
+ && node -e 'const r=JSON.parse(require("fs").readFileSync(process.argv[1],"utf8")); process.exit(r.success===true && r.numTotalTestSuites>0 && r.numFailedTestSuites===0 && r.numFailedTests===0 ? 0 : 1)' "$REPORT"; then
+ echo "::warning::vitest exited with SIGSEGV (139) after it reported a passing run with no unhandled errors — tolerated as a shutdown crash"
+ exit 0
+ fi
+ echo "::error::vitest exited with SIGSEGV (139) without a passing report (report present: $([ -s "$REPORT" ] && echo yes || echo no); error lines: ${ERRORS:-unreadable}); the suite did not finish, or it reported failures or unhandled errors"
fi
exit "$EXIT"
diff --git a/v3/vitest.config.ts b/v3/vitest.config.ts
index 793df3cc2a..722e74a8f4 100644
--- a/v3/vitest.config.ts
+++ b/v3/vitest.config.ts
@@ -9,6 +9,42 @@
import { defineConfig } from 'vitest/config';
import path from 'path';
+// Quarantine: files that fail on main once the whole suite actually runs. Until
+// the collection and pool fixes below, CI never reached them (it stopped after
+// 7-9 files), so these are not new regressions; they were invisible. Each is
+// excluded by name so the rest of the suite gates again. Remove an entry when it
+// passes. Grouped by the failure seen on a full local run with CI=true (Node 24,
+// linux); files that skip themselves under CI=true are not listed.
+const KNOWN_FAILING = [
+ // A path or package the test expects no longer resolves.
+ '@claude-flow/cli/__tests__/mcp-tool-filter-2726.test.ts', // reads v3/bin/cli.js
+ '@claude-flow/cli/__tests__/pq-validation.test.ts', // imports memory/src/hnsw-index.js
+ 'mcp/__tests__/session-tools.test.ts', // 'zod' does not resolve from v3/mcp
+ 'mcp/__tests__/system-tools.test.ts', // 'zod' does not resolve from v3/mcp
+ 'mcp/__tests__/task-tools.test.ts', // 'zod' does not resolve from v3/mcp
+ // Time out (30 s per test) loading a model; 2 of 47 and 10 of 31 tests fail.
+ '@claude-flow/hooks/src/__tests__/guidance-provider.test.ts',
+ '@claude-flow/hooks/src/__tests__/reasoningbank.test.ts',
+ // Assertion failures, not yet triaged (failed / total tests in the file).
+ '@claude-flow/cli/__tests__/adr-390-router-embedder.test.ts', // 1/11
+ '@claude-flow/cli/__tests__/hive-mind-gate-transport-e2e.test.ts', // 3/4
+ '@claude-flow/cli/__tests__/init-dual-native-2636-2637.test.ts', // 1/3
+ '@claude-flow/cli/__tests__/memory-bridge-failure-diagnostics.test.ts', // 4/13
+ '@claude-flow/cli/__tests__/memory-concurrent-write-loss-2878.test.ts', // 1/6
+ '@claude-flow/cli/__tests__/memory-search-scores-3327.test.ts', // 3/8
+ '@claude-flow/cli/__tests__/mods/mods-guidance-e2e.test.ts', // 14/47
+ '@claude-flow/cli/__tests__/plugins-install-scripts-3557.test.ts', // 2/2
+ '@claude-flow/cli/__tests__/plugins-upgrade-trust-gate.test.ts', // 4/4
+ '@claude-flow/cli/__tests__/router-cjs-esm-3555.test.ts', // 1/9
+ '@claude-flow/mcp/__tests__/http-transport-auth.test.ts', // 5/26
+ '__tests__/integration/swarm-integration.test.ts', // 1/15
+ // Flaky under a parallel run: wall-clock or heap thresholds measured while
+ // ~16 other files run. Each passes alone; the whole file is excluded for one
+ // assertion, so the fix is in the test (relax or skip the timing under CI).
+ '@claude-flow/plugins/__tests__/ruvector-streaming.test.ts', // <20 MB heap growth, no forced GC; 1/26
+ '@claude-flow/neural/__tests__/algorithms.test.ts', // Decision Transformer train < 100 ms; 1/44
+];
+
export default defineConfig({
test: {
// Test environment
@@ -25,13 +61,23 @@ export default defineConfig({
'@claude-flow/**/__tests__/**/*.spec.ts',
'mcp/__tests__/**/*.test.ts',
'mcp/__tests__/**/*.spec.ts',
+ // @claude-flow/shared keeps its specs beside the source (the EventStore
+ // snapshot regression for #3865 among them); no other config collects them.
+ '@claude-flow/shared/src/**/*.test.ts',
],
- // Exclude patterns
+ // Exclude patterns. These must match at any depth: pnpm links every workspace
+ // package into its dependents' node_modules, so a bare 'node_modules' let the
+ // '@claude-flow/**' globs collect the same files again through those links
+ // (3,228 files collected, 608 distinct).
exclude: [
- 'node_modules',
- 'dist',
- '.git',
+ '**/node_modules/**',
+ '**/dist/**',
+ '**/.git/**',
+ // node:test files (run with `npx tsx --test`), not vitest suites: vitest
+ // executes their top level and then reports "No test suite found".
+ '__tests__/appliance/**',
+ ...KNOWN_FAILING,
],
// Coverage configuration - London School targets
@@ -85,31 +131,19 @@ export default defineConfig({
// Reporter configuration
reporters: ['default'],
- // Parallel execution.
- // Use 'threads' as the default. Briefly tried 'forks' because of
- // exit-time segfaults from native bindings (onnxruntime-node /
- // ruvector / agentic-flow) — but forks expose module-load
- // unhandled rejections more aggressively, causing 12 test files
- // (transformers transitive-importers) to fail with 'No test suite
- // found'. Threads tolerate the rejection and let tests report,
- // and the segfault happens only at process shutdown. CI handles
- // exit code 139 as success when results were reported (see test job).
- pool: 'threads',
- poolOptions: {
- threads: {
- singleThread: false,
- isolate: true,
- },
- forks: {
- singleFork: false,
- isolate: true,
- },
- },
- // Per-file pool override: tests that need process.chdir() must run
- // in a forked subprocess (Node's worker threads forbid chdir).
- poolMatchGlobs: [
- ['**/router-bandit.test.ts', 'forks'],
- ],
+ // Parallel execution: 'forks', one child process per test file.
+ // Four files pass and then segfault (exit 139) when run alone under
+ // 'threads': bug-cluster-2219-2226, mcp-tools-deep, neural-package-bridge
+ // and sona-embeddings-validation. Each loads native bindings (onnxruntime /
+ // ruvector / agentic-flow); the crash comes after their results, consistent
+ // with a native finalizer at teardown. Under 'threads' that teardown happens
+ // mid-suite and kills the whole vitest process: in CI the suite stopped
+ // after 7-9 files with no summary. Under 'forks' it runs to its summary.
+ // The earlier concern that forks turn module-load rejections into 'No test
+ // suite found' no longer reproduces on vitest 4. Forks also allow
+ // process.chdir(), which the old router-bandit poolMatchGlobs entry (an
+ // option vitest 4 removed, along with poolOptions) existed for.
+ pool: 'forks',
// Globals for easier testing
globals: true,