Skip to content

sinex: primary mode and the rebuild proof; the loop builds the index from stored bytes - #6304

Merged
Sinity merged 2 commits into
masterfrom
boundary/sinex-primary
Oct 19, 2026
Merged

Sinity merged 2 commits into
masterfrom
boundary/sinex-primary

Conversation

@Sinity

@Sinity Sinity commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Polylogue's primary mode on Sinex (architecture 7.1; epic plnext-3sx), and the rebuild proof (joint #7).

The loop builds the index from stored bytes. A deleted or outdated index.db is built again by the same loop from what archive.db stored, read by range through hashed-blobs, even when the provider file moved or went. This is also what lets a standalone archive rebuild without its files. Two engine tests cover it.

crates/sinex (polylogue-sinex, behind the sinex feature; the default build has no NATS dependency):

  • Publish: every input blob is placed into Sinex's content store (same host) and registered as a material; every unit of archive.db rows (a revision with its input, extents, observations and blob rows; a note with targets and relations; an excision; a setting; a delivery) travels as a record-batch material plus one polylogue.rows event (polylogue.rows: Polylogue's archive units in primary mode sinex#2779). Frames are named by what they carry, units by their position in write order, so the publish step asks Sinex (have, by bisection) and sends only the rest; nothing local records what was sent.
  • Restore: an empty archive reads its units from the confirmed stream in order, checks each batch whole and contiguous positions, inserts the rows, and takes over the archive's identity and write counter. The loop then builds index.db with Sinex's store as an extra blob root.
  • Daemon: $XDG_CONFIG_HOME/polylogue/sinex.toml with mode = "primary" adds Sinex's store as a blob root, restores an empty archive named by archive = "<id>", and publishes once a minute. A file that does not parse pauses publishing and never switches mode.
  • The row codec lives in polylogue-store::rows (only the store opens SQLite); archive.db now carries an archive_id.

Proof (crates/sinex/tests/proof.rs, ignored by default; how to run it is in docs/development.md): the Claude Code examples converge standalone, publish to a real sinexd over a throwaway PostgreSQL and NATS (a second publish sends nothing), restore into an empty archive, converge with no provider files present, and every session and message comes back identical. Passed (18 s).

Verification: xtask fast; nextest on store, engine and sinex (56 passed); the proof run against sinexd built from Sinex #2779.

Not done (follow-ups filed): normalized segments and object-level equivalence keys (joint #3–#5); excision orders across the boundary (joint #6, #19); the pending area that drops local copies once Sinex confirms; tables without local_seq (kept_result, variant, variant_alignment, notice_delivery) and delivery_events added after their delivery's publish; publishing from another host (bytes over NATS); the real-corpus rebuild before any cutover.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em

@Sinity
Sinity enabled auto-merge (squash) October 19, 2026 03:12
Sinity and others added 2 commits October 19, 2026 05:23
… them

A deleted or outdated index.db is built again by the same loop from what
archive.db stored, even when the provider file moved or went; stored chains
are read by range, so a large input is never held whole.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
…e an archive from it

Every input blob is placed into Sinex's content store and registered as a
material; every unit of archive.db rows travels as a record-batch material
with one polylogue.rows event, named by its position in write order. The
publish step asks Sinex what it holds and sends the rest. An empty archive
is restored from the confirmed stream and the loop builds index.db from the
stored bytes, read from Sinex's store. The rebuild proof runs a real sinexd:
publish, restore, converge with no provider files, identical answers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
@Sinity
Sinity force-pushed the boundary/sinex-primary branch from c94ecac to a5dda9f Compare October 19, 2026 03:31
@Sinity
Sinity merged commit f76d1ba into master Oct 19, 2026
1 check passed
@Sinity
Sinity deleted the boundary/sinex-primary branch October 19, 2026 03:32
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.

1 participant