GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Phase 3: sync, blob gate, and relays by dezren39 · Pull Request #181 · developing-today/code

Conversation

@dezren39

@dezren39 dezren39 commented Oct 12, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Phase 3: sync, blob gate, and relays

Record: doc/…_phase_3_sync_relays/ (steps, commits, open items).

  • Range sync on the redb store with local K and T (validated), fork isolation, T=0 refused, chunked flights under a per-frame and per-session budget (typed error when exceeded).
  • LogSync through a vendored p2panda-sync with sqlx removed (lock check test); method selection at the 0.035 threshold; the initiator names the method.
  • Batch ingest: a session page is applied in one transaction with one resolution; LogSync writes on a blocking worker.
  • Restart-property bug: an event waiting on a present, unapplied backlink corrupted the store on reopen. Fixed.
  • Lower fork no longer supersedes a proof header that an event names; format v6 (v5 stores refused).
  • Blob gate (get and observe by fetch rules, observe off by default) implemented and tested; not yet wired into serve (open issue).
  • Relays: startup waits only for the home relay; a map without a QAD relay in its first five is refused; relay kit pinned by tests.
  • End-of-phase review fixed a range session with no deadline.

Verified: cargo test --all-features --no-fail-fast exit 0 on the head (lib 1322). Open issues: blob gate wiring, range handshake on /id-sync/1, sync data-phase byte bound, relay validator and startup wait not wired into serve.

Summary by CodeRabbit

  • New Features
    • Added peer synchronization for event logs, with bounded sessions and batch transfer.
    • Added ordered batch ingestion and improved preservation of fork evidence across event history.
  • Bug Fixes
    • Improved connection handling while waiting for a home relay to come online.
  • Important
    • Existing stores using formats v5 or v6 must be rebuilt to use the updated store format.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
dezren39 added 30 commits October 12, 2026 03:59
@dezren39
docs(id): start phase 3, sync, blobs, and relays [phase 3 start]
cfb8002
@dezren39
fix(rust): startup waits only for the home relay [P3.5]
ed9fd4d
Add await_home_relay: waits for a connected home relay under a deadline
(HOME_RELAY_DEADLINE, 10 s), and never for every relay map entry (N32).
A dead entry therefore cannot hold startup past the deadline.

Tests: a map whose only entry is dead ends at its deadline; a live home
relay beside a dead entry gates the wait alone.

Dependency change (dev only): iroh with the test-utils feature, for a
local relay server in tests. It adds iroh-relay's server feature to
Cargo.lock: tokio-rustls-acme, reloadable-core, reloadable-state,
rustls-cert-file-reader, rustls-cert-read, rustls-cert-reloadable-resolver,
pem, dashmap, toml, toml_writer, serde_spanned. Normal builds do not
compile them.
@dezren39
fix(rust): refuse a relay map whose QAD relays are past the probe lim…
f828d2e
…it [P3.6]

iroh probes only the first five relays for QUIC address discovery
(MAX_RELAYS in net_report). check_qad_order refuses a map with no QAD
relay among its first QAD_PROBE_LIMIT (5) entries. It refuses rather
than reorders: iroh's RelayMap is a BTreeMap keyed by URL, so the probe
order is URL order and insertion order cannot move a relay forward.

Tests: the n0 default map passes; an empty map passes; a QAD relay fifth
passes; a QAD relay sixth is refused; a map with no QAD relay is refused.
@dezren39
test(rust): relay kit stops on SIGINT and binds metrics to loopback […
a0b3ce3
…P3.8]

tests/relay_ops.rs reads the kit in the design doc (by a path relative to
the crate) and checks the systemd unit and the configs. The unit must set
KillSignal=SIGINT and ConditionPathExists for the --config-path it starts
with. Each config must set metrics_bind_addr to a loopback address; unset,
metrics default to a public port (S11, N25).

The checks also run on mutated copies (SIGTERM, a missing condition, a
condition on another path, public or unset metrics), and must refuse them.

