Files
archie/docs
sam 0ceab9d897 fix(nell): move ID counters off SDK-reserved meta: prefix (archie-core-7ma)
NellDB v0.3.0 skips meta:* ids when rebuilding its rev cache on open, so
after any restart the counter Get returned a _rev with no cache entry and
every RMW Put failed with sdk: revision conflict -- task enqueues and
event inserts were permanently broken.

- Counters move to counter:task_id / counter:event_id.
- migrateCounters seeds the new keys from the legacy docs at open; any
  read/write/validation failure aborts OpenStore so allocation can never
  silently restart at 1. Legacy docs stay in place, skipped by scans.
- isReservedKey matches the counter ids exactly (a counter: prefix rule
  would hide every task in a repo owned by "counter").
- Existing counters are validated (next_id >= 1) at open and at allocation.
- EnqueueIssue persists identity, which it previously dropped.
- Tests: reopen regression with exact post-reopen IDs and event
  preservation, migration sequence carry-over for both counters,
  fail-closed on read/write/invalid values, counter-owned repos,
  identity round-trip.

Adversarial review: zero surviving findings.
2026-08-05 19:55:06 +10:00
..