39 KiB
Sync Management: Policy, Jobs, and Safety
Design for the user experience of controlling how data moves and where it lives across an ensemble. This builds on machinery that already exists — doc-sync, blob-sync, artifact-sync, per-document asset pull/push, purge tombstones, and the presence-belief stores — and replaces the current pile of disconnected controls with one coherent model.
Status of the pieces this design touches. This table is a summary; the authority on what shipped is "Implementation phasing" at the end, which carries the per-phase detail and the ADR for each.
| Piece | Today |
|---|---|
Catalog sync (/syn/doc-sync/…) |
Implemented and automatic — scheduler::run_catalog_pass asks every peer at once on a timer, and the Ensemble screen's per-peer "Sync both ways" is now one trigger among several |
| Blob / artifact value transfer | Implemented and automatic — run_catalog_fetch_pass takes artifact stubs and thumbnails eagerly, run_content_pass takes the policy deficit; the detail screen's buttons stay for on-demand pulls |
SyncPolicy (Stream/KeepOnOpen/Mirror per type) |
Enforced — content_ledger resolves it into a deficit that the scheduler fetches and the eviction flow reads, so "want" and "keep" cannot drift apart |
SyncDisposition (per-peer eager push) |
Deleted — every node satisfies its own policy by pulling; see "What happens to SyncDisposition" below |
| "Sync continuously" toggle (doc detail, per peer) | Replaced by DocumentSyncOverride (Pin/Exclude), which is per document rather than per peer |
| "Delete Locally" button | Implemented, as a bound job behind the last-copy guard (eviction::evaluate_subtree_eviction) |
| Imports screen | Not built, and no longer planned as a screen — components::imports_in_progress shows a running import on the library screen that started it, and the Jobs screen is the full list |
Blob streaming (docs/blob-streaming.md) |
Implemented (/syn/blob-stream/…); music plays progressively, PDF/comics adapters unstarted |
The core simplification: two planes
Everything a node holds is split into two planes with different sync rules:
-
The catalog plane — document rows, properties, artifact values (including the
BlobRefpointer values of blob-backed kinds — see the Artifact/Blob unification indata-model.md), tombstones, and presence records. This plane is always replicated to every node, continuously, with no user configuration. It is what makes each node a complete, eventually-consistent view of what exists: every node can browse the full library, see listen/reading progress, read notes, and answer "which nodes hold this file." -
The content plane — blob bytes: the content addressed by
PrimaryContentandAttachmentartifacts (PDFs, audio, video, page images). This is the only plane with a policy knob, because it is the only plane where storage cost is real.
The one deliberate upgrade hiding in this split: artifact values move from
the content plane to the catalog plane. Today artifact values (note
bodies, Progress, bookmarks) are fetched on demand
alongside blobs. They are exactly the data the user wants everywhere as fast
as possible — small, high-value, cross-device (pause a podcast on the phone,
resume on the desktop). That is a claim about resuming and nothing more: live
player state does not sync, and
docs/audio-player-ui-design-principles.md's "What syncs, and what doesn't"
says why. The continuous sync pass (below) fetches all pending
artifact stubs eagerly using the existing /syn/artifact-sync/… protocol.
The data-model docs' "absence is not an error" stance for artifacts still
holds — eager fetching is a scheduler behavior, not a new invariant.
With the Artifact/Blob unification (phase 0 below), the plane assignment
stops being a special-cased rule and becomes a type-system fact: the
catalog plane is simply all artifact values — for Storage::BlobStore
kinds the value is the BlobRef pointer — and the content plane is the
bytes those pointers address. Nothing large can sneak onto the catalog
plane without someone deliberately declaring a new inline kind with a large
payload, which is a code-review-visible act.
Thumbnail-kind bytes also ride the catalog plane: they are small, and
browsing a library without cover art is a degraded experience. A size cap
(e.g. skip thumbnails > 1 MiB) guards against something mislabeled as a
thumbnail.
Everything below follows from this split: policy is only about blob content, so the policy UI never needs to mention notes, progress, or metadata, and the mental model fits in one sentence — "metadata and small stuff is everywhere, always; each node has a policy for which big files it keeps."
Content policy
The enum
SyncPolicy grows from two variants to three (rename in place; no
backwards-compat constraints):
pub enum SyncPolicy {
/// Never store content of this type here. Fetch on open into an
/// ephemeral cache (the streaming cache once blob-stream lands); evict
/// when done. The node is a pure viewer of this type.
#[default]
Stream,
/// Fetch content when the user opens the document, then keep it.
/// The node accumulates the subset the user actually touches.
KeepOnOpen,
/// Proactively fetch and keep content for every document of this type.
/// The node is a full replica for this type.
Mirror,
}
Display names and one-line descriptions (served from Rust, as today):
- Stream — "Fetched from another node when opened; nothing kept here."
- Keep on open — "Downloaded when you open it, then kept for offline use."
- Mirror — "Every document of this type is kept on this node."
Why three and not two: the current Sync conflates "keep what I touch"
(right for a phone and PDFs) with "keep everything" (right for a home server
and music). Those are the two workflows named in the project's own use cases,
and they cannot be expressed with a boolean.
Stream stays the default: a fresh node should cost nothing until the user
decides otherwise.
Scope: per node × per content-bearing type
The policy table is a property of one node (each of the user's nodes answers "what do I keep" differently — this part of the current stub is right). Two corrections to the stub:
-
Only content-bearing document types get a row.
Collection,Note, andHumanhave noPrimaryContentblobs; showing a Stream/Sync picker for them is noise and, worse, implies notes might not be locally readable. Derive the list from a newDocumentType::has_blob_content()(true iff the type declares anyPrimaryContent/Attachment— notThumbnail— artifact kind) rather than hardcoding it in the UI. Implemented list:Pdf,Image,MusicTrack,PodcastEpisode(+PodcastFeedonly for artwork, which the thumbnail rule already covers — soPodcastFeedgets no row either).Correction (implementation, phase 2):
Comicis not in the list, contrary to this section's original draft. Perdocs/data-model.md, aComicdocument itself has no blob-backed artifact — its pages are separateImagechildren (seeagents::comics), soImage's row already governs comic-page content. AComic-specific row would bind to nothing under the resolution rule below, which looks up the type of the document that owns the blob-backed artifact — the childImage, not the parentComic. One practical consequence: a phone can't yet mirror "all comics" independently of "all photos" via type policy alone, since both share theImagerow; per-documentPinis the escape hatch for that case until/unless a comic-specific classifier is worth adding. -
Each row should show what the policy is costing: local bytes currently stored for that type. Implemented as "bytes stored" only. The missing-bytes half is now computable —
content_ledger'sbytes_missing— and showing it isdocs/content-placement-redesign.mdstep 3; until it lands, aMirrorrow cannot tell the user whether the policy took.
Per-document overrides: Pin and Exclude
Type policy is the default; individual documents can override it, per node:
pub enum DocumentSyncOverride {
Pin, // keep content here (and for all descendants) regardless of type policy
Exclude, // never auto-fetch content here; streaming/open still works
}
- Overrides apply to the document's whole subtree (pinning a
Comicpins its page images; pinning aPodcastFeedpins all episodes). Subtree semantics, not per-descendant rows: the override is evaluated by walking ancestors at "wants" computation time (see scheduler), so newly-arriving children are covered automatically. Pinis the replacement for the unwired "Sync continuously" toggle, and it is the mechanism for "keep this album on my phone but stream the rest."- Overrides are stored per node (like the policy) and administered remotely (see Remote administration) — pinning a document onto the VPS from the phone is the flagship interaction.
Resolution order for "should node N hold content for document D":
- Nearest ancestor-or-self
DocumentSyncOverrideon N → Pin/Exclude wins. - N's
SyncPolicyfor D's type (Mirror⇒ want;KeepOnOpen/Stream⇒ only fetch on open, keep iffKeepOnOpen).
What happens to SyncDisposition
Deleted. Its job ("eagerly push type T to peer P") is subsumed by a
cleaner rule that matches the decentralized architecture: every node
satisfies its own policy by pulling. When the desktop imports an album, the
server learns about it via continuous catalog sync and pulls the audio
because its own policy says Mirror(MusicTrack). No node needs a table of
opinions about what other nodes should receive; you edit the server's policy
(possibly remotely) instead of editing a push-table on every other node. This
also matches the doc-sync design's existing stance ("neither node pushes
spontaneously").
Correction: that rule is a transport invariant, not a product rule. As originally written it was both, and as a product rule it made a whole class of intent unexpressible. "Make the server hold all my music" is a thing a person decides at their desk, and under the rule as stated the only way to act on it was to change a setting and then wait for the server's own clock — up to an hour on Android — with no way to say "now" and nothing on screen distinguishing "it's coming" from "it never heard you". That reads as a broken feature, and it was reported as one.
So: a user may direct any node to hold content, from any node. Pull is how
that directive is carried out — the target is instructed and does its own
fetching, under its own policy, and no node ever pushes content uninvited.
Nothing about the transport changes; what changes is that instructing a peer
is a first-class act rather than an implementation detail buried behind a
picker. scheduler::sync_with_peer therefore ends by telling the peer to
reconcile its own side (node_admin::trigger_sync), and the Ensemble screen's
button says "Sync both ways". See docs/content-placement-redesign.md §3.2.
The safety rule is unaffected: TriggerSync can only make a peer fetch.
Eviction is never remotely triggerable.
Manual push stays — "Push now" on the document detail screen is genuinely useful when the target can't pull right now (phone about to go offline, NAT-challenged peer) and as an immediacy affordance. It just isn't a policy.
The sync scheduler (continuous sync)
A background component in lib (per node, all modalities) that makes the
two-plane promise true without button-pressing. It runs three passes:
- Catalog pass —
sync_from_peer(incremental,since= last successful sync per peer) against each reachable ensemble peer. Triggers: node startup; a peer's gossip announcement (a node that just came online syncs with it); a periodic timer (default 15 min); after any local import or policy change; manual "Sync now." - Catalog-plane fetch pass — after a catalog pass: fetch all pending artifact stubs (existing artifact-sync) and missing thumbnail bytes (existing blob-sync) from whichever peers hold them.
- Content pass — compute wants: blob hashes where the resolution rule above says "want" but the blob store lacks the bytes. Enqueue fetch jobs (see Jobs) honoring a concurrency limit (default: 1 bulk transfer at a time) and, later, constraint settings (Wi-Fi-only on Android, disk headroom floor).
Peer selection for fetches prefers nodes whose policy for the type is
Mirror (learned via remote-admin queries or simply from presence density in
node_content_status) — i.e. stream/fetch from the server, not from another
phone that happens to have a copy.
The scheduler is also the single writer of "last synced with peer X" state that the Ensemble screen currently derives from manual actions.
Settings additions (per node, System tab or a small "Background sync" group on the Sync policy tab): master on/off, interval, Android "only on Wi-Fi / charging" constraints. Defaults: on, 15 min, Wi-Fi-only for content pass.
Status: built as designed above, on both desktop and Android. See
docs/adr/0012-continuous-sync-scheduler.md for exactly which triggers
shipped vs. were deliberately deferred, and each modality's driver.
On-demand catalog refresh for one document
The scheduler's catalog pass is the whole catalog on a timer, which leaves a gap the user feels directly: between two passes, this node's idea of a document is however stale the last pass left it. "Sync this document to this node" fetching only what the local catalog already flags as missing means a document whose value changed on another node reports itself as already up to date — the local catalog's opinion, presented as the ensemble's.
So the per-document pull runs both planes, in order
(asset_sync::sync_document_assets_recursive):
- Catalog phase (
asset_sync::refresh_document_catalog) — one doc-sync exchange per ensemble peer, scoped to this document's subtree, with nosincewatermark. Filtering by the peer's watermark here would skip exactly the case worth checking: a peer-side change older than the last successful full pass. - Content phase — the depth-first walk that pulls missing blobs and stubbed artifact values, re-reading children after the refresh so documents discovered in step 1 are included.
Scoping uses SyncRequest::expand_subtree rather than a flat id list. The
requester can only name documents it already knows about, so a note added to
a folder on another node has no id it could put in the scope; with
expand_subtree the responder expands each scoped id over its own tree and
serves what it finds. The flag is off for a push
(asset_sync::push_document_to_peer), where the sender is naming exactly the
documents it intends to hand over and expanding against the receiver's tree
would drag in unrelated ones.
Both phases are best-effort per peer. That makes the count of peers that
actually answered a load-bearing number, not a diagnostic: "up to date" is a
claim about the ensemble only if someone answered, and every modality's
result string says which of the two it is (gui-app's detail_view.rs,
cli-app's format.rs, tui-app's describe_sync_result).
Jobs: one home for every long-running operation
A first-class Jobs agent (sidebar entry, Icon::ArrowsUpDown or
similar), generalizing the "Document Imports" placeholder. Everything
long-running routes through it: imports, catalog syncs, content fetches,
pushes, evictions, purge propagation. This is infrastructure the rest of this
design assumes, so it lands first in the phasing.
Model (in lib, shared by all modalities)
Job {
id: Uuid,
kind: JobKind, // Import | CatalogSync | ContentFetch | Push
// | Eviction | Purge
subject: JobSubject, // human label + optional document id / peer pubkey
origin: JobOrigin, // User | Scheduler | RemoteAdmin(NodePubkey)
state: JobState, // Queued | Running | Done | Failed(String) | Canceled
progress: Option<JobProgress>, // units done/total + bytes done/total
created_at / started_at / finished_at: Timestamp,
}
- A job's row also keeps what someone waiting on it is owed, read as a
JobOutcome: what a failure means (ErrorKind) and, for work whose caller could not know it, a word on where the result is. An agent method that reaches the network returns a job id and its caller reads the result from the store once the outcome isDone(ADR 0060,agents::work). JobStore(SQLite, same DB) persists jobs so a restart shows history and interrupted jobs can be re-enqueued (doc-sync cursors and blob-sync's per-hash granularity already make the underlying work resumable). History is pruned (keep e.g. 14 days / 500 rows).JobRunnerowns execution: a small worker pool keyed by kind (bulk transfers serialized; cheap jobs like artifact fetches parallel), cancel support (CancellationTokenchecked between chunks/items), and an event stream (tokiobroadcastinternally; uniffi callback interface for Kotlin) so UIs update live.- Deduplication is the API, not a UI concern: submitting a job whose
(kind, subject)matches an active job returns the existing job's id. This is what fixes "the button doesn't know its job is already running" — any widget that kicks off work gets back an id it can subscribe to, and a second click attaches to the running job instead of double-starting it.
Jobs screen
┌ Jobs ──────────────────────────────────────────────┐
│ [ Active ] [ History ] │ ← tab_bar / TabRow
│ ───────────────────────────────────────────────────│
│ ⣾ Content fetch — Album "Blackstar" (from helios) │
│ ██████████░░░░░░░░ 312 MiB / 512 MiB Cancel │
│ ⣾ Catalog sync — helios docs 214/~800 │
│ ⏸ Import — ~/comics/Akira/ queued Cancel │
└────────────────────────────────────────────────────┘
- Two in-screen tabs, Active and History, using
components::tabs::{tab_bar, tab_pill}on the desktop and a top-of-screen ComposeTabRowon Android (per the cross-platform iconicity rule). - The sidebar entry shows a badge with the active-job count; failed jobs since last view could later warrant a distinct badge state.
- History rows show outcome, duration, byte totals, and the error text for failures (full text, selectable).
- Naming: "Jobs" — "Transfers" excludes imports/evictions, "Activity" reads as a social feed. Short, honest, matches the app's register.
Widgets reflect job state in place
The Jobs screen is the overview, not the only surface. Any widget that
starts a job binds to that job's events: the document detail "Sync to this
node" button renders progress ("Syncing… 40%") while its job runs and is
disabled as an initiator (a click navigates to Jobs instead); same for "Push
now", the Ensemble screen's per-peer "Sync", and import triggers. The
existing per-widget AsyncActionState pattern gets replaced by "subscribe to
job id."
Status: built on Android and on the gpui desktop, over the same set of
controls — every one that starts a job. The document detail screen's "Sync to
this node" (desktop: "Download"), its per-artifact "Sync", its per-peer "Push
now", and its "Delete Locally"; the Ensemble screen's per-peer "Sync"; the
Sync policy screen's "Run now" and each type's "Reclaim…"; the Music screen's
"Build library"; and the Documents screen's imports. Two consequences beyond
the progress readout, and they are the point: a job started anywhere else —
the background scheduler, a remote TriggerSync, another screen, this screen
before it was navigated away from — shows up in these controls, and the state
survives leaving and re-entering the screen, because it was never the screen's
to remember.
The two evictions are worth naming separately because they share a JobKind
and must not share an identity: "Delete Locally" is Eviction/Document and
"Reclaim…" is Eviction/DocumentType. A subtree eviction and a type-scoped
reclaim are different work, so they neither dedup against each other nor mask
each other's control. Both keep an Evaluating state of their own, which is
not a job: gathering the evidence for the confirmation dialog is work no other
node can see.
The mechanism is per-modality, the identity is not. A widget names the work
it starts as a (kind, subject) pair, and the pair is spelled in Rust
(jobs::match_key, and ffi::job_match_key across the FFI) rather than by
either frontend.
- Android:
jobs/JobBinding.kt'srememberJobControl, over one shared watcher of the store's job-change signal (jobs/ActiveJobs.kt), so a screen with five job-bound controls still has one wait behind them and no screen polls. Each control keeps one local flag,starting, covering only the milliseconds between the tap and the job row existing. - Desktop:
gui-app/src/job_binding.rs'sActiveJobs, held per view and refreshed from astore_watchoverJobRunner::subscribe. One index per view rather than a process-wide singleton — a gpui view already owns its state and its subscription, and theJobRunnerbehind them is shared, so two views holding one agree by construction. A widget that starts its job synchronously refreshes the index right there and needs nostartingflag; one that starts it inside a spawned task (the Ensemble screen's "Sync") passesstarting: truefor the gap.
JobKind and JobSubject cross the FFI as themselves, so a widget names its
work with the same values the job row was made from — DocumentType as the
enum rather than its snake_case name, for the reason job_match_key exists at
all: a frontend that had to produce that name would be a mirror of
DocumentType::type_name, and mirrors go stale silently.
What stays a per-screen flag on both is the result of the last action — "Pushed 3 documents", "Sync failed: …". A job carries a state and a progress message, not the sentence a particular screen wants to show afterwards. It is hidden while the control is busy, so a finished run's message can't be read as the running one's.
The running-imports strip is the one control that is not per-widget: an import
is started against whichever folder the user picks, so there is no subject to
name in advance, and the question it answers is "what is about to arrive
here", not "what did I start". Both modalities therefore filter by kind
alone — ActiveJobs::of_kind / Snapshot.jobsOfKind — and list every running
import by name with its own progress, whichever screen or node started it. On
the desktop it is a small view of its own
(gui-app/src/components/imports_in_progress.rs) that keeps itself current,
so it drops into a screen's header in one line; it is on the Documents screen
and on all five media library screens. Android has it on the Documents screen
only.
One thing is deliberately not the same. The desktop's lines carry no link through to Jobs: its sidebar entry is on screen at all times with a live "N running" badge, so a per-widget button would be a second route to something already one click away, whereas Android has no persistent sidebar and the link is the only route.
Not yet on either: canceling from the widget. How promptly a cancel takes
effect is still up to the work — asset_sync's functions take no
cancellation signal, so a transfer runs to the end and the row is only
recorded as Canceled. The Jobs screen's Cancel already says so, and the
widgets simply don't offer it. See TODO.md's "Cancellation is still coarse
for a single blocking P2P call."
Deleting content safely: the last-copy guard
Applies to every path that removes locally-held blob bytes without ensemble
intent: the "Delete Locally" button, Stream/Exclude-driven eviction, and
future space-reclaim tools. (Purge is explicitly out of scope: its intended
end state is zero copies, and verifying purge propagation is a separate,
secondary problem.)
Evidence model
NodeContentStore records what each node last told us about its own copy of
some content — "node P held blob H, confirmed at T", or "node P said it does
not hold H, as of T" — written during doc-sync, blob-sync, and artifact-sync.
Only confirmed holders count as evidence here, so a peer that has since
evicted stops propping up a deletion. The guard consumes it in tiers, per blob
being deleted:
- Live confirmation (preferred). At delete time, query holders directly
with a new lightweight presence check: extend
/syn/blob-syncwith aQuery(Vec<BlobHash>)client intent that returns found-flags only (no bytes; an ALPN bump). Try peers with the freshest evidence first, short timeout (~5 s). One confirmed holder ⇒ proceed to a normal confirmation dialog listing who holds the data. - Recent evidence, unreachable right now. No peer answered, but evidence exists. The dialog degrades honestly: "Could not reach any node to confirm just now. Last known copies: helios (confirmed 2 days ago), workstation (confirmed 5 weeks ago)." Deletion proceeds only if the unsafe override (below) is enabled; otherwise the only option is Cancel (and a hint to try again when a holder is online).
- No evidence. Deletion is blocked outright unless the override is on.
The override is a node-local setting, deliberately buried: Settings → System → "Allow deleting content that can't be verified elsewhere", off by default, with scary copy. When enabled, tiers 2–3 gain a "Delete anyway" button that still shows the evidence summary. This is the compromise from the project notes: safe by default, escapable by deliberate choice — never in the moment by a checkbox on the dialog itself.
Multi-blob deletes (a subtree, an eviction batch) evaluate per blob and partition the batch: verified blobs are deletable, unverified ones are reported ("41 of 44 files verified elsewhere; 3 skipped"). No all-or-nothing blocking.
Eviction is explicit, never a side effect
Changing a type's policy from Mirror/KeepOnOpen to Stream (or adding
Exclude) does not delete anything. It stops future fetching and makes
existing local bytes reclaimable. The Sync policy tab surfaces this:
"4.2 GiB stored here is no longer wanted by policy — [Reclaim…]", which
enqueues an Eviction job that runs through the last-copy guard. Policy edits
stay cheap and reversible; byte deletion always has its own explicit step.
"Delete Locally" on the document detail screen becomes real: it enqueues a
single-subtree Eviction job (same guard, same dialog). The
node_document_status Removed state is written on completion, exactly as
docs/data-model.md already specifies.
Eviction also writes each dropped blob to content_release_log, which
doc-sync ships to peers as a ContentReleaseBatch alongside the document
tombstones. Without it an eviction would be invisible: the catalog is
untouched by design, so an incremental sync never mentions the document again
and every peer goes on listing this node as a holder. A release says only "I
dropped my copy" — not "this is gone from the ensemble", which is what an
artifact tombstone says.
Status: built as designed above, on both desktop and Android, including
the "Eviction is explicit" section's Stream/Exclude-driven "Reclaim…"
affordance. See docs/adr/0013-blob-possession-evidence-last-copy-guard.md
for the evidence model, the batched/capped live-confirmation queries, the
SharedLocally local-dedup check added beyond this doc's original spec, and
the exact blob-sync wire shape.
Remote administration
The flagship workflow — configure the VPS from the phone — needs a small admin protocol, not a sync protocol.
ALPN: /syn/node-admin/… (p2p::node_admin::NODE_ADMIN_ALPN). Single
bidirectional stream,
request/response, MessagePack, same framing as the other protocols.
AdminRequest =
| GetSyncConfig -- policies + overrides + storage stats
| SetSyncPolicy { doc_type, policy }
| SetDocOverride { doc_id, override: Option<DocumentSyncOverride> }
| TriggerSync -- run a scheduler pass now
| ListJobs { active_only: bool }
| CancelJob { job_id }
AdminResponse mirrors each request; every mutation returns the full new
SyncConfig so the initiating UI can render truth, not an optimistic guess.
Authorization: ensemble membership, which the iroh connection already proves
— consistent with the trust model everywhere else (any of your nodes may
command any other; there is no hierarchy among moons). If per-node privilege
tiers ever arrive, this ALPN is where they gate. One safety rule from day
one: SetSyncPolicy/SetDocOverride never trigger eviction remotely —
they change what the remote node fetches; reclaiming its disk requires a
remote Eviction job created explicitly (a later ReclaimSpace request,
listed as future work, so the first version of the protocol cannot destroy
data at all).
UI: one screen edits any node's policy
The Settings → Sync policy tab gains a node selector row (segmented
pills: "This node" plus each ensemble member by name) above the type table.
Selecting a remote node loads its config via GetSyncConfig and edits write
through SetSyncPolicy; a short status line shows reachability ("Editing
helios — connected" / "helios is unreachable"). The same table, the same
SyncPolicyControl, three policies instead of two, storage stats per row —
just parameterized by which node it is showing. The Ensemble screen's member
rows link here ("Manage sync…") rather than growing a second policy UI.
Editing a remote node's policy only changes what that node wants — it
doesn't make the node act, and waiting for its own next scheduler tick (up
to an hour on Android, gated behind Wi-Fi/charging) makes "I set Mirror and
nothing arrived" look like a bug. A "Sync now" button sits next to the
remote status line (desktop only so far — see phase 5 below) and calls
TriggerSync against the node currently being edited, so the flagship
"configure the VPS from the phone" workflow ends with the VPS actually
fetching, not just a changed setting it'll act on eventually. It only
reports whether the remote node started a pass ("Sync started on this
node") — there's no live view into a remote JobRunner from here, so
watch that node's own Jobs screen for progress.
Document-level pins follow the same pattern in place: the detail screen's
per-node list (below) writes local overrides directly and remote ones via
SetDocOverride.
Document detail: Sync tab redesign
Replace the current stack (sync button + push rows + unwired toggle) with two sections that answer the two real questions — what's here? and where else is it?
┌ Overview │ Sync ┐
│
│ On this node
│ Content: 2 of 2 files stored locally (38.4 MiB)
│ Policy for Pdf: Keep on open · Override: [ Follow policy ▾ ]
│ [ Download now ] [ Delete Locally ]
│
│ Across your ensemble ↻ from catalog + presence
│ node content last confirmed keep here?
│ helios ✓ all today 14:02 Pin ▾ [Push now]
│ phone ✗ none — Follow ▾ [Push now]
│ workstation ◐ 1 of 2 2026-07-14 Follow ▾ [Push now]
- "On this node" shows blob-store truth (files present / sizes), the effective policy with the source of that answer, a three-way override picker (Follow policy / Pin / Exclude), and the two local actions. "Download now" attaches to or creates a ContentFetch job; "Delete Locally" runs the guarded eviction.
- "Across your ensemble" merges what today is the push-row list with
presence data (
node_document_status+node_content_status): per node, a content-presence summary with its confirmation time, the same three-way override picker (written via node-admin — this cell replaces "Sync continuously"), and manual "Push now." - Node ids are shown full-length per the hash-display rule (the mock abbreviates names, not hashes).
Android mirrors this structure in its existing detail screen sections.
What the Ensemble screen keeps
It stays the connectivity surface: membership, ping, "Sync now" (submits a CatalogSync job), last-synced (now scheduler-fed), and a "Manage sync…" link into the policy screen per node. Per-document and per-type controls never live here. Note it does not claim per-peer reachability: Ping is the probe, and ADR 0032's amendment on the reachability matrix says why there is no passive badge.
Implementation phasing
Ordered so each phase is independently shippable and later phases consume earlier ones. (Per VCS style: many small commits within each.)
-
Artifact/Blob unification (prerequisite refactor). Retire
Blob/BlobRoleas ontology per the reworkeddata-model.md:ArtifactValuegainsPrimaryContent/Thumbnail/Attachmentvariants carrying aBlobRefpointer payload;ArtifactKind::storage()declaresInlinevsBlobStorealongsidearity()/merge_strategy(); theblob_refstable merges into the artifacts table; theBlobRefRecord/ArtifactRefRecordwire types unify (doc-sync ALPN bump); attachment removals gain tombstone propagation for free. The blob store itself (hashing, convergent encryption, blob-sync) is untouched. Unrelated to sync UX on its face, but it is what makes the two-plane rule a type-system fact rather than a convention, and every later phase is simpler on top of it. -
Jobs foundation — done (desktop + Android). See
docs/adr/0011-jobs-first-class-model.mdfor theJob/JobStore/JobRunnermodel and the (kind, subject) dedup design. Every surface is runner-backed as of 2026-08-23 — Android's and the daemon'srun_as_job*wrappers open their job through the process's oneJobRunner, so dedup and cancellation work the same everywhere (Android unverified on a real device, no NDK in this sandbox). -
Policy model rework — done (desktop + FFI + Android). See
docs/adr/0010-syncpolicy-three-variant-pin-exclude.mdfor the three-variantSyncPolicyand Pin/Exclude overrides. Policy still enforces nothing on its own (phase 3 does that). Android needed no Kotlin source changes for the enum itself — existing controls were already generic over it; the three-way override picker landed onDocumentDetailScreen.kt's Sync tab (unverified — no NDK in this sandbox). -
Scheduler — done (desktop + Android). See
docs/adr/0012-continuous-sync-scheduler.mdfor the three-pass design, which triggers shipped vs. were deliberately deferred, and each modality's driver (desktop: a periodic-timer/startup driver; Android: aWorkManagerworker enforcing Wi-Fi/charging constraints — unverified, no NDK in this sandbox). -
Safety — done (desktop + Android). See
docs/adr/0013-blob-possession-evidence-last-copy-guard.mdfor the evidence model, the last-copy guard, and the Reclaim flow. Android'sexecute_*FFI re-evaluates evidence fresh at confirm time rather than holding a client-side plan like desktop does (unverified — no NDK in this sandbox). -
Remote admin — done (desktop + Android). See
docs/adr/0014-remote-node-admin-protocol.mdfor the node-admin protocol and the never-triggers-eviction-remotely rule (its amendment records the ALPN bump that carries each type's content ledger). Desktop's Sync policy tab wires upTriggerSyncas a "Sync now" button next to the remote status line.That button was, for a while, the only way to make a remote
Mirror-policy node actually fetch — and it sits behind a node picker on a settings tab, so in practice nobody found it. The Ensemble screen's per-member "Sync" pulled catalog + content into the local node only, computed against the local node's own policy, leaving the remote node with metadata (catalog sync is bidirectional) and no blobs until its next periodic tick.scheduler::sync_with_peernow sendsTriggerSyncitself and the button says "Sync both ways"; see the correction under "What happens toSyncDisposition" above anddocs/content-placement-redesign.md§3.2.ListJobs/CancelJobare still unwired on both modalities — no UI calls them yet, so a triggered remote pass can only be watched from that node's own Jobs screen. Android's remote policy/override editing mirrors desktop's (unverified — no NDK in this sandbox) but doesn't yet have a "Sync now" equivalent for a remote node (Android does have its own local "Run now", unaffected by this); not ported: the Ensemble screen's "Manage sync…" jump-with-preselection. -
Blob streaming — shared transport landed; music migrated onto real progressive playback; PDF/comics adapters not started. See
docs/adr/0015-unified-blob-streaming-protocol.mdfor why one protocol (/syn/blob-stream/…, boundedlength: Option<u64>) serves every type instead of three, and for music's migration onto the existing genericAudioPlayer. PDF and comics adapters are still unstarted — seerust/lib/src/agents/streaming.rs's module doc andTODO.md.
Open questions / future work
- Default policies per type: everything defaults to
Streamfor now. A first-run "what should this node keep?" step (or profile presets like "phone" / "server") may be better once enrollment UX is revisited. - Ensemble-wide replication floor: "every document should exist on ≥ 2 nodes" as a checkable property (surfaced as a warning dashboard), the natural extension of the last-copy evidence model.
- Quota-aware policies:
Mirrorwith a byte budget ("keep newest 20 GiB of podcasts"), age-based eviction forKeepOnOpen. - Purge propagation visibility: per-node purge acknowledgment tracking (the deferred half of the safety story).
- Push-assisted delivery — decided, not built: a
SetSyncPolicyorTriggerSyncaimed at a node that is asleep or NAT-bound is currently lost, which makes "make that node hold this" best-effort in exactly the case it most needs not to be. The decision is that such a directive must be durable; the delivery mechanism (gossip, store-and-forward) and the lifetime rules are open. See TODO.md's "Queue a sync directive for a node that is asleep". - Vault interaction: policy currently ignores vaults; a node without a
vault key can still
Mirrorciphertext for durability. Worth an explicit setting eventually ("hold encrypted copies of locked vaults: yes/no").