Dependency change (dev only): toml 1, to parse the kit's configs. It was
already in Cargo.lock through iroh-relay, so only id's dependency list
changes.
@dezren39
feat(rust): range sync on the redb store with local K and T [P3.1]
a4bc009
Range reconciliation over the event store's sync set, on /id-sync/1.
The set is every stored event and every fork proof header, keyed by
author, sequence number, and ID. A message is a list of entries, each
with an explicit upper bound and a mode (skip, fingerprint, ID list).
Fingerprints are XORs of 16-byte BLAKE3 IDs with counts.

K (fan-out, default 16) and T (leaf threshold, default 16) are local
policy and never go on the wire, so peers with different values
converge. A flight is written as frames under a local byte budget
(default 4 MiB, under the 16 MiB cap), so a large ID reply is split.

The data phase sends each side's missing events in key order, and the
receiver decides them in batches of 256, one write transaction each.
EventStore::open already creates every table, so an empty store reads.
@dezren39
fix(rust): a fork in a range batch is isolated [P3.1a]
ff5401b
A batch was decided by one call per event, and a fork ended it, so the events after the fork were lost (S7 found 20 lost). A fork is an outcome like any other: the store records it, the batch goes on, and the proof headers are still present for the sync set. The regression test puts a fork ahead of 20 unrelated events and checks that all 20 are stored.
@dezren39
fix(rust): T=0 is refused at validation, not left to never end [P3.1b]
4509f3d
With T=0 a single mismatched key never ends: the one child of a split is the same range again, so the loop ran until the flight limit. T is local policy, so it is checked where Params is built. Params::new now refuses T below 1, next to K below 2. The regression test asserts both refusals, and it failed before this change.
@dezren39
test(rust): range answer shapes and a bootstrap above the frame limit…
f398ec9
… [P3.1c]

The leaf threshold and the fan-out are now each tested for the shape they give an answer: n = T sends IDs, and n > T splits into min(K, n) children. A store of 550,000 events bootstraps in both directions over loopback. That test is ignored by default, since signing the events is slow in debug builds. The loopback helpers are test-only, so they moved into the test module, which keeps the library build free of dead code. The loopback timeout is 300 s, so a large bootstrap is not cut short, and a hang still fails.
@dezren39
feat(rust): vendor p2panda-sync with sqlx removed [P3.2]
fedb164
LogSync needs p2panda-sync, and its store dependency defaults to the
sqlite feature, which pulls in sqlx. The store is redb (explainers
section 14), so this vendors p2panda-sync 0.7.1 from p2panda rev
3e84cac under pkgs/id/vendor/p2panda-sync with that default turned off.
A fork was not used, so nothing is pushed or published.

The substantive change is one line in the vendored Cargo.toml:
p2panda-store default-features = false. The other manifest changes
resolve workspace inheritance, since the copy sits outside the p2panda
workspace; the examples (which construct SqliteStore) are removed. The
origin rev, the diff, and how to re-verify both are in
pkgs/id/vendor/README.md.

Cargo.lock gains the p2panda-sync package and a futures-util edge
(0.3, sink feature). No third-party crate is added to the lock.

The store_traits lock test now guards SQLite with LogSync wired in. It
fails if the lock names sqlx, sqlite, rusqlite or libsqlite3-sys, if
p2panda-sync is missing, or if the vendored p2panda-store loses
default-features = false. Checked red: with the default restored, the
lock gains seven sqlx entries and the test fails.
@dezren39
feat(rust): method selection for sync sessions [P3.3]
072f1c1
The rule, decided in round 2: LogSync when the estimated difference D
exceeds 0.035 times the chain count C, or when the peer is not yet
bootstrapped (no sync has completed); range otherwise. The comparison is
exact in integers (1000 * D > 35 * C), so 0.035 has no rounding edge.

The rule is written against SyncStats, so range sync's index can supply
C, D and the last completed sync when it merges. SyncSupport is the
matching seam for the answer: a responder refuses any method it does not
run, and LogSyncOnly refuses range until range sync adds itself.

Request and Answer are the handshake frames. The initiator sends the
topic and the method it chose; the responder echoes the method it agrees
to run, or refuses. It never chooses for the session.

