mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
bcdeed8d1afece0322ed99652ff674dd6b6bfa2d
9
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d0c507e643 |
fix(memory): #1883 + #1884 — WSL path resolution + import-key sanitization + CI guard (#1886)
* fix(memory): #1883 + #1884 — WSL path resolution + import-key sanitization #1883 — memory_import_claude(allProjects=false) returned imported=0 on WSL because project-hash derivation only POSIX-slash-replaced cwd. A WSL bridge running Ruflo with cwd `/mnt/c/Users/x/Project Name` could never match the Windows-host Claude Code project dir `C--Users-x-Project-Name`. Fix: resolveProjectMemoryDir() tries multiple candidate hashes (legacy POSIX, WSL `/mnt/<drive>/`-translated, leading-dash-stripped, space-replaced) and returns the first that exists. Also adds optional `projectPath` input parameter as an explicit override for callers in cross-environment setups. #1884 — memory_import_claude wrote keys built from raw frontmatter `name` and section titles directly to storeEntry, bypassing validateMemoryInput. memory_delete enforces it. Any markdown file with shell-metacharacters in section headings (`(`, `)`, `{`, `}`, `[`, `]`, `<`, `>`, `!`, `#`, etc.) produced keys that imported successfully but could not be deleted through MCP — stranded in the database, requiring direct SQLite intervention. Fix: sanitizeMemoryKey() replaces every char in DANGEROUS_KEY_CHARS with `_` before storeEntry. The set is shared with DANGEROUS_KEY_PATTERN used by validateMemoryInput so write-side and read-side can never drift apart. CI guard (catches the bug class going forward): - plugins/ruflo-core/scripts/test-memory-import.mjs: 12 regression checks covering static dist scan (helpers defined + called from import handler), legacy-code negative-attestation, sanitizer property test against 27 adversarial inputs, WSL-fixture and POSIX-compat candidate-set checks. - .github/workflows/v3-ci.yml: new `memory-import-smoke` job (ubuntu+macos), wired into witness-verify needs[]. - verification/witness-fixes.json: #1883 + #1884 markers (resolve…, sanitize…) — witness-verify cryptographically attests both helpers are present in dist on every PR. Why our verification missed these (and is now closed): - Witness manifest catches drift from a known-good baseline. Both bugs were always there; no drift to detect. Closed via new markers + the static dist scan that asserts call-sites, not just helper presence. - CI matrix has Linux/macOS/Windows runners but no WSL-bridge fixture. Closed via deriveCandidates() unit assertion on synthetic WSL cwd. - No round-trip test for write-path/read-path key invariant. Closed via sanitizer property test on 27 adversarial inputs. Local verification: 12/12 regression guards pass; witness-verify clean (99 fixes pass, signature valid). Closes #1883 Closes #1884 Co-Authored-By: RuFlo <ruv@ruv.net> * ci: memory-import-smoke uses recursive --no-bail build The targeted `--filter @claude-flow/cli... run build` doesn't pull in @claude-flow/swarm, which @claude-flow/cli imports from at TS-compile time (TS6305 — referenced .d.ts not built from source). Switching to the same `pnpm --recursive --no-bail run build || true` pattern that witness-verify uses. The smoke script already fails loudly if the cli dist didn't get produced, so we don't lose signal. Co-Authored-By: RuFlo <ruv@ruv.net> --------- Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
858ce28f7e |
fix(cli): bin/cli.js MCP-stdio auto-detect overrode explicit -t http
Investigating why the #1874 boot smoke kept failing in CI uncovered a separate-but-related cli bug: v3/@claude-flow/cli/bin/cli.js auto-routes any `mcp start *` invocation to stdio mode when stdin isn't a TTY — even when the user explicitly passed `-t http`. Result: every smoke / non-TTY caller silently got stdio regardless of the transport flag. This is the same class as #1874: a "smart default" that overrides explicit user intent, with no test catching it. Yet another example of self-consistent code where everyone agreed on the wrong behaviour. Fix: the MCP auto-detect now defers when explicit `-t <non-stdio>`, `--transport <non-stdio>`, or `--transport=<non-stdio>` is in argv. HTTP transport now starts when requested even from non-TTY contexts (CI smoke, daemonized callers, etc.). Verified locally: $ node bin/cli.js mcp start -t http -p N [OK] MCP Server started — Transport: http (was: stdio) Smoke test simplified ───────────────────── The boot-an-actual-server-and-call-initialize approach hit a secondary issue (in-process HTTP server doesn't keep the process alive after `await mcpServer.start()` returns; needs separate plumbing). For #1874's regression coverage, a static dist scan is sufficient and reliable: assert the protocolVersion assignment is a YYYY-MM-DD spec string, reject the {major,...} object form. Combined with witness markers (#1874-mcp, #1874-shared) attesting the spec strings live in dist, and the corrected unit test in mcp.test.ts using the spec string form, this is three-way coverage of the bug class without flaky integration plumbing. A separate issue tracks the boot-smoke gap (cli's HTTP server process-lifetime); not blocking #1874 closure. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
d065b2d654 |
fix #1874 + add MCP protocol-compliance smoke layer
The bug
───────
@claude-flow/mcp and @claude-flow/shared returned protocolVersion as
{ major, minor, patch } in the initialize response. The MCP spec
requires a YYYY-MM-DD string. Claude Code's Zod validator rejects
the object form with 'Invalid input: expected string, received
object', so HTTP MCP transport users couldn't connect at all.
Fix
───
- MCPProtocolVersion type: interface with major/minor/patch →
type alias for string (both packages).
- Server constants: '2025-11-25' (mcp) and '2024-11-05' (shared).
- Existing unit test in mcp.test.ts also corrected — it was
asserting the wrong shape, so test + prod agreed on a non-spec
format. This is the most important finding from the
'why did validation miss this' investigation.
- README example updated to spec-compliant string.
Why validation missed it (the gap)
──────────────────────────────────
- Layer 1 (smoke): no smoke test boots the actual HTTP MCP
server, sends a real initialize request, and validates the
wire format. The existing tests only exercise tool execution.
- Layer 2 (witness): tracks fix presence, can't catch
'always-wrong-from-the-start' bugs that have no good baseline.
- Layer 3 (history): same — no marker, no signal.
- The unit test was self-consistent with the buggy production
code. Both used { major, minor, patch }. Nothing measured
against the upstream MCP spec or a real client validator.
Closing the gap
───────────────
plugins/ruflo-core/scripts/test-mcp-protocol.mjs
Boots the HTTP MCP server, sends initialize, asserts response
shape against the spec:
- protocolVersion is a string matching YYYY-MM-DD
- capabilities is an object
- serverInfo has { name, version } strings
Final assertion mirrors what Claude Code's Zod would accept.
v3-ci.yml: new mcp-protocol-smoke job (Linux + macOS), gated
before witness-verify. Three layers of regression guard now
cover this class.
verification/witness-fixes.json: registers #1874-mcp and
#1874-shared. Witness now attests the spec strings are present in
both dist files; future regressions to the object form are caught
by witness-verify, not just user reports.
Impact
──────
84/84 fixes verified in the regenerated manifest (was 82).
Anyone running ruflo mcp start -t http with the new build can now
connect Claude Code without the Zod rejection.
Closes #1874
Co-Authored-By: RuFlo <ruv@ruv.net>
|
||
|
|
b4a60e0374 |
feat: performance verification + capability historical reference
Adds a fourth verification layer alongside the existing three (smoke
tests, witness manifest, marker-presence history): per-OS performance
measurements that catch speed regressions the way markers catch presence
regressions.
What's added
────────────
plugins/ruflo-core/scripts/witness/perf.mjs
Benchmark runner. Each capability is one synchronous bench function
in a runners map; failures throw and get recorded as error entries.
Supports --baseline to compare against the rolling-5 median per
capability and --json for CI consumption.
verification/<os>/performance.jsonl (one per OS, append-only)
Schema: { v, commit, issuedAt, os, capability, durationMs, ... }
Same per-OS organization as manifest.md.json + history.jsonl —
different platforms have different native code paths so absolute
numbers don't compare directly, but per-OS trends do.
verification/CAPABILITIES.md
Historical reference: which capabilities are tracked, why each
matters, reference baselines (macOS-class hardware), and incident
history (#1867 Node 26 install, #1859/#1862 hooks, #1608
bcrypt→bcryptjs, ADR-009 fallback chain). Documents the pattern
of `durationMs` regression detection and the schema.
Capabilities (initial set)
──────────────────────────
install_pack pnpm pack @claude-flow/memory (370ms macOS)
install_no_optional npm install --omit=optional (~5s; CI-skipped)
memory_load cold import('@claude-flow/memory') (18ms)
memory_round_trip createDatabase + store/get + close (CI-skipped)
witness_verify verify.mjs --manifest (53ms)
CI integration
──────────────
v3-ci.yml witness-verify job gains a 'Performance verification' step
that runs the lightweight subset (install_pack, memory_load,
witness_verify) with --baseline and appends results. Heavier benches
(install_no_optional, memory_round_trip) are local-only — adopters
run the full suite during release prep.
Soft gate (`|| echo … non-blocking`) until baselines stabilise; can
be promoted to hard gate by removing the suffix.
Co-Authored-By: RuFlo <ruv@ruv.net>
|
||
|
|
9817695a60 |
feat: per-OS verification cognitive containers + tutorial README
Reorganizes the verification system into per-OS bundles, addressing
the cross-platform CI matrix added in
|
||
|
|
b289c009e9 |
fix(witness): probe workspace packages for @noble/ed25519 (pnpm isolated linker)
CI-only failure: signature verification returned all-false because
verify.mjs couldn't load @noble/ed25519. Locally it worked because
v3/node_modules/@noble/ed25519 happened to exist as a flat copy from
an earlier non-pnpm install. Fresh CI runners get pnpm's default
isolated linker, which only exposes a transitive dep at workspace
root if a workspace member declares it directly — and no v3 root
member declares ed25519 (only @claude-flow/cli and
@claude-flow/plugin-agent-federation do).
Fix: expand the probe paths in both verify.mjs and lib.mjs to also
look inside the workspace packages that DO declare @noble/ed25519.
Now resolution succeeds on:
- flat npm install (probes repoRoot/node_modules)
- pnpm hoist install (probes v3/node_modules)
- pnpm isolated install (probes v3/@claude-flow/cli/node_modules)
Verified locally by removing v3/node_modules/@noble/ed25519 (the
stale flat copy) and re-running verify.mjs — signature valid,
82/82 fixes pass.
Also: verify.mjs now prints the probed paths + last error when
ed25519 can't be located, instead of silently returning all-false
signature flags. The diagnostic visibility (via the v3-ci.yml
update in
|
||
|
|
76bd35943a |
feat: ADR-103 witness temporal history + plugin-distributed toolkit (#1868)
Closes the gap that ADR-102 left open: snapshot-only manifests can't
answer "when did this fix regress?" Adds a JSONL temporal log + extracts
the witness toolkit into ruflo-core as an optional plugin asset that
any project can adopt — not just ruflo's own monorepo.
What's new
──────────
1. verification-history.jsonl — one append-only line per regen with
{ commit, issuedAt, manifestHash, summary, fixes: { id: {sha256,
markerVerified} } }. Format choices: JSONL for cheap appends and
minimal git diffs; per-fix object for O(1) lookup.
2. plugins/ruflo-core/scripts/witness/ — project-agnostic toolkit
- lib.mjs shared regen + history primitives
- init.mjs bootstrap empty manifest into any repo
- regen.mjs sign + append history
- verify.mjs validate signature + markers (no ruflo CLI dep)
- history.mjs query temporal log (summary, regressions, timeline)
3. plugins/ruflo-core/{skills,commands,agents}/witness*
Slash command + skill doc + curator agent — Claude Code surface area.
4. scripts/regen-witness.mjs — thin wrapper, delegates to plugin lib.
Reads project-specific NEW_FIXES from a committed witness-fixes.json
instead of inline literals. Single source of truth in the plugin.
5. .github/workflows/v3-ci.yml — witness-verify job gains a follow-on
`history.mjs summary` step that surfaces transitions since the last
snapshot (newly regressed / passing / added / removed fixes).
Empirically verified
────────────────────
Before refactor: 81/81 verified, 1 history entry
After refactor: 81/81 verified, 1 history entry, signature reproducible
signature, marker, sha256 all match across the move.
Plugin scripts run standalone without ruflo CLI installed — only
@noble/ed25519 required. Adopters get full witness capability by
copying plugins/ruflo-core/scripts/witness/ into their repo.
Refs #1868 — implementation issue
ADR-103 — design + rationale + residual risk
Co-Authored-By: RuFlo <ruv@ruv.net>
|
||
|
|
8d06e427ca |
fix: #1859 #1862 ruflo-core hooks + CLI flag priority
Two distinct bugs converged on the same user symptom (every Write/Edit/Bash fired in Claude Code logged a parser error or recorded "true" as the file path). ## CLI parser bug (root of #1859 "records true as filename") In v3/@claude-flow/cli/src/commands/hooks.ts every handler resolved the primary value with: const x = ctx.args[0] || ctx.flags.X as string Because boolean-typed flags don't consume their next token, writing `--success true` (which the help text and project examples explicitly recommend) leaves the literal string "true" in `ctx.args[0]`, which then beats the named flag. Result: post-edit logs "Recording outcome for: true" instead of the path passed via --file. Fixed by swapping priority — flag value first, positional fallback — across all 14 sites: const x = (ctx.flags.X as string) || ctx.args[0] Backward compatible for legacy positional-only callers; surgical to a single regexed bulk swap. ## Plugin hooks bug (#1862 + part of #1859) plugins/ruflo-core/hooks/hooks.json passed flags the CLI doesn't accept: `--format true`, `--update-memory true`, `--track-metrics true`, `--store-results true`. The CLI's global `--format` flag rejects "true" because it's restricted to text|json|table — every Write/Edit hook crashed with "Invalid value for --format: true" before the handler ran. Also: the Bash hook's `tr '\n' '\0' | xargs -0 -I {}` mangled multi-line heredoc commands by splitting them at newlines, occasionally producing empty `--command ''` calls that the CLI rejected with "Required option missing". Replaced with a `bash -c` wrapper that: - Reads stdin once, extracts via jq into env vars (multi-line safe). - No-ops cleanly when the relevant field is absent. - Calls only flags the CLI documents: -c/-s/-e for post-command, -f/-s for post-edit. ## CI regression guard plugins/ruflo-core/scripts/test-hooks.mjs drives each PostToolUse hook with synthetic Claude-Code JSON against a CLI binary (local or published), asserting both exit code 0 *and* that the recorded value is the intended one (not a stray boolean). Verified empirically: fixed CLI: 7/7 pass broken @3.7.0-alpha.17: 5/7 fail with the exact #1859/#1862 symptoms Wired into .github/workflows/v3-ci.yml as `plugin-hooks-smoke` (Node 20 + 22), gating publish on green. Refs #1859 #1862 Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
bd384ad5e6 |
feat(ruflo-core): v0.2.0 — adopt foundation plugin contract (ADR-0001, MCP server contract, sibling ADR cross-references)
The foundation plugin now documents its own contract since 30+ plugins depend on the MCP server it registers and the orchestration patterns it documents. - ADR-0001 (Proposed) at docs/adrs/0001-core-contract.md - README adds Compatibility (pin @claude-flow/cli v3.6 — .mcp.json uses @latest dynamic resolver, smoke verifies the resolved CLI), MCP server contract (300+ tools across 11 families with per-plugin attribution table), Sibling contracts cross-reference table (7 ADRs covering namespace convention, session-as-skill, 4-step pipeline, 3-gate AIDefence, 270s cache-aware /loop, ADR token-optimization) - plugin.json bumps 0.1.0 → 0.2.0; description enumerates registered family prefixes; keywords add foundation, mcp-server, plugin-catalog, discovery - scripts/smoke.sh — 10 structural checks: version + keywords, .mcp.json registers ruflo server, 3 agents + 3 skills present with frontmatter, discover-plugins catalog has ≥25 sibling references, v3.6 pin, sibling ADR cross-references (namespace + 3-gate + 4-step), ADR Proposed, /ruflo-status invokes doctor+status, no wildcard tools Verification: bash plugins/ruflo-core/scripts/smoke.sh → 10/10 Co-Authored-By: RuFlo <ruv@ruv.net> |