Threads are authored as well as derived, so a peer could never learn about one:
the title someone typed exists nowhere in the log. The replica had 8 threads
against the laptop's 38, and 21 of those were authored.
Identity is a node-generated uid, not the integer id (local, collides across
nodes) and not cluster_key (auto-created clusters only; 11 authored threads had
none). Every write emits one observation keyed by sha256('thread:'+uid), so
threads ride the existing log instead of adding a second replication mechanism.
Reconcile projects the newest document per uid, after the auto-threader, because
authored titles must win over derived ones.
Two bugs the tests caught:
- locally created threads never set threads.hcl, so the LWW guard let any
incoming document win, including older ones;
- projection cleared cluster_key when a document carried none, which broke the
fallback that stops the same cluster arriving twice (producing duplicates).
Adds 'knox thread emit-all' to backfill existing threads.
Links (thread membership) are not replicated yet: peers receive threads without
their members. Follow-up.
Applies gofmt to the 18 files that were already unformatted at HEAD (pre-existing debt — 122 insertions / 122 deletions, whitespace plus import-block reorderings only; `git diff -w` confirms no semantic changes).
Kept on its own branch so the functional change set (see the review-hardening PR) stays reviewable without formatting noise.
Verified: go build, go vet, go test ./... pass on this branch; a merge simulation with the functional branch produces a clean 3-way merge with all tests green.
Reviewed-on: #4
Co-authored-by: David Gwilliam <dhgwilliam@gmail.com>
Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>