Checked red: changing > to >= fails the 0.035 boundary case.
@dezren39
feat(rust): LogSync session over the redb traits [P3.2]
f377b55
A session is one stream pair on /id-sync/1, the sync ALPN that range
sync will also use. The initiator sends a Request (topic, method), the
responder answers, and both sides run p2panda-sync's LogSync on their
SharedEventStore. The method is the one from the selection rule.

Three decisions:

- Arrival order is the write path. Each operation is ingested before
  LogSync sees it, so nothing reads the broadcast events. That channel
  drops events for a slow reader without an error.
- A refused event does not end the batch. It is counted in Tally and
  the session goes on, so one conflict cannot drop the events after it.
  Checked red: a naive abort on refusal fails the batch test with
  "naive abort: Frozen".
- LogSync sends each author's applied prefix and no fork proof. It
  compares heights, so it cannot see forks; a receiver learns of a fork
  only through range sync or the proof exchange (P3.1). The test checks
  that the rival and the stored-but-unapplied events do not arrive.

Every stage runs under one deadline. A silent peer ends the session with
SyncError::Timeout. Frames are read by a task of their own, because
LogSync selects between reading and writing.

Tests (8): two stores end equal with no duplicate insert; a second
session moves nothing; a bulk session across pages; the fork proof is
not carried; a refused event does not abort the batch; a silent peer
times out; a mismatched answer is refused by the initiator; the
initiator chooses range and the responder refuses on both sides.

Not wired into serve: the session is not registered on any Router yet.
@dezren39
Merge branch 'p3-logsync' into phase-3
1bbe09b
@dezren39
Merge branch 'p3-range' into phase-3
942e4b6
@dezren39
feat(rust): blob requests are gated by the world's fetch rules [P3.4]
e8f01a8
Adds blob_gate: a WorldAccess trait (membership and the referencing-world
lookup, stubbed until a real index exists), BlobPolicy with observe off by
default and per-world narrowing, a pure decide(), and blob_events(), which
intercepts get, get_many and observe and keeps pushes under AccessPolicy.
Unknown and denied hashes get the same verdict; an unknown peer is refused.
Not wired into id serve yet.
@dezren39
test(rust): blob gate end to end over loopback [P3.4]
19acd26
Two peers over real QUIC, with a timeout on each step. A stranger is refused
get and observe; a member of the referencing world fetches; a member of an
unrelated world is refused; observe is refused by default and allowed when
the server enables it; a world narrows it off; an unknown and a denied hash
get the same reset code; a get_many with one denied hash is refused whole.
@dezren39
merge: origin/main into phase-3
6e9f840
@dezren39
fix(rust): adapt phase-3 sync to the body-aware ingest after merging …
1bce215
…main [P3]

Main's ingest takes the body and a membership action, and gained a Voided outcome.
Sync batches and the LogSync session carry headers only, so they pass no body. Voided
gets its own tally in both the event-store and LogSync tallies.
@dezren39
Merge branch 'p3-blobs' into p3-integ
eb6c945
@dezren39
feat(rust): WorldAccess over the folded worlds for the blob gate [P3.4]
0dfa6de
FoldedWorlds answers membership from Worlds::holds_here (a member or grant in the world's own
chains; crossings do not count). The reference index is passed in: no store writes which
world names a BLAKE3 blob hash yet, so an unindexed hash is refused to every requester.
@dezren39
test(rust): an event ahead of a voided or proof-header backlink is pa…
bac287b
…rked [P1.11]

An event that names a backlink the store holds but never applies waits for it in the
pool. The backlink is present, so no arrival releases the event. The invariants call the
row corrupt, and a restart refuses to reopen the store. The red unit tests fail at the
first invariant check, and a restart reproduces the failure.

The restart property now runs through restarts_change_no_outcome, so a pinned seed can
replay it. The seed that failed in a random run, 3392703367498350025, is pinned. The
runner's RNG seed is pinned too, and PROPTEST_RNG_SEED still overrides it. Two minimal
deliveries join tests/regressions/ingest.txt: each fails on the store as it stood.
@dezren39
fix(rust): an event ahead of a present backlink is parked, not waited…
937551e
… for [P1.11]

decide_in held an event that was ahead of its chain until its backlink was applied. A
backlink that is present but not applied can never apply at that position. Either a fork
voided it, or it is a fork proof header, or it is applied at another position. The event
then waited for a dependency that never arrives again. The invariants reported the row as
corrupt, and a restart refused to open the store.

The event is now parked when its backlink is present, and it waits only for a backlink
that has not arrived. The helpers that only the old check used, is_applied and applied_in,
are gone.
@dezren39
fix(rust): plain accepts skip the full refresh after merging main [P3]
6bf0036
Main's store reloads and re-resolves every stored event on each accept. A store with no group
action and no fork applies every stored event, so an accept only needs its own applied row and
chain prefix. Sessions of 70 to 210 events in debug went from about 7 s to over 75 s, and the
bulk LogSync test timed out at its 30 s deadline. The fast path is taken only when ACTIONS and
FORKS are empty. test_a_plain_accept_writes_what_a_full_refresh_would checks the rows match a
full refresh after every accept.
@dezren39
style(rust): make FoldedWorlds::new const after merging main [P3]
5723cc2
@dezren39
fix(rust): a session applies a page in one transaction and one resolu…
0d03a3d
…tion [P3.2]

A batch of events from a session now runs as one write transaction. Its
events are decided in order with the same rules as one-at-a-time ingest, and
the resolution runs once at the end of the batch. A batch's labels (applied
or voided) are read after that resolution.

A batch can only change an earlier event's label when it contains a fork, so
a batch that may fork (a conflicting position in the store, in the held
pool, or within the batch, or an author with a fork proof) still resolves
after each store. A conservative check decides which path a batch takes.

ingest_batch takes raw bytes and refuses an entry that does not decode in its
place, so the outcomes match calling ingest on each entry in turn.

The property test compares ingest_events over random pages with per-event
ingest, over random arrival orders, forks, duplicates, and after-hashes. It
checks the outcomes, the rows, the waiting events, the sync set, and each
author's chain and fork proof. Reading the labels once at the end of a batch
even when it forks fails the property on the released lists.

A fork that supersedes a proof header which a stored event names fails with
Corrupt on the per-event path too. That is pre-existing. It is pinned as an
ignored test, and the property generator avoids naming proof headers.
@dezren39
fix(rust): LogSync stores arrivals in batches on a blocking worker [P…
ba45dea
…3.2]

The LogSync stream used to verify and store each operation inline, on the
async runtime, in one write transaction and one fsync per event. The stream
now hands each operation to an ingest worker on a blocking thread. The worker
takes what has arrived, up to 256 operations, and stores it with ingest_batch,
so one write transaction and one fsync cover the batch. The stream waits when
the worker's queue is full.

The session waits for the worker before it returns, so a session's tally
covers every operation the stream delivered. A store error ends the worker,
and that error is the one the session returns.
@dezren39
test(rust): the big bootstrap test is on demand, a small one always r…
0957d9b
…uns [P3.2]

The 1,200-event bootstrap over 4 KiB frames took 98 s in a debug build. It
is now #[ignore]d with the release command in its reason. A 60-event variant
under a 1 KiB budget runs always, in about 5 s, and checks the same
convergence and frame split. Both share one helper.
@dezren39
fix(rust): a merge of the restart fix with batch ingest [P1.11]
ce2042f
The batch work rewrote decide_in around the stored backlink and the APPLIED
table, so the chain-based ahead-of-chain branch of the restart fix is gone.
The batch path keeps its rule: an event waits only for a backlink that has
not arrived, and a present backlink parks it. is_applied keeps the APPLIED
table form. Both sets of unit tests are kept, and the pinned defect test
stays ignored.
@dezren39
fix(rust): a lower fork does not supersede a proof header an event na…
2d6b33e
…mes [P1.8]

A fork at a lower sequence number replaced the author's only fork proof. The
header it dropped stayed present, so an event that named it was accepted, but
the resolution no longer had a node for it. The next resolution failed with
Corrupt. The same happened when a fork at one point replaced its proof with
one that dropped a header.

Fork proof semantics, now stated in the ingest module doc:
- A proof header is evidence. It stays present and held, is never applied,
  and an after hash that names it is satisfied.
