Commit Graph
10 Commits
Author SHA1 Message Date
ruv 4ef02ef12c test(pagerank): skip the sublinear-core cases where the optional package is not installed
The repo-root CI run (npm workspaces) does not install @claude-flow/memory's
optional dependencies, so the backend assertions for sublinear-core failed
there. The in-tree cases still run everywhere; the sublinear-core cases run
in the package's own suite.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-11-09 00:58:08 -05:00
ruv 37eca9892f fix(pagerank): converge MemoryGraph PageRank; fix GraphOperations teleport and weights
MemoryGraph.computePageRank (memory-graph.ts) stopped on a per-node change
below 1e-6 within 50 iterations. On a 10k-node graph it exited after 10
iterations with an L1 error of 1.46e-4 (max 3.95e-7) against an exact
solution. It now stops on the L1 change (default 1e-10, up to 200
iterations): 30 iterations, L1 error 2.76e-11.

GraphOperations.pageRank (plugins gnn.ts) had three mass leaks:
- personalization: nodes missing from the map still got the uniform 1/n
  teleport on top of the personalization weights, so a single-seed run
  summed to 1.98;
- isolated nodes lost their mass (global runs summed to 0.983);
- weighted runs divided by the neighbour count instead of the neighbour's
  total edge weight (scores summed to ~8e12 on a weighted test graph).
Teleport is now the normalized personalization restricted to graph nodes,
dangling mass is redistributed by it, and weights are normalized by
out-strength.

Both use @ruvnet/sublinear-core (^1.0.1, zero deps) as an optional
dependency, loaded lazily via createRequire, with an in-tree fallback of
the same semantics (pagerank.ts, one copy per package).

