Skip to content

Systematic code review — batch of fixes incoming (tracking) #2100

Description

@KeilerHirsch

Context

I've been running a systematic code review of mempalace as a heavy daily user of the CLI + MCP server. It ran over several days across roughly the whole codebase (~46k LOC) — module by module, plus dedicated cross-cutting passes for concurrency, silent failures, data loss, Windows behavior, and encoding. That depth is why the batch of fixes ends up being this large, and I wanted to give you the map up front rather than let the PR count climb without context.

To be transparent about how the findings were produced (so you can weigh them accordingly): the review was run as a multi-agent pass, and every finding was put through an independent adversarial verification step — three separate checks per finding (does the mechanism actually hold / is it reachable in real use / does prior art confirm it), kept only on majority-not-refuted. That filter mattered: it threw out roughly a quarter of the raw candidates (164 flagged → 126 confirmed), so what's left is the set that survived scrutiny, not a raw dump. The confirmed findings break down as 7 critical / 57 high / 38 medium / 24 low, organized into 64 PR-sized groups — which is the queue these PRs are working through.

None of that is a substitute for your review, of course — it's just why there are this many, and why I've tried to make each one cheap to check:

  • a failing regression test first (red), then the fix (green), verified by reverting only the source files;
  • the existing suite kept green (no regressions);
  • ruff check and ruff format --check clean;
  • an independent review pass before pushing.

Each PR is scoped to one defect class in one subsystem, so they can be reviewed and merged independently, in whatever order suits you.

PRs open so far

Repair / index integrity

Miner / mining safety

Cross-platform / correctness

All of the above are CI-green and have no merge conflicts.

What's still coming

The review surfaced a number of additional issues across repair.py, migrate.py, backups.py, the backend adapters, and the i18n/extraction paths. I'll keep sending them in small, single-purpose PRs and checking them off here. A few categories I'll flag rather than silently PR:

  • Design proposals (not bug fixes) — e.g. a retroactive collision scan — I'll raise as separate discussion issues for your buy-in first, not as PRs.
  • Backend-specific fixes (pgvector / qdrant / milvus) — I run the chromadb backend exclusively, so I can't personally verify those against a live instance; I'll validate them against each backend's own test doubles and say so explicitly in the PR, rather than claim live verification I don't have.

The one that matters most

The recurring HNSW-vs-SQLite divergence traces back to the rebuild path not holding mine_palace_lock() for the duration of the rebuild, so writes that land mid-rebuild are lost from the index. #2086 + #2093 harden the blast radius, but the root cause — keeping writes and the rebuild from racing — is a larger change (a write-queue / quiescence design) that I'd rather scope with you before implementing, since it touches the core write path. Happy to open a design issue for that specifically if you'd like.

Not asking for anything urgent here — just wanted to give you the map before the PR count climbs. Thanks for the project; it's become a core part of how I work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions