vitest resolves 'fs' and 'node:fs' to one module, so the second mock
(existsSync: () => false) won and 8 tests failed on Linux.
Co-Authored-By: RuFlo <ruv@ruv.net>
Polling a corrupt store made a new .corrupt-<ts> copy on every read (#4779
review). A backup with identical bytes is now reused.
Co-Authored-By: RuFlo <ruv@ruv.net>
Adds success and missing-argument tests for task_retry, session_delete, system_reset, policy_approve, policy_revoke, policy_budget_set, guidance_quickref and aidefence_has_pii, and success tests for aidefence_stats, progress_sync and memory_compress, which take no arguments.
LocalReasoningBank.flushToDisk() wrote its whole in-memory list. A long-lived daemon/MCP process therefore erased patterns added by hooks or another process, and a corrupt patterns.json was silently replaced with an empty bank on the next flush (#4735).\n\nRe-read patterns.json under withStatsFileLock, merge only locally dirty IDs, carry deleted IDs as tombstones (and clear() as a full reset), then write temp+rename. Corrupt files are renamed aside and preserved before any replacement. Pattern store/update/eviction/delete/clear track dirty/tombstone state.\n\nThree regressions cover cross-process additions, no resurrection of a local delete, and corrupt-file preservation; all fail on baseline and pass on candidate. Existing confidence/dedup/flush tests pass; tsc reports no errors in the changed source. The #4217 stats barrier timeout reproduces identically on baseline (local Windows spawn issue).
The vector count read passed the checkout path to sqlite3 through a shell
string, so a directory name with a quote broke out of the quoting. Run
sqlite3 with an argument list instead (-readonly, same read-only open).
The project directory name, git user.name and branch were printed raw.
Strip control and bidi characters from them with the same filter the promo
row already uses, now shared as stripControlChars().
Fixes#4745