pub fn folder_changes_since(
mem_root: &Path,
mem: &str,
since: &str,
) -> Result<BackendChanges, BackendError>Expand description
Synthesise per-entity events for a folder-backed mem by reading
<mem_root>/.memstead/changes.jsonl and bucketing events by entity.
Net-effect rules per entity:
- Last event = Delete →
Removed - First event = Create →
Added - Anything else →
Updated
Rename events surface as Updated (folder rename doesn’t carry
from→to metadata). Batch events have no entity id and don’t
contribute envelopes. The cursor is an RFC-3339 timestamp; the
EMPTY_TREE_SHA sentinel and the empty string mean “from the
beginning”. Any other non-parseable cursor refuses with the
typed INVALID_TS_CURSOR: marker (lifted by the engine to the
INVALID_CURSOR code): the folder ledger’s timestamps are compared
lexically, and a mutation’s write_id — fixed-width hex minted
from a nanosecond clock — sorts below every timestamp, so the old
tolerant reading silently replayed the whole history to exactly
the caller who confused the two. head echoes the latest
timestamp seen, falling back to since.
Envelopes are id-only (title / entity_type are None); the
engine wrapper enriches from its in-memory store.