Skip to content

Read-back as a head set; merge anchors; Drive pulls before pushing - #160

Merged
lannbot merged 1 commit into
mainfrom
m4b/heads
Sep 7, 2026
Merged

Read-back as a head set; merge anchors; Drive pulls before pushing#160
lannbot merged 1 commit into
mainfrom
m4b/heads

Conversation

@lannbot

@lannbot lannbot commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Implements keyhive's own causal-encryption design (design/causal_encryption.md §Key Management / §Decryption Head / §Multiple Heads) in place of the full key map: chunk_keys → a head set pruned as descendants carry their parents' keys; a merge anchor (Automerge::empty_commit) on absorbing diverging content connects an old-epoch concurrent branch for members who joined later; Drive pulls before pushing.

Review-driven fixes: ancestor keys for not-yet-arrived commits are retained (a parent delivered after its child was otherwise unopenable forever); the frontier advances only after add_commits succeeds; pruning driven by successful decrypts only.

Known gap, recorded: a linear old-epoch write (no divergence) stays dark for a later member until the next local mutation. Sedimentree fragments remain the eventual wire/store roll-up.

Tests: 17 engine (chained history → one entry; two branches → two; cross-batch parent-after-child; the anchor scenario across separate batches). e2e 16/16 ×2. Automerge armed.

Per keyhive's causal-encryption record, the entry point to a document is
a set of (head, content key) pairs, not every key ever held: chunk_keys
becomes that head set, moved by seal and by open — parents' keys ride
inside their descendants' envelopes, so an entry is pruned once a
descendant this device holds carries it. Keys learned for commits that
have not arrived yet are retained (one entry per out-of-order arrival)
because nothing else would carry them. The frontier advances only after
the commit is in the sedimentree.

A concurrent branch sealed under an older epoch is a partition, not a
loss: when a batch lands content that leaves the document diverged, the
engine writes one empty automerge commit — a merge anchor whose envelope
carries both branches' keys under the current epoch — so members who
joined after that epoch read it without anyone writing again. An anchor
carries no operations and so never triggers another; concurrent anchors
rest as two heads until the next real write. A linear old-epoch write
(no divergence) stays dark for a later member until the next local
mutation; recorded as the known gap. Drive syncs pull → ingest → push.

Design record: 'Read-back and partitions'.
@lannbot
lannbot enabled auto-merge September 7, 2026 15:29
@lannbot
lannbot merged commit 11cff92 into main Sep 7, 2026
2 checks passed
@lannbot
lannbot deleted the m4b/heads branch September 7, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants