Files
ai-memory/docs
Djalma Júnior 494deb9907 fix(admin): tighten move-project per review (crash-safety, on_conflict, cache, tests)
Follow-up hardening on top of the first rework:

- True-move ordering is now rename-FIRST, SQL-commit-LAST, so the DB is never
  ahead of disk: a rename failure touches nothing; a SQL failure renames the
  dir back; a crash between leaves at most an orphan dir with the DB still at
  the source (recoverable), never a row pointing at a missing file. The V18
  pairing trigger rejects any watcher reindex during the window.

- copy-purge same-path conflicts are now an explicit `on_conflict` policy:
  `block` (default — abort with 409 listing the conflicts, source intact),
  `overwrite` (source supersedes the destination page), or `duplicate` (keep
  both under a de-duplicated path). CLI `--on-conflict`, reported in `conflicts`.

- The move now PROACTIVELY evicts the hook router's per-cwd cache entries for
  the moved project (a fire-and-forget hook wired from serve into AdminState),
  so the next hook re-resolves cleanly rather than relying only on the trigger.

- New integration test (ai-memory-hooks) proving the actual recovery loop: a
  cached project moved to another workspace makes the next hook's stale write
  trip the pairing trigger; the router evicts + re-resolves into a consistent
  pair instead of writing a split-brain row. Plus block/overwrite copy-purge
  tests.

Validated end-to-end against a real server in a container (true-move,
block/overwrite/duplicate, partial-skip, and the live-session guard exercised
through an actual /hook event): 22/22.
2026-06-01 17:15:30 -03:00
..
2026-05-24 11:30:32 -03:00