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

ci: add no-better-sqlite3 install smoke for #1867 regression guard

Reuven3e8781bd2ce7
diff --git a/.github/workflows/v3-ci.yml b/.github/workflows/v3-ci.yml
index 154a7e2b9a..17a0735530 100644
--- a/.github/workflows/v3-ci.yml
+++ b/.github/workflows/v3-ci.yml
@@ -119,6 +119,63 @@ jobs:
name: v3-build-${{ matrix.os }}
path: v3/@claude-flow/*/dist/
+ smoke-install-no-bsqlite:
+ # Regression guard for ruvnet/ruflo#1867 — ensures @claude-flow/memory
+ # installs and loads when better-sqlite3 fails to build (e.g. Node 26
+ # without prebuilds). Reproduces the user-visible failure mode by
+ # installing with --omit=optional.
+ name: Smoke (no better-sqlite3) / Node ${{ matrix.node }}
+ runs-on: ubuntu-latest
+ needs: [test]
+ strategy:
+ fail-fast: false
+ matrix:
+ node: ['22', '24']
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Setup Node.js ${{ matrix.node }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ matrix.node }}
+
+ - name: Build @claude-flow/memory
+ working-directory: v3/@claude-flow/memory
+ run: |
+ npm install --no-audit --no-fund
+ npm run build
+
+ - name: Pack tarball
+ id: pack
+ working-directory: v3/@claude-flow/memory
+ run: |
+ TARBALL=$(npm pack --silent)
+ echo "tarball=$GITHUB_WORKSPACE/v3/@claude-flow/memory/$TARBALL" >> "$GITHUB_OUTPUT"
+
+ - name: Install with --omit=optional (simulates Node 26 native build failure)
+ run: |
+ mkdir -p /tmp/smoke
+ cd /tmp/smoke
+ npm init -y >/dev/null
+ npm pkg set type=module
+ npm install "${{ steps.pack.outputs.tarball }}" --omit=optional --no-audit --no-fund
+
+ - name: Assert better-sqlite3 was NOT installed
+ run: |
+ if [ -d /tmp/smoke/node_modules/better-sqlite3 ]; then
+ echo "FAIL: better-sqlite3 installed despite --omit=optional — smoke setup is wrong"
+ exit 1
+ fi
+ echo "ok: better-sqlite3 absent (regression scenario active)"
+
+ - name: Run smoke script
+ run: |
+ cp v3/@claude-flow/memory/scripts/smoke-no-bsqlite.mjs /tmp/smoke/
+ cd /tmp/smoke
+ node smoke-no-bsqlite.mjs
+
publish:
name: Publish to npm (alpha)
runs-on: ubuntu-latest
diff --git a/v3/@claude-flow/memory/scripts/smoke-no-bsqlite.mjs b/v3/@claude-flow/memory/scripts/smoke-no-bsqlite.mjs
new file mode 100644
index 0000000000..f12415df95
--- /dev/null
+++ b/v3/@claude-flow/memory/scripts/smoke-no-bsqlite.mjs
@@ -0,0 +1,77 @@
+#!/usr/bin/env node
+/**
+ * Regression guard for ruvnet/ruflo#1867.
+ *
+ * Reproduces the user-visible failure mode of "native better-sqlite3 build failed"
+ * (e.g. `npm install` on Node 26 without prebuilds) by installing this package
+ * with `--omit=optional` and asserting:
+ *
+ * 1. The package loads without `better-sqlite3` resolvable
+ * 2. `createDatabase('auto')` selects a working fallback backend
+ * 3. Round-trip store/get works on the fallback
+ * 4. Direct `SQLiteBackend.initialize()` throws a clean error (not MODULE_NOT_FOUND)
+ *
+ * Run via the smoke-install-no-bsqlite CI job — see .github/workflows/v3-ci.yml.
+ */
+
+import { mkdtempSync, rmSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+
+const tmp = mkdtempSync(join(tmpdir(), 'memory-smoke-'));
+const dbPath = join(tmp, 'smoke.db');
+
+let exitCode = 0;
+const fail = (msg) => { console.error(`FAIL: ${msg}`); exitCode = 1; };
+const pass = (msg) => console.log(`ok: ${msg}`);
+
+try {
+ // 1. Package loads without better-sqlite3 resolvable
+ const mod = await import('@claude-flow/memory');
+ pass('package import without better-sqlite3');
+
+ // Sanity: the optional dep should NOT be resolvable in this env
+ let bsqlitePresent = false;
+ try { await import('better-sqlite3'); bsqlitePresent = true; } catch { /* expected */ }
+ if (bsqlitePresent) {
+ fail('better-sqlite3 unexpectedly resolvable — smoke test setup is wrong, not testing the regression');
+ process.exit(1);
+ }
+ pass('better-sqlite3 absent (regression scenario active)');
+
+ // 2. createDatabase('auto') selects a fallback (rvf or sql.js)
+ const db = await mod.createDatabase(dbPath, { provider: 'auto' });
+ await db.initialize?.();
+ pass('createDatabase(auto) + initialize succeeded');
+
+ // 3. Round-trip
+ const ts = Date.now();
+ await db.store({
+ id: 'smoke-1', key: 'k', content: 'v', type: 'episodic', namespace: 'default',
+ tags: [], metadata: {}, accessLevel: 'private',
+ createdAt: ts, updatedAt: ts, version: 1, references: [], accessCount: 0, lastAccessedAt: ts,
+ });
+ const got = await db.get('smoke-1');
+ if (got?.content !== 'v') fail(`round-trip: expected content "v", got "${got?.content}"`);
+ else pass('round-trip store/get on fallback');
+
+ await db.shutdown?.();
+
+ // 4. Direct SQLiteBackend should throw a clean, actionable error
+ try {
+ const sqlite = new mod.SQLiteBackend({ databasePath: ':memory:' });
+ await sqlite.initialize();
+ fail('SQLiteBackend.initialize() unexpectedly succeeded without better-sqlite3');
+ } catch (err) {
+ const msg = err instanceof Error ? err.message : String(err);
+ if (msg.includes("'better-sqlite3'") && msg.toLowerCase().includes('optional')) {
+ pass('SQLiteBackend throws clean actionable error');
+ } else {
+ fail(`SQLiteBackend error message not actionable: ${msg}`);
+ }
+ }
+} finally {
+ rmSync(tmp, { recursive: true, force: true });
+}
+
+process.exit(exitCode);