Files
ruflo/.github
rUvandReuven 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>
2026-05-10 10:34:46 -04:00
..