Repository navigation
liminis-context-graph v0.12.2 — the WAL as a source of truth #359
verveguy
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
v0.12.2 is out — a patch release making the WAL usable as a source of truth.
Both changes come from #351, a field report from a deployment moving to a "WAL is authoritative, DB is a derived cache" model: every node rebuilds its local graph from a distributed WAL on boot, and needs to answer one question cheaply — does my DB already reflect this WAL?
Boot-time consistency is now one call and one comparison
knowledge_statusreturns two new fields in itswalobject:wal.applied_seq— the highest WALseqwhose mutations are committed in this graph, persisted in the DB and surviving restartwal.max_seq— the highestseqpresent across the WAL filesWhich makes the reconcile decision a pure integer comparison:
applied_seq == max_seqapplied_seq < max_seqrebuild_from_wal {from_seq: applied_seq + 1}applied_seq > max_seq, or divergedrebuild_from_wal {from_seq: 0, force_clear: true}Previously there was no way to link DB content to a WAL position at all. The reported workaround — hashing WAL file bytes — broke across a publish round-trip, because a Python republisher re-serializes
{"seq":1596,...}as{"seq": 1596, ...}. Identical semantics, different bytes, so every boot looked "changed" and forced a full rebuild.No upgrade cliff. An existing DB has content but no recorded position. Rather than reporting that as unknown and making every deployment do one forced rebuild, lcg backfills the position on first open using ADR-0026's episode cursor, which was built to be retroactive.
nullnow means only "backfill genuinely failed", and the documented action there is a full rebuild.Duplicate WAL sequence numbers fixed
WalWriter'sglobal_seqwas derived once at process start and never re-derived. A WAL directory populated after startup — external seed, backup restore, distributed-WAL pull — followed by a rebuild left the writer re-emitting sequence numbers already on disk. In a published WAL consumed by other nodes, that meansseqstops being a unique identifier.It now re-derives after every rebuild and clear, combining the replay's
last_committed_seqwith a fresh on-disk scan, and only ever raises the counter. The undocumented "seed the WAL before starting lcg" ordering constraint is gone.This one had to land first: the
applied_seqcomparison above is only sound ifseqis unique.Upgrading
Drop-in from 0.12.x. Both
walfields are additive. TheWalPositiontable is created on open, and the position backfills itself.Consumer semantics are in
docs/operations.md— including anull < 5coercion note for JavaScript consumers, wherenullsilently coerces rather than breaking arithmetic as it does in Rust and Python.Community reports have now driven four consecutive releases. Bugs and questions welcome in Issues or Q&A.
All reactions