Tests: both backends sum to 1 and match an independent power iteration
within 1e-9 (global, personalized, weighted, MemoryGraph), and the fallback
is used when the package is absent.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-11-09 00:57:55 -05:00
ordinary being 5988f8e4a0 fix(plugins): reuse captured extension points when rebuilding caches (#4451)
Both registries rebuild extension caches by calling every surviving plugin's register* methods again on a sibling's unregister/reload. The plugin interface documents that these methods run during initialization; non-idempotent implementations can repeat counters, listeners, timers or allocations tied to unrelated plugin churn (#4410 plugins scan).\n\nCapture the raw values returned by each plugin at initialization (and on hot reload), store them on the entry, and rebuild caches by replaying those values. The enhanced registry still runs conflict resolution on every replay, so first/last/namespace/error semantics and ownership maps are preserved without re-invoking plugin code.\n\nRegression tests count registerMCPTools across unregister for both registries, verify conflict replay, and verify hot reload replaces the snapshot. Baseline (sources stashed) fails all count assertions with 2 calls instead of 1; candidate focused suites pass 52/52. Full plugin suite: 475 passed, 3 skipped, 1 pre-existing Windows safePath failure reproduced on baseline.
2026-10-24 00:26:34 -04:00
Rudy Celekli fda46806fa test(quantization): anchor binary recall to a known match 2026-10-13 12:52:21 -04:00
ruv 3438b4085e test: make the timing-sensitive CI tests robust
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-10-07 01:30:37 -04:00
rUv a3dee4ff8b fix(plugins): parameterize gnn.ts SQL generation to close SQL injection gap (#3564)
BaseGNNLayer.toSQL, GraphOperations' kHopNeighborsSQL/shortestPathSQL/
pageRankSQL/communityDetectionSQL, and GNNSQLGenerator's static SQL
builders interpolated schema/table/column identifiers and node id/
algorithm string values directly into executed SQL. TypeScript types
are erased at runtime, so any caller passing through untrusted input
reached executed SQL (CWE-89).

Adds sqlIdent/sqlLiteral/sqlNumber/sqlInt/sqlJson/sqlParamPrefix
helpers mirroring attention.ts's existing sqlNumber/sqlBool hardening
(PR #3530): identifiers are validated against ^[A-Za-z_][A-Za-z0-9_]*$
and quoted, string values are single-quote-escaped, numeric params are
validated finite/integer, and JSON config blobs are escaped before
embedding in a jsonb literal (a `'` inside a config value could
previously break out of the surrounding SQL string).

Adds __tests__/gnn-sql-injection.test.ts (24 tests, mirroring the
existing attention-sql-injection.test.ts pattern): byte-identical SQL
for legitimate input, and a TypeError for each malicious identifier/
value/numeric field. Verified baseline-fails/candidate-passes via
stash isolation (22/25 new tests fail against the unpatched file, all
pass against the fix). Full plugins suite: 473 passed/3 skipped both
before and after, tsc --noEmit clean.

Fixes #3531
2026-09-30 10:22:00 -04:00
ruv 7307d1d86a chore(release): move 18 internal leaf packages from alpha to stable semver
Every @claude-flow/* leaf still on X.Y.Z-alpha.N moves to its stable X.Y.Z
(3.0.0, cli-core 3.7.0, the two plugins 1.0.0), matching the public train's
move to stable at 3.7.0. @claude-flow/embeddings is deliberately excluded:
its registry `latest` (3.0.0-alpha.45) was built from a branch not on main,
and publishing from main would drop 139 exported names.

Validated before publish:
- API surface: each package's main build compared against its published
  `latest` tarball (files, exports/bin keys, exported names). All 18 are
  equal-or-superset; no export removed.
- Every package builds; ~7.8k tests across 17 suites pass (cli-core has no
  suite of its own and is exercised through the CLI's).

Packaging fixes made along the way:
- publishConfig.tag v3alpha/alpha removed so stable versions land on
  `latest` rather than only the legacy channel tag.
- `files` allowlists (dist + README) on the 7 packages that had none. Their
  published tarballs shipped local runtime state: .claude-flow daemon logs
  and pids, settings.json, .swarm/memory.db, headless-worker prompt logs.
  A secret scan of every affected published version found no credentials.
  mcp shrinks from 335 files to 70, and no longer ships the .claude/
  helpers copy that #3411 concerned.
- plugins/providers/testing pointed every `types` condition at a
  nonexistent `.d.js` file; now `.d.ts`, so consumer type resolution works.
- Removed three subpath exports whose targets were never built (plugins
  ./examples/*, performance ./benchmarks/*); they could only throw
  ERR_MODULE_NOT_FOUND.
- Intra-leaf ranges normalised to ^<stable>, including a `file:../security`
  and a `workspace:*` devDependency that npm publish would ship verbatim.

Security: harden attention toSQL against injection (plugins)
The 13 attention SQL builders interpolated caller-supplied vectors and
config values into SQL that AttentionExecutor executes. TypeScript types do
not exist at runtime, so a string element could break out of the quoted
vector literal. Every interpolated value is now proven finite-numeric or
boolean. A differential run of 195 legitimate inputs across all 13
mechanisms produced byte-identical SQL; the new test fails 11/13 on the
original code (which emitted DROP TABLE for 5 payloads) and passes 13/13.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-28 16:54:24 -04:00
Reuvenandclaude-flow 5151aa9b24 fix: monorepo-wide test fixes — all 20 packages green (5,370 tests)
Fixes across 8 packages to achieve 100% test pass rate:

- shared: sql.js getAsObject([]) fix for event-store stats; ESM fs import
- memory: hybrid-backend tests tolerate degraded health status
- embeddings: infinite-loop fix in chunking (overlap >= maxChunkSize);
  euclidean similarity test; vitest config cleanup
- hooks: guidance-provider test timeout (5s → 15s)
- browser: test mock corrected to execFileSync call signature
- plugins: HookBuilder missing when/handle/transform methods; TestPlugin
  state shadowing fix; dep version parsing (name@version); conflict error
  propagation; namespace strategy renames both entries; restoreState API
- integration: getCompactContext DB error handling; topology always
  hierarchical (anti-drift); batch size cap at 5
- aidefence/deployment/integration/providers: local vitest.config.ts
  to discover src/__tests__/ test files

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-28 09:27:25 -04:00
rUvandClaude Opus 4.5 92796a33e6 feat(ruvector): PostgreSQL Bridge with attention, GNN, hyperbolic embeddings (#962)
## Summary
- Complete RuVector PostgreSQL Bridge CLI with 6 subcommands (init, migrate, status, benchmark, optimize, backup)
- pgvector integration for native PostgreSQL vector operations
- Attention mechanisms (self, multi-head, cross-attention) in SQL
- Graph Neural Network operations via SQL functions
- Hyperbolic embeddings (Poincaré ball model) in PostgreSQL
- Int8/Float16 quantization for 3.92x memory reduction
- Streaming support for large datasets
- 7 version-controlled migration scripts
- Added RuVector PostgreSQL Bridge section to README

## Test plan
- [x] All tests pass (484 passed, 7 skipped)
- [x] Build succeeds
- [x] Published to npm as @claude-flow/cli@3.0.0-alpha.121

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 15:15:24 -05:00
rUvandClaude Sonnet 4 6046e1cdd3 checkpoint: File edit:
🚀 Generated with [Claude Code](https://claude.com/claude-code)
📊 V3 Development Progress Checkpoint

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
2026-01-06 01:04:53 +00:00