- A fork at a lower point adds its own proof and keeps the proofs above it.
  The lowest point freezes the chain.
- A proof is replaced only by a conflict at its own point. A header it drops
  keeps its bytes and stays a node.

Storage: forks is keyed by position (author and fork point), so an author can
hold a proof per point. A new proof_headers table keeps each header's bytes.
The format moves from v5 to v6, so a v5 store is refused and must be rebuilt.

The pinned test is un-ignored and now asserts the semantics. A test covers a
header dropped at its point. The batch scenario names rivals and a fourth
author's events name any generated event.
@dezren39
docs(id): phase 3 record: steps, commits, open items
249cc06
@dezren39
test(rust): a silent peer must end a range session at its deadline [P…
581f96c
…3-review]

sync_over had no deadline: a peer that accepted and then said nothing held the
session on read_flight, and the responder on accept_bi, forever. LogSync and
the answer path already run under one deadline each. This adds the deadline
parameter (unused here, so the test fails) and the red test.
This was referenced Oct 28, 2026
mcpx testing: one seed per run -- format (UUIDv7), derivation, and how it reaches every test #1949
Closed
mcpx testing: seed store layout and collector (file per seed, artifact + scheduled collector) #1953
Closed
mcpx testing: choose the generator engine for one run-wide seed (native fuzz, testing/quick, rapid, hand-rolled) #1956
Closed
mcpx testing: bug-shape generators -- registry, versioning, budget, first shapes #1958
Closed
mcpx testing: review all tests, set up the fuzz framework and its policies #1960
Closed
mcpx testing: deterministic execution as a long-term aspiration (retrofit vs Rust rewrite) #1963
Closed
mcpx testing: which tests an agent runs, and never the full suite locally #1966
Closed
mcpx testing: a failing-first test for every bug, and a review of recent fixes #1969
Closed
mcpx testing: guard tests that close a whole bug class #1971
Closed
mcpx testing: flake policy -- race, shuffle, repeat runs, quarantine with expiry, a second OS #1973
Closed
mcpx testing: a contributor test page agents load, kept out of the user-facing AGENTS.md #1976
Closed
mcpx testing: inventory every feature against its integration tests, and guard that each has one #1978
Closed
mcpx testing: an in-process app entrypoint beside the binary suite, and a scriptable mock MCP server #1980
Closed
mcpx testing: environments -- nix flake, container, local, remote -- as CI matrix entries #1983
Closed
mcpx testing: CI workflow skeleton -- init, matrix, final job; triggers, concurrency, caching, checkout #1985
Closed
mcpx testing: extended platforms -- which artifacts ship static; alpine, scratch, distroless, flatpak, Fedora, Windows tiers #1987
Closed
mcpx testing: a labelled real-software subset, pinned by the flake, run nightly #1990
Closed
mcpx testing: e2e inherits the caller's environment -- build it from an allowlist so tests never reach the user's daemon #1992
Closed
mcpx testing: shard the suite by measured time, and a rule for when to stop splitting #1994
Closed
mcpx testing: a CI time budget in the final job, and the over-budget runbook #1995
Closed
mcpx testing: every formatter and linter in the CI matrix, pinned by the flake (and run the plugin's bun test) #1996
Closed
mcpx testing: format.yaml -- auto-format after a green run; PR head vs main #1997
Closed
mcpx testing: first CI iteration -- unit + e2e shards + lint + nix build, and a recorded baseline #1998
Closed
mcpx: re-home the open mcpx backlog from dezren39/nix, with this repo as the single source #309
Closed
mcpx: settings effect guard — completeness + surface probes + planted-inert negative test (#1971) #2670
Merged
mcpx: the backlog build-out — every theme, in one order, with the disagreements between them (super tracker) #1900
Open
do the thing #4899
Closed
This was referenced Nov 13, 2026
Retroactive home for PR #181: Phase 3: sync, blob gate, and relays #9197
Closed
fleet gh: closure records + reason-required closes (audit trail by construction) #9221
Open
@dezren39 dezren39 mentioned this pull request Nov 21, 2026
Closure audit: every closed issue/PR verified; unmerged branches + unpushed worktrees inventoried #7079
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@dezren39 dezren39

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.