Compare commits

...
1557 Commits
Author SHA1 Message Date
Greg ShuflinandClaude Opus 5.5 de5c51fbbb android: the words passed to labels, titles and placeholders come from copy
Build Debug APK / build (push) Successful in 8m40s
The last of Android's hardcoded visible strings: search placeholders, dialog
titles and field labels, clipboard labels, the comic reader's page-absence
pane, the music player's availability line, Settings' switches and log
verbosity names, and the failures shown beside the controls that started
them. Where the desktop already had words for the same thing, Android now
uses those (Node pubkey, Bootstrap link, Build library, Commit).

Also: the Code agent's name moves into copy::code; revocation::A_PEER is
capitalized, since it opens its sentence (the CLI printed "a peer has it.");
and SharedCopy's doc no longer says Android-only labels stay literals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 04:24:37 -08:00
Greg ShuflinandClaude Opus 5.5 7fc94f664c android: the words in Text() come from copy
Every Text() and Toast that typed its own words reads them from copy now,
under each one's subject: the document import dialog and its toast, the note
sidebar's empty and no-match states, the preview and Typst empty states, the
node name counter and the log-tag explainer in Settings, a PDF that won't
open, a podcast's missing cover, the Jobs link, an event's write-up field and
a failed reclaim. The P2P service's notification and its channel too, which
the survey turned up beside them.

Where the desktop already had the words, Android takes them rather than its
own paraphrase: the import dialog is "Import Documents" with "Import from
URL", a picked folder asks under "Import collection", the sidebar's add
buttons say New Note and New Collection, the PDF drawer's item is "Document
Info" like the popup it opens, and the event form's label is
humans::WRITE_UP. The node name counter reads NODE_NAME_MAX_LEN rather than a
64 of its own, and the note tree's no-match sentence is library_empty's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 02:32:35 -08:00
Greg ShuflinandClaude Opus 5.5 a7727195d6 android: every icon's label comes from copy
The 28 content descriptions Android screens still typed for themselves are
copy's now, each under its subject: the paged readers' page, history and zoom
controls in copy::reader (the comic reader and the PDF viewer share them, so
"Previous page" was already two strings), the PDF viewer's bookmark icons,
the Documents filter chip and its expand/collapse chevrons, the ensemble
member chevron, the notes sidebar toggle and Typst preview, the player's
Play/Pause, podcast cover art, the media library's layout toggle, the
Pictures viewer's controls and the QR code.

Where a word already existed it is reused rather than paraphrased: the PDF
page is reader::page ("Page 4", not "PDF Page 4"), adding a bookmark is
pdf_viewer::ADD_BOOKMARK, the layout toggle says library_layout's Cards and
List, and a podcast's artwork is one COVER_ART whether it was called a cover
or a thumbnail. Two records are new, ReaderCopy and PicturesCopy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:47:02 -08:00
Greg ShuflinandClaude Opus 5.5 9ee7dca2f4 android: the Humans screen's icon labels come from copy
The six content descriptions HumanDetailScreen typed for itself (Add fact,
Add contact method, Remove <value>, and an event card's Edit and Delete) are
copy::humans' now: ADD_FACT, ADD_CONTACT_METHOD, DELETE_EVENT, the existing
EDIT_EVENT, and remove_value, which keeps naming the value so a screen reader
can tell a list's remove buttons apart. They reach Kotlin through HumansCopy
and humans_remove_value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 00:49:51 -08:00
Greg ShuflinandClaude Opus 5.5 d46a858f3e humans: interactions are events, in the code as on screen
The Humans screen's second tab is Events, and the thing it lists is an event
everywhere: DocumentType::Event, Event/EventSummary, log_event, events_with,
the FFI's EventItem/EventDetail, HumansCmd::Events, syn humans events, the
desktop's EventsView/EventForm and the copy ("Log an event", "an event only
you were at"). "Event" fits a walk taken alone, which "interaction" never
did, and one name in the code and on screen is one less translation.

EdgeKind::Attendee and PropertyKind::OccurredOn keep their names: an event
has attendees and occurs. Documents' tag for the type is EVT now, not MET.

DocumentType rides bare on the sync wire, so the rename is a wire change and
SYNC_PROTOCOL_VERSION is bumped. A store holding interactions doesn't read
them as events; delete and recreate it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 23:55:28 -08:00
Greg ShuflinandClaude Opus 5.5 f501b335f3 TODO: what is left of interactions outside a person's screen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 20:45:25 -08:00
Greg ShuflinandClaude Opus 5.5 57b5dcd90e humans: syn humans log, an interaction from the command line
syn humans log TITLE [--on DATE] [--with NAME]... [--body TEXT] logs an
interaction, today by default. A guest is a full name or an id, and a name
must match exactly: syn humans show falls back to the closest match, but a
write that quietly lists the wrong person is worse than one refused. Every
name resolves before anything is written, so one miss refuses the lot.
humans_show and humans_log share that resolution as resolve_human.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 20:40:21 -08:00
Greg ShuflinandClaude Opus 5.5 d5bf346b6d tui: a Humans screen, People and Interactions
The terminal gets the desktop's two Humans tabs, read through the daemon:
People, where a person opens with their Profile and History (the times you
met, with who else was there and the write-up, and apart from those, where
they're mentioned), and Interactions, every interaction most recent first,
where one opens with when, what, who and its write-up. A write-up held on
another node says so rather than reading as empty.

Read-only: writing a person or an interaction stays with the desktop and
Android. So a sync landing on what is open is simply shown, with the scroll
and the list cursors kept where they were (by id). Both lists are
virtualized. The words are copy::humans' and the hints key_hints'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 20:40:16 -08:00
Greg ShuflinandClaude Opus 5.5 9d4be3bb56 humans: the daemon serves interactions, and syn lists them
HumansCmd grows the reads a terminal Humans screen needs: History (a person's
interactions with their write-ups, and their backlinks), Interactions (every
one, most recent first) and Interaction (one, with its write-up). List now
answers with HumanSummary rows, ids and availability included, so a client can
open a person and mark one still syncing. syn humans list keeps printing
names, now filtering and sorting on its own side.

syn humans interactions prints every interaction: date, title, and who was
there. copy::humans::guests says that last part, "with Ada, Bob" or "Only
you", for every screen that has no one person as its subject, the desktop's
Interactions tab included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 20:13:19 -08:00
Greg ShuflinandClaude Opus 5.5 ab3c64a083 humans: an Interactions tab beside People on the desktop
The Humans screen gets a People | Interactions tab bar, the two of equal
standing. Interactions lists every interaction on this node, most recent first,
virtualized since it grows with everything ever logged. One opens read-only:
when, what, who was there (each name opens that person) and the write-up, or
a note that the write-up hasn't synced yet. Edit puts the whole interaction in
the form, and Save or Cancel goes back to reading. The header's action follows
the tab: Add a person, or Log an interaction, which opens the form on nobody.

This is the first place an interaction with nobody else listed shows up
outside Documents.

The log form moves out of the person screen into InteractionForm, which both
the History tab and the Interactions tab use, so neither can drift on date
checking, the guest list or what Save writes. [ and ] now step People and
Interactions; the circle filter under People is clicked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 20:04:48 -08:00
Greg ShuflinandClaude Opus 5.5 10a689885f humans: copy for an Interactions tab beside People
The words the Interactions view and the TUI's Humans screen need: the two
top-level tab names, an interaction's field labels and its not-yet-synced
write-up, and occurred_on, the date-or-"not synced" choice both modalities
were about to write for themselves.

attendance_notice takes an optional subject now: the Interactions tab's form
opens on nobody, so only an empty guest list is worth a word there, and it
needn't point at Documents. HumanSummary and Backlink serialize, for the
daemon to hand them to the TUI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 19:44:32 -08:00
Greg ShuflinandClaude Opus 5.5 ca391f72a6 TODO: group interactions are done; what is left is a home outside a person
Build Debug APK / build (push) Successful in 6m47s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwcoR2uATB15jsF2Lyj
2026-11-06 18:49:18 -08:00
Greg ShuflinandClaude Opus 5.5 42aa150e43 humans: an interaction's guest list is edited with the interaction
The log/edit form on a person's History tab now carries who was there, on
desktop and Android, written with the form's own Log or Save. It opens on
the person whose screen it is; anyone can be added, and anyone can be
taken off, that person included.

You are implicitly at everything you log, so an empty list is an
interaction only you were at, not one nobody was at, and it is allowed.
copy::humans::attendance_notice says before Save what each of those
means: off this person's timeline, or on nobody's (still in Documents).

HumansManager::update_interaction takes the attendees too, so one Save is
one call, and checks them all before writing anything. The FFI's separate
set_attendees, which nothing called, is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwcoR2uATB15jsF2Lyj
2026-11-06 18:49:17 -08:00
Greg ShuflinandClaude Opus 5.5 a432539eaa gui: Combobox::picker, a combobox that adds to a caller's list
A pick is reported and the field empties for the next one, with no
selection of its own; set_options narrows the offer as the caller's list
grows. TagInput is the wrong tool for picking people: it accepts free
text and reports a string, and two people can share a name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwcoR2uATB15jsF2Lyj
2026-11-06 18:38:43 -08:00
Greg ShuflinandClaude Opus 5.5 bf1ea146ab TODO: explore AI agents reading and writing Humans entries
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 18:12:57 -08:00
Greg ShuflinandClaude Opus 5.5 ad15d5ef23 notes: drop the busy-save retries on desktop and Android
Build Debug APK / build (push) Successful in 6m45s
save_body_with_retry and retryOnBusy re-ran a failed note save twice, two
seconds apart, because a save that read and then wrote lost to any sync commit
in between with SQLITE_BUSY_SNAPSHOT. Saves are writes now and queue for the
lock instead (ADR 0057), and a busy that still gets through has already waited
BUSY_TIMEOUT, so each save is one attempt. retryOnBusy also retried failures
that weren't busy at all. The save-failed copy no longer says it retried, and
the FFI error docs no longer cite retryOnBusy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 04:39:53 -08:00
Greg ShuflinandClaude Opus 5.5 751802b2d7 ADR 0057: writes take a WriteTx from an IMMEDIATE transaction
Records the decision, why the deferred read-then-write failed with
SQLITE_BUSY_SNAPSHOT however long BUSY_TIMEOUT was, and the two alternatives
set aside. ADR 0019 is superseded in part; TODO.md keeps only what's left
(retiring the per-screen retries, the unexplained 5 s stalls, and the
backstop's reach outside the lib's own tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 03:41:00 -08:00
Greg ShuflinandClaude Opus 5.5 eb2a65cde0 stores: catch a read transaction that writes, and a write nested in a write
WriteTx can't stop a method declared &Transaction from running an INSERT, so
transact checks what the transaction did: a deferred batch that ends holding
the write lock is a writer on the read path, open to SQLITE_BUSY_SNAPSHOT.
And a write opened while the same thread holds one waits out BUSY_TIMEOUT for
its own caller's lock. Both panic in this crate's tests and are logged
elsewhere.

Its first run found four writers that had kept &Transaction because they write
through a helper taking &Connection: touch_document and add_edge (and with
them sync_receive_edge, ArtifactStore's crdt_merged and music's
ensure_library_edge), plus peer_nodes' record_sync. Those helpers,
touch_document_in_tx and insert_edge_in_tx, now take WriteTx too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 03:35:54 -08:00
Greg ShuflinandClaude Opus 5.5 ba216855ec stores: graph_copy's transaction begins IMMEDIATE
It reads the schema and then inserts, so as a deferred transaction any commit
in between would fail it with SQLITE_BUSY_SNAPSHOT, like every other
read-then-write before WriteTx.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 03:11:23 -08:00
Greg ShuflinandClaude Opus 5.5 f438ac4ba5 stores: settings reads are deferred; its setters take WriteTx
SettingsStore::batch began every transaction IMMEDIATE so update_settings'
read-modify-write could serialize concurrent setters. That job now belongs to
write: save_row and everything reaching it (update_settings, the setters,
initialize_node, the ensemble and vault writes) take a WriteTx, and batch is a
plain deferred read like every other store's, so reading a setting no longer
queues behind a sync for the write lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 03:09:17 -08:00
Greg ShuflinandClaude Opus 5.5 c6ae42e701 stores: document and artifact writes take WriteTx
The document and artifact stores' writing methods ask for a WriteTx, as do the
agent and import helpers that write through them (ensure_document, add_titled,
the music/pdf/picture/comic property writers, facts and contact methods,
wikilink edges, import_blob_document's closure, Humans' touching). Every call
site that reaches one moved from batch to write — notes saves, sync's
apply_records chunks, imports — so the read each of them does before writing
happens under the write lock and can no longer go stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 02:52:56 -08:00
Greg ShuflinandClaude Opus 5.5 8daf4f824d stores: the small stores' writing methods take WriteTx
Every method of the job, linkage, feed-cache, sync-staging, peer, health,
revocation, epoch, vault, content-release, sync-override and node-status
stores that writes now asks for a WriteTx, and the call sites that use them
moved from batch to write, so those transactions begin IMMEDIATE and queue
for the write lock rather than failing with SQLITE_BUSY_SNAPSHOT. The store
I/O benchmark times its staging writes IMMEDIATE to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 02:17:45 -08:00
Greg ShuflinandClaude Opus 5.5 4b6d4721b8 stores: WriteTx and an IMMEDIATE write entry point beside every batch
A deferred transaction that reads and then writes fails at once with
SQLITE_BUSY_SNAPSHOT if another connection committed after its read, and
BUSY_TIMEOUT can't help. write_on begins IMMEDIATE instead, so a second
writer queues for the lock, and hands its closure a WriteTx: a Transaction
that only a write entry point can produce. Store::write, Db/AnnouncingDb::write
and each store's own write sit beside batch. Nothing uses them yet; the store
methods that write move to &WriteTx next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 01:30:41 -08:00
Greg ShuflinandClaude Opus 5.5 2018028129 stores: log busy failures and long write holds with their call site
A busy transaction now logs SQLite's extended code, so an immediate
SQLITE_BUSY_SNAPSHOT (overlapping writers) and a five-second SQLITE_BUSY (a
lock held too long) read as different things. The error enums fold both into
one Busy, so the code is noted where each rusqlite::Error converts and
reported by batch_on, which is #[track_caller] through every batch wrapper so
the line names the site that opened the transaction. A write transaction open
past a second is logged the same way.

SettingsStore::batch goes through the same path (transact) rather than
opening its IMMEDIATE transaction by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:39:20 -08:00
Greg ShuflinandClaude Opus 5.5 6d86486ef9 TODO: busy-database findings — BUSY_SNAPSHOT confirmed, nesting and the pool ruled out
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:03:12 -08:00
Greg ShuflinandClaude Opus 5.5 554a87cd45 ADR 0056: keep synchronicity-lib one crate; hot loops get their own optimized crate
Build Debug APK / build (push) Successful in 5m38s
Records the rebuild timings behind the decision: opt-level, the host cdylib
and mold each buy little or nothing on an incremental rebuild, and the core
module cycle means no split spares a frontend a rebuild.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 23:26:08 -08:00
Greg ShuflinandClaude Opus 5.5 c5318036b3 gui-app: swap image channels in an always-optimized pixel-order crate
The RGBA-to-BGRA swap every decoded image goes through ran at opt-level 0 in
dev builds: 4.5s for a 48-megapixel photo, against 51ms optimized. It now lives
in pixel-order, which the workspace builds at opt-level 3 in every profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 23:26:08 -08:00
Greg ShuflinandClaude Opus 5.5 bc6404547d Move the macOS daemon-socket path limit to the long-term TODO
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 23:26:08 -08:00
Greg ShuflinandClaude Opus 5.5 35c599b5e2 syn-daemon: reach the daemon socket through /proc/self/fd on Linux
A Unix socket address has to fit sun_path (108 bytes on Linux), so a store
nested deeply enough could not bind or reach <store>/.daemon.sock. Every
bind and connect now goes through syn_daemon::socket, which on Linux names
the socket via a descriptor for its directory. The socket stays in the
store; macOS still uses the plain path and is left as a TODO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 23:26:08 -08:00
Greg ShuflinandClaude Opus 5.5 1be9637de8 documents: a title edits on one line; only prose properties take several
Build Debug APK / build (push) Successful in 7m40s
TextShape::Prose covered every text property, so Android gave a title a
multi-line field where Enter broke the line, and the desktop edited a
podcast description in a one-line input that flattens pasted breaks.
TextShape::of now takes the kind: text is Line unless its kind runs to
paragraphs (feed and episode descriptions, a comic's summary) or the value
already holds a line break, which a one-line field would write back
flattened. The desktop edits Prose in a TextArea.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 20:37:19 -08:00
Greg ShuflinandClaude Opus 5.5 b6fe4a18db stores: a property row this build can't read is left out of a listing, not fatal to it
A kind or value written by a newer build sharing the store — switching
builds on one device is enough — failed list_properties for the whole
document, so its detail screen showed only "database error". Both
listings now skip such a row with a warning; damage to any other column
still fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 20:37:09 -08:00
Greg ShuflinandClaude Opus 5.5 ab895ffc73 android: edit a document's properties from its detail screen
The Properties section gains an Edit mode: every editable property at once
(text by shape, a switch, tag chips with an entry box), immutable ones listed
with why they can't change, and nothing written until Save. PropertyForm holds
the form against the properties it was opened on:

- Save writes only the fields whose staged edit differs from its seed, in one
  save_properties call, so an untouched field never overwrites a newer value
  from another node. A tag typed but not yet added is part of the edit.
- A re-read that differs is held, not applied: the incoming-change strip
  (Subject::DocumentProperties) pauses Save, each moved field says what it
  moved to, and Use theirs reopens the form on the new values.

Back while editing is Cancel, as on the other record screens. A re-read that
fails mid-edit no longer replaces the screen with an error. ADR 0031 gains an
amendment recording this as the first form to take its designed answer; the
action labels gain Add and Remove for the tag chips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 18:44:53 -08:00
Greg ShuflinandClaude Opus 5.5 0e1766a52f ffi: what Android needs to edit a document's properties
DocumentPropertyItem carries each property's sync label and its value as a
form edits it (PropertyEdit: read-only, shaped text, toggle, tags), and
DocumentsFfi::save_properties writes a form's changed entries in one
transaction, refusing the whole batch if any entry does not parse or names an
immutable kind. property_edit_error and property_edit_placeholder expose
documents::property_edit to Kotlin; incoming_document_properties_change_copy
and property_changed_elsewhere are the banner and the per-field marker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 18:23:42 -08:00
Greg ShuflinandClaude Opus 5.5 ea03ebea71 documents: one property-edit parser for every frontend, and a per-field marker on the desktop form
documents::property_edit says which control a property gets (TextShape), the
text it starts from, and what that text must parse as — the desktop's detail
form used to do this itself, which would have left Android to write a second
parser that disagreed with it. The desktop's five text widgets collapse into
one shaped by TextShape.

While the form holds a newer version from another node, each field that moved
now says what it moved to (copy::document_fields::changed_elsewhere): ADR
0031's open point that a form's alert has to say which fields arrived.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 18:23:36 -08:00
Greg ShuflinandClaude Opus 5.5 2e0d4b6851 gui documents: a reload holds a property edit's incoming change instead of discarding the edit
Build Debug APK / build (push) Successful in 5m40s
load_detail cleared editing_properties on every load, so a pull, delete-locally
or Save finishing in the background threw away a property edit in progress.
Now an open edit form compares each reload against what it was seeded with
through a SyncGuarded: a differing set raises the incoming-change banner
(new copy subject DocumentProperties) and pauses Save until the user takes
theirs (reopens the form on the new values) or keeps their own.

Save writes only the fields whose value differs from what the form was
seeded with, so an untouched property no longer overwrites a newer value
from another node. And the open detail now follows the document store (and
re-reads on arrival), which the guard is what makes safe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:58:14 -08:00
Greg ShuflinandClaude Opus 5.5 8a20cd1123 TODO: find out why writes wait on, or fail with, a busy database
Build Debug APK / build (push) Successful in 6m41s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 16:23:57 -08:00
Greg ShuflinandClaude Opus 5.5 af159e94e6 gui podcasts: give the custom-speed chips a text color
They inherited the dialog's default, which renders near-black on the chip's
dark background.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 15:07:47 -08:00
Greg ShuflinandClaude Opus 5.5 1f60cfca2f podcasts: confirming a slider speed is one write call, so it can't lose the custom-speed add
Set in the speed dialog issued the podcast's speed and the custom-speed add as
two concurrent writes (two background tasks on desktop, two coroutines on
Android). Each deferred transaction reads before it writes, so when they
overlapped SQLite refused one outright with SQLITE_BUSY rather than waiting:
the speed was kept for the podcast and never joined the menu. Seen in the
headless desktop session.

speed::confirm_speed does both, one after the other. The desktop emits a single
SpeedConfirmed in place of SpeedChosen + CustomSpeedAdded, and Android's
dialog calls one onConfirm, backed by a confirmSpeed FFI call that replaces
addCustomSpeed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 15:07:47 -08:00
Greg ShuflinandClaude Opus 5.5 7d72c579e5 docs: what a podcast speed pick writes; drop the playback-rate TODO
Build Debug APK / build (push) Successful in 7m31s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 12:41:37 -08:00
Greg ShuflinandClaude Opus 5.5 221cab178b podcasts: a picked speed is the podcast's, and custom speeds are a synced Podcasts-wide list
Every speed the user picks while an episode plays -- a preset, a custom
speed from the menu, or one confirmed on the slider -- is now that
podcast's speed (PodcastFeedSpeed, was PodcastFeedCustomSpeed, on the
feed's document), on the desktop and Android alike. Before, only a
confirmed slider value was kept, a preset lasted the session, and Android
also kept a node-local 'last rate anywhere' in Settings; that setting and
its FFI are gone, and a podcast with no speed plays at 1x.

A slider speed the menu doesn't already offer joins PodcastsCustomSpeeds,
a SetUnion on the Podcasts agent-settings document, so concurrent adds on
two nodes both survive and a removal is an element removal (ADR 0043).
The speed dialog lists them, each removable; a removal applies at once,
and a list arriving while the dialog is open waits for it to close.
agents::podcast::speed holds the rule, the presets (now shared with
Android via podcast_speed_presets) and both writes.

The speed is read from the store when an episode starts rather than
carried on PodcastMeta/EpisodeMeta/Podcast snapshots, which went stale.
That also fixes two desktop bugs: queue playback ignored the feed's speed,
and a pick was saved to whichever podcast's detail screen was open rather
than the one playing -- the event now carries the feed from the track
(NowPlaying::speed_document) and PodcastsView, which owns the player,
writes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 12:41:37 -08:00
Greg ShuflinandClaude Opus 5.5 a686e0ec8d TODO: drop 'Android repository unit tests'; ADR 0022 records why no dispatcher
The item assumed repository tests needed an injected dispatcher. They
didn't. The obstacle was NativeLib and the Android stubs, and the Kotlin
logic the repositories own is now extracted and tested (FeedMoves,
retryOnBusy). detekt.yml's InjectDispatcher comment points at the update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:29:31 -08:00
Greg ShuflinandClaude Opus 5.5 bcf0270ffe android notes: make retryOnBusy a top-level function, and test it under virtual time
It takes its logging as a parameter, since android.util.Log throws on the
JVM test classpath. Adds kotlinx-coroutines-test, matched to the 1.6.4
coroutines already in use, for runTest. No injected dispatcher needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:29:31 -08:00
Greg ShuflinandClaude Opus 5.5 5ef49906fc android podcasts: pull feed-move tracking out into FeedMoves, and test it
PodcastRepository's record of where moved feeds live now (8b9c55f3b) was
untestable on the JVM because the repository reaches NativeLib. FeedMoves
holds the map, records a move (re-pointing earlier ones, so a chain and a
move back both resolve), learns moves from a reloaded subscription list,
and finds a subscription by either address. record is now synchronized:
its three writes could tear when a refresh and a reload record at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:29:31 -08:00
Greg ShuflinandClaude Opus 5.5 8b9c55f3b7 podcasts: follow a moved feed, refresh subscriptions in the background, keep cover art current
Build Debug APK / build (push) Successful in 6m31s
A feed that moves takes its subscription with it. fetch() now follows
redirects through a policy that notes a temporary one, and reports a move
(FetchOutcome::moved_to) only when every hop was a 301 or 308. refresh_feed
keeps the copy under the new address, and follows <itunes:new-feed-url> one
hop per refresh, only once the new address reads as a feed. The snapshot
names where the feed now lives; adopt_snapshot (was adopt_show) writes it to
PodcastFeedRssUrl on the same document, so episodes, listen state and the
queue carry over. Screens that opened on the old address follow it: the
desktop detail screen resolves its subscription by document id
(podcast::resolve_feed) and takes the snapshot's address; Android's
repository remembers moves and every by-address lookup follows them.

Subscriptions refresh with nobody looking. podcast::background::
refresh_due_feeds refreshes each subscription whose copy here is over an
hour old, one at a time, as a FeedRefresh job. scheduler::tick runs it for
the desktop and the daemon, P2P or not; Android's SchedulerWorker runs it
through PodcastFfi::refresh_due_feeds. adopt_snapshot now brings the newest
episode's date onto the subscription, so the list learns of a new episode
by itself. PodcastFeedLastFetchedAt, which never held a fetch time, is
renamed PodcastFeedUpdatedAt, and Android reads it instead of stamping each
row with when it was loaded.

Cover art follows the feed's. The download moves from Kotlin into the lib
(podcast::cover_art), which records the address the Thumbnail came from
(PodcastFeedCoverArtSource). Art whose source differs from the feed's art
URL is fetched again by the background pass, so a changed or previously
failed download heals. PodcastItem carries a cover_key, and Android re-reads
the bytes when it changes rather than when the URL does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 04:46:10 -08:00
Greg ShuflinandClaude Opus 5.5 2c14639815 tui: name its colors by role, in one theme module
Build Debug APK / build (push) Successful in 6m47s
Every screen styled text with a Color literal, ~65 of them, so the look
could only change site by site. They are now theme::FOCUS, CURSOR, DIM,
ATTENTION, ERROR, GOOD, BUSY, HEADING, ACCENT, TEXT_CURSOR and SELECTION,
and no color is named outside theme.rs. Nothing renders differently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 a6d346d234 TODO: make the TUI hold up on a light terminal theme
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 064e69de3e tui editor: don't hand edtui a key it can't name, which panics
edtui converts crossterm key codes with a match ending in unimplemented!(),
so Shift+Tab, a function key, Insert or a bare modifier sent to the editor
crashed the TUI. Shift+Tab is how it surfaced: keeping Tab with an open
note let Shift+Tab through too. F1 had been a crash all along. The editor
now passes on only the keys that conversion lists, and drops the rest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 0f59ad1910 tui notes: show a note by its title, its format on its pane, and t to change it
The tree showed every note as "title.md" — a suffix the desktop and
Android don't show, and the TUI's only sign of a note's format, with no way
to change it. Rows are now the bare title; the note's format (Markdown,
Typst, Plain text) sits along the foot of the preview or editor pane, where
the other clients keep their format picker beside the note; and t, a new
keymap command NextFormat, steps the selected note to the next format,
applied at once as the pickers do.

$EDITOR also gets a temp file suffixed for the note's format rather than
always .md, so a Typst note opens with Typst highlighting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 82bec04b66 notes: a daemon command to change a note's format; TextFormat::next
NoteCmd::SetFormat is set_note_format over the socket — until now only the
desktop and Android, calling the library directly, could switch a note
between Markdown, Typst and plain text. TextFormat derives VariantArray in
picker order, and next() steps through it, wrapping, for a client that
switches format with a key rather than a dropdown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 0f3c3266d0 tui: yellow marks the one pane with the keyboard, on every screen
Focus was a cyan border against a dark grey one — on a one-cell line, and
in a theme that renders cyan near white, easy to miss — while the note
editor alone used yellow. Yellow, the list cursor's color, is now the
active border everywhere, and ui::input_pane, whose only job was to differ
from that, is gone.

A color for "has the keyboard" only means something if one pane wears it,
so screens that lit every pane they drew now light the one their keys act
on: Ensemble's member list (not the identity block or the detail beside
it, and not under an open prompt), Documents' search box while typing in
it and its list otherwise.

For light terminals: text that was hard-coded white (search box, prompts,
the editor's : line) now takes the terminal's own foreground, and a
light-grey job chip is the dim grey used everywhere else. Every color stays
a named ANSI one, which the terminal theme remaps for its background.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 920955f42f tui: an open note keeps Tab rather than losing focus to the sidebar
Tab passes text fields on purpose, so a two-field form stays drivable, and
the app took it before any screen saw it — so from the note editor, in any
mode, Tab moved focus to the sidebar and left the editor open behind it.
Screen::keeps_focus lets a screen holding something left by an explicit act
keep Tab and Shift+Tab; Notes does while a note is open, and the editor
gets the key. The app-wide hints (Tab, {/}, ?) are left off the status line
meanwhile, since they would advertise keys the screen is keeping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 b07f5fd807 tui: light only the pane with the keyboard; ui::input_pane for text
Closing the note editor left the note's text on screen as the preview, in
the same lit border, beside a tree that had been lit all along — so :q
looked like it had done nothing. Now the tree is dim while the editor has
the keys, the editor's border is amber, and the read-only preview is never
lit, so leaving the editor visibly moves the highlight back to the tree.

The amber border was already how the Documents search box and the
Ensemble prompt said "keys type text here"; ui::input_pane is that, once,
and the three use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 57441ec468 tui notes: Esc in the editor's normal mode closes it, as :q does
:q was the only way out of the note editor, and nothing said so up front:
the hint listed it sixth, past where a narrow terminal cuts the line off,
after an "Esc: normal" that reads as the exit. Esc is the way out one
level everywhere else in the app and has no meaning in vim's normal mode,
so it now asks to quit — refused over unsaved edits exactly as :q is.

The key still goes to edtui first, which drops a half-typed operator on
seeing it; otherwise a refused quit would leave a `d` pending for the next
motion. The hint now leads with the way out, worded for the mode the
editor is in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 20b0e3e18c tui notes: the notebook list and an open notebook as a ListDetail
The notebook list and a notebook's tree shared one row vector and one
cursor, so opening a notebook overwrote the list and backing out rebuilt
it from the daemon. The tree, its cursor and its expanded collections now
live in an OpenNotebook over a notebook list that keeps its own, and
Notes moves between them through ListDetailScreen like Documents and PDF.

Leaving a notebook, by Back or by Left off its top level, puts the cursor
back on the notebook that was opened (including the one restored as active
at startup), and re-reads the list only if a change landed while it was
covered rather than every time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 cf5b416937 TODO: drop the shared TUI list/detail and sub-tab item, now done
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 81601ec85c tui: ListDetail, one list-plus-detail shape for Documents and PDF
Documents (tree / open document) and the PDF viewer (library / reader)
each wrote their own enum or Option for which half shows, their own Back
and Left handling, and — PDF only — a flag for a library that changed
while the reader covered it. ListDetailScreen writes the moves once: the
detail sees each key first, Back and any Left it leaves alone close it,
and a list that changed while covered is re-read as it is uncovered.

Two behavior changes fall out of it, both toward consistency:
- Documents re-reads its tree on closing a document if a change landed
  meanwhile, where it used to stay behind until the next change.
- Left on a PDF waiting for (or failed to fetch) its bytes closes the
  reader and stops the fetch, as Back does, rather than leaving it open
  behind a jump to the sidebar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 ffe6c78341 tui: a SubTab trait and tab_bar for a screen's sub-tabs
Jobs (Active/History) and the document detail (Overview/Sync) each wrote a
tab enum with a toggled(), a hand-built label strip and the rule under it.
sub_tabs::step steps any SubTab through keymap::next_tab, wrapping, so a
third tab is a variant rather than a rewrite of the toggle; tab_bar draws
the strip and hands back the content area.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 9cbbea96ce tui: one LineInput for every one-line text field
Documents' search box, Notes' name prompt, Ensemble's keyphrase/record
prompt and both first-run fields each read Esc/Enter/Backspace/Char into a
String of their own. LineInput is those keys and the buffer; each screen
keeps its own enum of what the text is for and acts on the Edit a key returns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 03:29:05 -08:00
Greg ShuflinandClaude Opus 5.5 7b69f8179b TODO: what is left of the Android visual review, without what is done
Build Debug APK / build (push) Successful in 6m41s
The entry had grown strikethroughs and notes about finished work. It now
says what landed in two sentences and lists only what remains: Notes as
two destinations on a phone, the Presence tab, remote Sync now on Android,
"Ref" as jargon, the desktop library forgetting its layout, and the open
Command Palette question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:50:43 -08:00
Greg ShuflinandClaude Opus 5.5 f2121b8998 gui: the Sync tab's placement rows fit, and the document id is a chip
The placement section capped itself at 720px while one row needs about
850 (four columns, the Pin/Exclude picker and a button), so the row
overflowed and the picker's Exclude was clipped off. The cap goes; the
Sync body is already held to CONTENT_MAX_WIDTH. And the node name, which
nothing truncated, spilled out of its flex column and printed over the
Node ID: the cell now clips and the name gives way in the middle, with
"(this node)" kept whole.

The Overview's ID row printed the document's full UUID as text; it is a
HashChip now, like every other id on the screen (ADR 0032 §5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:50:21 -08:00
Greg ShuflinandClaude Opus 5.5 025994a3fd android: the comic reader's page arrows at the row's ends, like the PDF viewer's
They sat together in the middle; the PDF viewer has them at the two ends,
at full touch-target size, where a thumb finds them without looking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:47:38 -08:00
Greg ShuflinandClaude Opus 5.5 5b409c86d0 android: the note preview has page margins
The rendered note ran edge to edge: on paper, its first letters and its
tables touched the screen's side. MarkupView's list now carries a 20dp
reading margin as content padding, so the page still scrolls to its own
edges. Notes as two destinations on a phone (A8's other half) is still
open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:42:43 -08:00
Greg ShuflinandClaude Opus 5.5 8e44742fae documents: one presence rule for every list, and Android's list shows it
Android's document list said nothing about whether a row's content was on
this node; the desktop's has a Presence column (ADR 0032 §7). The rule
behind that column lived in gui-app, so it moves to the lib —
RowPresence and SubtreeContent::row_presence, with the word from
copy::content_presence::row_label — and the desktop list uses it from
there. The FFI DocumentItem carries the presence and its label, and
Android's rows draw them as the desktop does: a green dot Here, a green
ring for Partial ("3 of 10"), an empty outline Not here, nothing for a
row with no content.

And one word for the state: the media libraries said "Remote" where the
document list said "Not here", on both modalities. DocumentAvailability's
label now returns copy::content_presence::NOT_HERE (and NO_SOURCE, newly
in copy) — so every library, desktop, Android and TUI, says "Not here".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:41:35 -08:00
Greg ShuflinandClaude Opus 5.5 fa4789382c android: the Detail screen's node lists say how many of them hold a copy
The document's node list (all Present) and its artifact's (Ref, Not here,
Present) read as two answers to one question. The desktop labels each
with a count — "2 of 3 here", "1 of 3 here" — that says what is being
counted; Android's Nodes labels now carry the same one, from
copy::content_presence::nodes_here (newly exported), counting the Here
look exactly as the desktop's heading does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:26:36 -08:00
Greg ShuflinandClaude Opus 5.5 4e5a27fbaa android: editing a remote node's sync policy says which node, and whether it connected
The desktop shows "Editing laptop — connecting…", "— connected" in
green, or "— unreachable: reason" in red over a peer's policy; Android
showed only the selected chip, so the one screen whose edits leave the
device confirmed nothing. Android now has the same line from the same
copy (editing_connecting/connected/unreachable, newly exported), and the
section below says "see the status above" on failure — both modalities
pass None to remote_config_unreachable now. The desktop's remote Sync now
is still missing on Android; noted in TODO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:21:45 -08:00
Greg ShuflinandClaude Opus 5.5 486633d2aa android: the last cobalt at rest
ADR 0032 §4: no cobalt while nothing is happening. Document detail's
"this node" was an accent-filled chip; it is dim words, as the desktop's
"(this node)". Artifact kinds (primary_content) and every finished
outcome sentence — an eviction's result, the node name's "Saved", the
eviction dialog's verified line — move to text_secondary, and the Notes
tree's notebook and folder icons to the dim tier. The sync-policy line
saying content is still missing becomes amber, attention, rather than
blue. Cursors, links, selection, the live nav slot, in-flight streaming
and the pomodoro's running phase keep the accent: those are energised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:16:33 -08:00
Greg ShuflinandClaude Opus 5.5 b8ac6d9e93 android: the home screen's agents are flat rows, not sixteen cards
Each agent was a bordered bg_card surface, so the screen every session
starts on was a stack of panels where the desktop rail is flat rows on
the floor. IconRowButton (now home-only, since Import left the libraries'
bars) is a transparent row with its icon in the dim tier, and the list
draws a hairline between rows as every other list does. ADR 0032 §5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:15:12 -08:00
Greg ShuflinandClaude Opus 5.5 c92f52ad9b android: cards, segmented buttons and sliders through ui/; ADR 0055 accepted
The last stock components a screen reached for directly. The keyphrase
word tiles and the revoked-node notice are RecordCards, and ErrorCard is
built on one with its text in the error color. Notes' view switcher is
SegmentedIconChoice, beside SegmentedChoice. The PDF page scrubber and the
custom-rate slider join MediaSlider on ScrubSlider, so every slider has
one thumb and one slim, gapless track. detekt bans Card and its variants,
SegmentedButton and Slider outside their wrappers (each proven against a
probe), which completes ADR 0055: Accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:14:03 -08:00
Greg ShuflinandClaude Opus 5.5 515a7e7783 podcasts: the whole episode title on Android, and the last rate chosen is remembered
Android showed a long episode title nowhere in full: the header and the
player each cut it to one line. The episode screen now leads with it,
wrapping and selectable, as the desktop's episode page does.

A preset rate changed only the session, so it reset on the next episode.
Settings gains podcast_playback_rate, node-local like the library layout:
the rate last chosen anywhere in Podcasts, written once a choice settles
(a slider drag is one write), and used for an episode whose feed
remembers no rate of its own. A non-finite or non-positive rate is never
stored. The per-podcast/per-episode rate that should replace this, the
same on every modality, is a TODO under Podcast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwdd4TcVj5CG3aYu8Ut
2026-11-03 01:11:22 -08:00
Greg ShuflinandClaude Opus 5.5 f6eee8aea7 android: text and outlined buttons carry a role; dialogs confirm with a filled button
Material draws TextButton and OutlinedButton in `primary`, so every idle
Save, Cancel, Copy, Edit and "+ Queue" in the app was cobalt — ADR 0032
§4 says no cobalt while nothing is happening. All 70 sites move onto
TextAction/OutlinedAction with a TextRole: Neutral (text_primary, as the
desktop's Secondary buttons), Destructive (the error color, replacing
seven hand-rolled red overrides), or Link (the accent, for navigation —
the job widget's "Jobs"). A dialog's affirmative action becomes a
FilledButton, Primary or Destructive, with Cancel a quiet TextAction, as
the desktop's dialog footer has it. detekt bans both stock composables
outside their wrapper (proven against a probe).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:57:20 -08:00
Greg ShuflinandClaude Opus 5.5 6b021a09dc settings: remember each media library's cards/list layout, node-locally
The layout toggle in Comics, PDF Viewer, Music and Video reset to cards
every time the screen was left (rememberSaveable only outlives a
rotation). Settings gains library_layouts, an AgentId -> LibraryLayout
map in the node-local settings store — never synced, since a phone and a
desktop wanting different layouts is right — with get/set over the FFI.
Android's MediaLibrary takes its agent, reads its layout from there and
writes each switch back; its local LibraryLayout enum gives way to the
shared one. The desktop's library still holds its layout as view state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:53:47 -08:00
Greg ShuflinandClaude Opus 5.5 37663ba085 android: library tabs live in the header, and Import is a header action
The Comics, PDF, Music and Video libraries drew their tab row inside
MediaLibrary, so it sat under the screen's search — the reverse of every
other tabbed screen — and Comics, PDF and Video had a full-width Import
bar above it while Documents had Import in its header. The active tab is
now held by the screen (rememberLibraryTabs, which also keeps the finder
tabs' snap-back) and its row passed to AgentScreen; MediaLibrary renders
the active tab. Import is rememberImportAction, a HeaderAction.Primary
owning the picker, worded "Import" as the desktop's is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:42:33 -08:00
Greg ShuflinandClaude Opus 5.5 9658cb7faf android: every screen on AgentScreen/RecordScreen/ViewerScreen, actions as data
HeaderAction makes a header action a value with a kind — Primary (a word:
Import), Daily (an icon: Add, Refresh, with a busy spinner for a running
job), Menu (the overflow ⋮, named by the new copy::action::MORE_ACTIONS)
and Toggle (the comic reader's direction chip) — and the scaffolds draw
them, so ADR 0032 §5's icon rule is applied in one place. Every remaining
SubAppScreen call site moves onto the scaffold for its role: fifteen
agent screens, five records, three viewers. Along the way: Notes settings
and Podcast info become menu items; Clippings' hand-built scrapbook menu
becomes menu actions, its Delete marked destructive; Podcasts, Clippings,
Jobs and Document detail take their tabs as ScreenTabs; Music's rebuild
keeps its job-bound spinner as a busy Daily action.

detekt now bans SubAppScreen, filled Button and the TabRow family outside
their one wrapper each (each matcher proven against a deliberate probe).
ADR 0055 records the Toggle kind, the scrapbook exception and the bans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:28:51 -08:00
Greg ShuflinandClaude Opus 5.5 34c27b6a2d TODO: the Android visual review is run; what of its fixes remains
The two entries this review started from become one, saying what landed
and what is left, in the critique's order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:44:27 -08:00
Greg ShuflinandClaude Opus 5.5 38ac78fb8a android: tabs are words, and one tab is no tab row
SectionTabs loses its icon parameter, so no screen can ask for an icon
tab: Document detail and the Podcasts library carried icon-and-label
tabs while every other screen, and the desktop, used words. And
SectionTabs draws nothing for fewer than two entries — PDF Viewer's
library showed a row with a single "Library" tab. ADR 0055 §2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:44:03 -08:00
Greg ShuflinandClaude Opus 5.5 3a0a0ab2eb android: no back arrow; system back is the only back
Every header ended in an Up arrow that did exactly what system back did —
SubAppScreen already wired both to onBack — and nothing enters the app
mid-hierarchy for the two to differ. It cost the right end of every title
row, and on Human detail sat beside a destructive action. Gone from
SubAppScreen and from the setup forms (which keep onBack as a
BackHandler), and BackButton with it. Lands after RecordScreen, so edit
mode's Back already means Cancel. ADR 0055 §3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:41:26 -08:00
Greg ShuflinandClaude Opus 5.5 6bbdb015c9 android: RecordScreen, and Human detail on it — Back while editing is Cancel
System back in Human detail's edit mode left the screen, dropping the
staged edit without the user choosing Cancel. RecordScreen owns what Back
means for a record: while editing it is Cancel, the same act as the
button. It also sets the record's name as a compact title and takes its
tabs as ScreenTabs, so Profile/History are words like every other tab.

Delete leaves the header, where it was a trash icon one icon-width from
the back arrow, for a worded button at the foot of the read view beside
Edit — where the desktop puts it. ADR 0055 §§1-3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:39:05 -08:00
Greg ShuflinandClaude Opus 5.5 130aadb290 android: Settings is one header with its tabs beneath, via AgentScreen
Each Settings section drew its own SubAppScreen under the tab row, so the
tabs sat above the title and the title changed per tab. AgentScreen fixes
the order (title, tabs, search, content) and takes the tabs as data
(ScreenTabs): words only, scrollable past three, no row for fewer than
two. Each section draws the shared Settings header with the tabs handed
to it, so Ensemble's refresh stays beside its state and the node drill-in
replaces the tabbed frame instead of nesting in it. SettingsSection loses
its tab icons.

ADR 0055: its open questions settled in review (destructive actions at
the foot, icons only for daily actions, no back arrow), and its order
corrected to tabs above search, as Podcasts already had it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:36:26 -08:00
Greg ShuflinandClaude Opus 5.5 e2d4e57ed3 android: filled buttons and sections name their role
FilledButton takes a required ButtonRole: Primary fills with accent_fill
(white on it 5.17:1, where stock Button's accent was 3.47:1), Destructive
with color_error. The document detail screen's sections are Section, flat
on the ground under their heading rule like the desktop's, instead of
stock Cards in the groove color; clippings, podcast search results and
Human interactions are RecordCard, bg_card with a hairline.

RecordCard names its content color: errorContainer and surface are both
bg_card, and contentColorFor() matches errorContainer first, so an
unnamed one drew its text red. Noted at the mapping in Theme.kt.

The first components of ADR 0055 §4; the detekt bans wait for the
remaining call sites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:28:41 -08:00
Greg ShuflinandClaude Opus 5.5 862868b325 android: secondary and tertiary containers are the groove, not cobalt
Theme.kt mapped them to accent_fill, but Material uses secondaryContainer
as a quiet surface: it is every Slider's inactive track, so each scrubber
drew #4585ff progress on a #2563eb track and read as full at any
position. They take bg_raised now, and the choice controls that should be
cobalt when selected (segmented buttons, filter chips) state the
selection block themselves via ui/theme/SelectionColors.kt. The podcast
transcript cue and current chapter, which read the slot directly, become
a quiet current-row mark: text_primary on accent_fill was ~4.1:1.

ADR 0032, "Secondary and tertiary containers are quiet".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:18:31 -08:00
Greg ShuflinandClaude Opus 5.5 1d4caccb7f android: the ground runs under the system bars, and their icons follow it
The root Surface padded itself by the safe-drawing insets, so the bars
showed the window theme's light background: a white strip top and bottom
on both grounds. And enableEdgeToEdge()'s default style took the icons'
color from the system's dark setting, so Charcoal on a phone in dark mode
drew white icons on that white strip. The Surface now fills the window
with the content inset inside it, the theme re-issues the bar style from
its own ground, and the window theme is dark in Charcoal's ground so a
cold start doesn't flash white. Drops colors.xml's template purples.

ADR 0032, "The ground runs under the system bars".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:18:24 -08:00
Greg ShuflinandClaude Opus 5.5 453e85610f ADR 0055 (proposed): Android screens are assembled from roles
Three scaffolds own placement, actions and tabs are data, system back is
the only back, controls carry their role, and detekt bans the raw
Material composables outside ui/. A draft for review before any code
depends on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:11:51 -08:00
Greg ShuflinandClaude Opus 5.5 2a8094f36a ADR 0032: containers are quiet, the ground runs under the system bars
Two amendments from the Android visual review, plus a correction to
Implementation status: Command Palette is still a rail row, and whether
it stays is open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:11:51 -08:00
Greg ShuflinandClaude Opus 5.5 780abf87c0 fonts: vendor Inter Bold and Source Serif 4 Bold
Seventeen desktop call sites (and eight on Android) ask for weight 700,
but only Regular/Medium/SemiBold were vendored, so the text system
thickened a lighter face: the selected tab label read as smeared, and
markdown **strong** in prose was synthetic too. Both faces come from the
release archives the script already fetches; everything else re-vendored
byte-identical. Which roles take Bold rather than SemiBold is still
undecided, and is now a TODO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:11:51 -08:00
Greg ShuflinandClaude Opus 5.5 8c0ba369a0 design: Android visual review critique
Two passes over the captures: Android on its own terms (system bars, the
Material slots the ADR 0032 projection gets wrong, header and tab grammar),
and Android set beside the desktop's same screens, which is where the
absences show up (presence in lists, the remote-policy status line). Also
the desktop defects the comparison turned up, including synthetic bold from
a missing Inter Bold face, and a candidate answer for presence on a phone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 22:50:11 -08:00
Greg ShuflinandClaude Opus 5.5 3f136109a8 TODO: two non-visual bugs the Android visual review turned up
A note body written after creation reads as absent on other nodes (and the
desktop offers to start it over), and a comic's pages land in Pictures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 22:46:45 -08:00
Greg ShuflinandClaude Opus 5.5 3d759d8003 design: desktop counterparts for the Android visual review
Live syn-gui on the same seeded test ensemble, so each Android capture has
a desktop one of the same record to set beside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 22:46:10 -08:00
Greg ShuflinandClaude Opus 5.5 6d2ce41870 design: Android visual review captures, Charcoal and Slate
Pixel_9 emulator (1080x2424, 420dpi) on the test ensemble, seeded with
just seed-node. Content is deliberately mostly remote, so the
lives-on-another-node states are on screen. *-syslight / *-sysdark are the
app's theme shot against the opposite system setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 22:26:35 -08:00
Greg ShuflinandClaude Opus 5.5 bf0fce0c9a dev: just seed-node, a node in the test ensemble filled with sample content
scripts/seed-content.sh synthesizes PDFs, pictures, a comic, tagged music
and a video (typst/ImageMagick/ffmpeg, fixed seeds); the recipe imports
them into a fresh node joined to PERSONAL_TEST_ENSEMBLE_PK and adds notes,
humans and clippings through the CLI, then leaves its daemon serving them.
Seeding one node is how a GUI and an emulator get matching screens to
compare, which the Android visual review needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 22:12:05 -08:00
Greg ShuflinandClaude Opus 5.5 695a34cb43 cli: syn notes note write, replacing a note's body from stdin
The daemon has had NoteCmd::Update all along (the TUI uses it); the CLI
just never exposed it, so a script could make a note but not give it a
body. Stdin rather than an argument, as clippings capture does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 22:12:05 -08:00
Greg ShuflinandClaude Opus 5.5 c367f36fa8 design: Android review README allows the emulator, and asks for theme-vs-system captures
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 22:06:04 -08:00
Greg Shuflin 092d16a4df New test ensemble key
Build Debug APK / build (push) Successful in 5m14s
2026-11-02 21:40:59 -08:00
Greg Shuflin f3b027c33d Removed Podcast Index key 2026-11-02 21:32:33 -08:00
Greg ShuflinandClaude Opus 5.5 0dd26a3302 android podcasts: a + icon for Add in the header, like Humans and Clippings, rather than a wrapping Add New button
Build Debug APK / build (push) Successful in 6m54s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 20:08:48 -08:00
Greg ShuflinandClaude Opus 5.5 2320f6fb8d android podcasts: a Subscribe button in the podcast screen's header, beside the cover
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 19:55:52 -08:00
Greg ShuflinandClaude Opus 5.5 aa5e406129 android podcasts: put the subscriptions search under the tab row, so switching tabs doesn't move it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 19:55:52 -08:00
Greg ShuflinandClaude Opus 5.5 b82c4dd9b0 ci: hand the APK build only symlink-free paths, so askama finds askama.toml
Build Debug APK / build (push) Successful in 19m59s
With the cache directory fixed, the Build APK step got as far as
generateDebugUniffiBindings and failed compiling uniffi_bindgen: every
#[derive(Template)] said "couldn't read …/private/gitea-runner/…/askama.toml".

The runner's unit has DynamicUser=, so /var/lib/gitea-runner is a symlink to
/var/lib/private/gitea-runner, and cargo's registry — $HOME/.cargo — sits
under it. askama_derive 0.16 canonicalizes the config path and diffs it
textually against the caller's un-resolved directory; the OS resolves the
resulting ../.. from the physical directory, one level deeper, and lands in a
nonexistent /var/lib/private/private/…. It is the bug the flake worked around
for crane's symlinked vendor dir (lvvvvsqzvvpp), met here through systemd.

CARGO_HOME and the cache directory are now realpath'd before anything uses
them. CARGO_HOME is the same physical directory as before, so the registry
already downloaded is reused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 18:11:09 -08:00
Greg ShuflinandClaude Opus 5.5 ef3f074219 ci: take the first of STATE_DIRECTORY's entries for the APK build cache
Build Debug APK / build (push) Failing after 12m35s
The Build APK step failed with "mkdir: cannot create directory
'/var/lib/gitea-runner:': Read-only file system". systemd sets
STATE_DIRECTORY to a colon-separated list when a unit has more than one
StateDirectory=, and the runner's unit evidently gained a second: used
whole, CACHE_DIR became "/var/lib/gitea-runner:/var/lib/…/cache", and mkdir
tried to create a directory named for the first entry plus a colon in
/var/lib, which the unit's sandbox mounts read-only. The script hadn't
changed since August; the runner host had.

The first entry is the unit's own state directory, where the cache has
always lived, so the warm cargo/gradle/sccache state carries over.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 17:47:02 -08:00
Greg ShuflinandClaude Opus 5.5 82e9e44378 podcast: retire the keyed Podcast Index API, and ServiceId::PodcastIndex with it
Build Debug APK / build (push) Failing after 19s
docs/podcasts-from-rss.md phase G. Nothing called search_podcasts or
get_podcast_episodes after phases D–F, so they go, with index_get, the SHA-1
request signing (and the sha1 dependency), PodcastSearchResult,
PodcastIndexEpisode, PodcastIndexError and the live-API test. The search-term
encoding test moves to podcast::directory, now against the real request
builder (search_request) rather than reqwest alone.

ServiceId loses its only variant, as decided. The credentials mechanism stays
(ADR 0051, amended): the tests run on a #[cfg(test)] service, and the desktop
and Android Credentials screens say "Nothing this app talks to needs a key
right now" (copy::credentials::NO_SERVICES). ServiceId is no longer a uniffi
enum — uniffi's Kotlin for an empty enum doesn't compile — so the FFI names a
service by its stored name, and ServiceCredential carries its own clear
warning.

TODO.md: the rotation item now says nothing in the tree uses the key, and the
podcast section loses its retire-the-keyed-code item. docs/rss-reader.md no
longer describes the podcast agent as it was before this plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 17:12:50 -08:00
Greg ShuflinandClaude Opus 5.5 4d7b40bba7 android podcasts: a rich episode screen — show notes, chapters, transcript, people
docs/podcasts-from-rss.md phase F. The episode screen keeps its header and
player and, between them, gains the desktop's tabs (SectionTabs), each shown
only when the feed has something for it: show notes whose links open in the
browser (LinkAnnotation), the episode's page and any video as links out;
chapters, the playing one marked; a transcript in a LazyColumn with speakers;
and people with their pictures and roles. Read through PodcastFfi's
episode_detail, episode_chapters and episode_transcript — chapters when the
screen opens, the transcript when its tab is first chosen.

Tapping a chapter or a transcript line seeks there and plays. The transcript
follows the line being spoken until the user drags it, and Follow along
brings it back. chapterAt and cueAt restate the lib's chapter_at and cue_at
so a position tick doesn't carry the lists across the FFI, and a test holds
them to the lib's cases.

The screen's words come from copy: the tab names and loading/follow labels
join PodcastsCopy, and the failure, role and video sentences are exported
functions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 16:04:10 -08:00
Greg ShuflinandClaude Opus 5.5 1560362df4 desktop podcasts: a rich episode screen — show notes, chapters, transcript, people
docs/podcasts-from-rss.md phase E, desktop. Below the episode's header, tabs
for what the feed says about it, each shown only when there is something:
show notes with clickable links (components::rich_text), the episode's page
and any video as links out; chapters, the playing one marked; a transcript,
virtualized as gpui's list, with speakers; and people with their pictures
and roles. [ and ] step through them.

A chapter or a transcript line is a place in the episode: clicking one seeks
there, or starts the episode from there. PlayerControls gains seek_to (held
until a loading stream opens rather than dropped), play_from, position_in,
and streaming, which recognizes an episode of an unsubscribed feed by its
enclosure since it has no document. While the episode plays, the transcript
follows the line being spoken until the user scrolls it out of view; Follow
along brings it back.

Chapters are fetched when the screen opens, the transcript when its tab is
first chosen.

Also the plan and TODO.md mark phase E built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 15:53:50 -08:00
Greg ShuflinandClaude Opus 5.5 8867d72e45 podcast: an episode's detail, chapters and transcript, read through this node's copy
docs/podcasts-from-rss.md phase E, lib half. podcast::episode_detail reads
what an episode's own screen shows beyond its row out of this node's copy of
the feed: show notes, its page, people (the show's when it names none),
alternate enclosures, season/episode/type, and where its chapters and
preferred transcript are. episode_chapters and episode_transcript fetch those
files as FeedRefresh jobs through the same per-node cache: this node's copy
while it is under an hour old, else fetched again conditionally, else the
copy anyway when the fetch fails.

cache::fetch_and_keep is now generic over what a body is read as, so feeds and
the files they point at share the conditional fetch, the refuse-before-keep
rule and the blocking-pool decode.

feeds::rich_text turns publisher HTML into lines of runs carrying a link,
bold or italics (html2text's rich output), so show notes keep clickable links
without an HTML renderer; only http, https and mailto links survive.

PodcastFfi gains episode_detail, episode_chapters and episode_transcript for
phase F; the parsed types they return derive uniffi records and enums.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 15:53:49 -08:00
Greg ShuflinandClaude Opus 5.5 eccdb6316e android podcasts: episode lists from the cached feed, keyless search, open by feed address
docs/podcasts-from-rss.md phase D, Android and its FFI. PodcastFfi gains
cached_feed and refresh_feed (a FeedRefresh job), search moves to the keyless
directory, fetch_episodes is gone, and podcast_feed_url canonicalizes a
pasted address with the error said in copy's words.

The detail screen opens on the cached copy and refreshes behind it when it
is stale; a refresh that lands on its own goes through IncomingEpisodes, and
the new Refresh action replaces the list outright. Paging is gone — the
whole feed is local. A first fetch that fails falls back to the episodes
this node holds documents for. What the feed says about the show (title,
description, artwork) becomes the in-memory podcast, so a podcast opened by
its address fills in once read; the info screen holds Subscribe until then.

Search rows show the author and an episode count; the feed-address field
sits under the search box.

Also: TODO.md loses the moot "load more" item and gains the follow-ups
phase D leaves — moved feeds, background refresh, refreshed cover art.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 14:42:35 -08:00
Greg ShuflinandClaude Opus 5.5 cc2359fb42 desktop podcasts: episode lists from the cached feed, keyless search, open by feed address
docs/podcasts-from-rss.md phase D, desktop. A podcast's screen opens on this
node's copy of its feed (podcast::cache), read and parsed on the background
executor, and fetches the feed again behind it — awaited on tokio as a
FeedRefresh job — when there is no copy or it is stale. A refresh that lands
on its own goes through SyncGuarded: applied in place only while the user is
at the top, held behind the "N new episodes" strip otherwise. Refresh
replaces the list outright, since the user asked for it. A first fetch that
fails falls back to the episodes this node holds documents for.

The list is virtualized as gpui's list (ADR 0037; LUP is 691 rows), with the
show's header as item 0 so the screen still scrolls as one, and the held
strip outside it. What list has measured is re-measured from a hash of what
the header draws, checked each render, so no path that changes the header
has to remember to.

Search uses the keyless directory: rows carry an episode count instead of a
description, which the podcast's screen now reads from the feed. A second
field opens a podcast by its feed's address; its screen holds Subscribe
until the feed has said what the show is called.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 14:42:35 -08:00
Greg ShuflinandClaude Opus 5.5 3b7af64731 podcast: episode lists from a cached feed, and a keyless directory search
docs/podcasts-from-rss.md phase D, lib half. stores::feed_cache keeps this
node's last copy of each feed it fetched — the raw body, gzipped, with its
ETag/Last-Modified and when it was last confirmed — node-local and never
synced, since every node can fetch the publisher's copy itself. Raw rather
than parsed, so what later screens read out of a feed (chapters,
transcripts) comes from the same bytes.

podcast::cache: cached_feed opens on that copy with no network;
refresh_feed fetches conditionally (32 MiB / 120 s limits), refuses a body
that isn't a feed before it replaces a good copy, and does the decompress/
parse/store on tokio's blocking pool. refresh_feed_job runs it as a tracked
JobKind::FeedRefresh keyed by the feed's address, and afterwards brings a
subscription's title, author, description, artwork and podcast:guid up to
date with the feed (adopt_show), writing only what changed. A snapshot says
whether it is stale (older than an hour), so every modality refreshes on
the same rule.

podcast::directory searches Podcast Index's Apple-compatible endpoint, which
needs no key; results carry a canonical feed URL and no description.

Copy for the refresh, the feed-address field, and an episode count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 04:56:42 -08:00
Greg ShuflinandClaude Opus 5.5 bc2f57501a podcast: identify feeds by URL and episodes by guid, not by Podcast Index ids
docs/podcasts-from-rss.md phase C. A subscription is found by its canonical
feed URL (feeds::canonical_feed_url: case, default port, fragment and an
empty path's slash normalized; the query left alone), and an episode's
document id derives from (feed document, item guid). PodcastIndexFeedId is
gone, PodcastEpisodeApiId is PodcastEpisodeGuid, and PodcastFeedGuid holds
<podcast:guid>. SYNC_PROTOCOL_VERSION moves for the renamed variants; stores
are recreated, with no conversion.

Both frontends navigate by feed URL: the lib canonicalizes search results'
URLs, so a result and a subscription match by plain comparison in Kotlin as
on the desktop. Episodes are still listed by the keyed API, now asked by
URL (episodes/byfeedurl), and the directory echoes the feed's own <guid> —
so a document written today keeps its id when phase D reads the feed itself.
A directory episode with no guid falls back to its link, as feeds::parse does.

Android keys an episode by feed and guid together (PodcastEpisode.id), since
a guid is only reliably unique within its feed; the FFI still speaks guids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 04:27:49 -08:00
Greg ShuflinandClaude Opus 5.5 810d25d19a docs: the feed layer is built, on the rss crate
docs/rss-reader.md §2 now describes the phase 0 that landed rather than the
feed-rs one it proposed, and puts Atom and JSON Feed in phase 1.
docs/podcasts-from-rss.md marks phases A and B built, records why the parser
changed and the second podcast: namespace URI, and points §3.3 at the
fixtures' README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 03:23:55 -08:00
Greg ShuflinandClaude Opus 5.5 56f31bac73 podcast: parse chapters and transcripts
podcast::chapters reads the Podcasting 2.0 JSON chapters file, sorted, keeping
img/url/toc; chapter_at finds the navigation chapter at a playback position.
podcast::transcript reads the JSON transcript format, WebVTT (speakers from
<v Name>) and SRT into timed cues, and HTML or plain text into an untimed
document. preferred_transcript picks among an episode's offers by format —
JSON, VTT, SRT, HTML, text — recognizing a file by MIME type or, when that is
missing or wrong, by extension; cue_at finds the line being spoken.

Third-party files: a chapter or cue that can't be placed is skipped, never a
panic, and a timed transcript with nothing readable is NoCues. Checked against
the whole LUP 691 VTT and SRT (1654 cues each) and Podcasting 2.0's SRT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 03:23:05 -08:00
Greg ShuflinandClaude Opus 5.5 67200625e8 podcast: read a show and its episodes from the feed's own namespaces
agents/podcast becomes a directory, and podcast::feed turns a ParsedFeed into
a ParsedPodcast: podcast:guid, itunes:new-feed-url, artwork, funding, people
and the value block for the show; duration, season/episode, type, subtitle,
chapters and transcript references, people, alternate enclosures and value
for each episode. The generic ParsedItem rides along inside each episode, so
show notes stay raw HTML and a publisher's own namespace (jb:sponsor) is
still there for whoever wants it. Nothing names a directory or its ids.

A podcast:person keeps whatever role the feed gives it (lowercased), and one
with no role is a host, per the spec. Elements missing what makes them usable
are dropped rather than failing the feed.

feeds::parse resolves the Podcasting 2.0 namespace's original GitHub URL to
today's: Podcasting 2.0's own feed and No Agenda still declare it, and without
the alias neither showed a single chapter, transcript or person.

Fixture: LINUX Unplugged trimmed to two items (fixtures/README.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 03:15:06 -08:00
Greg ShuflinandClaude Opus 5.5 5dcae3f939 feeds: a generic RSS fetch-and-parse layer on the rss crate
agents::feeds is the foundation docs/rss-reader.md's phase 0 describes, built
first for podcasts (docs/podcasts-from-rss.md phase A). parse() reads RSS 2.0
into our own ParsedFeed/ParsedItem and keeps every element outside RSS's own
vocabulary as an ExtensionElement with its namespace resolved; iTunes, Dublin
Core and syndication, which the crate lifts into typed structs, are put back
into that same list so a reader finds itunes:duration and podcast:chapters the
same way. Items get the plan's guid fallback (guid, link, blake3 of title and
date-as-written) and a repeated guid keeps the first.

The plan named feed-rs; it drops unfamiliar namespaces, and a podcast:person
role outside its fixed list fails the whole feed. The rss crate keeps both.

fetch() bounds body size (after decompression) and time per caller, sends
stored validators, and negotiates gzip — reqwest's gzip feature is on now,
because a podcast feed is its whole back catalog. PRODUCT_USER_AGENT replaces
url_import's hand-written one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 03:04:33 -08:00
Greg ShuflinandClaude Opus 5.5 25507b8b33 docs: plan podcasts from RSS — rich episodes, no API key
Build Debug APK / build (push) Failing after 18s
docs/podcasts-from-rss.md: the chapters, transcripts, people, show notes
and video a rich episode screen needs are all in the feed, which Podcast
Index only partly re-serves (checked against Linux Unplugged 691). Search
has a keyless endpoint, and Podcast Index's terms forbid embedding a key in
an open-source project, so the plan reads feeds directly, rekeys feeds and
episodes on URL/podcast:guid and <guid>, and retires the keyed path.

TODO.md and rss-reader.md's phase 6 point at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 01:40:44 -08:00
Greg ShuflinandClaude Opus 5.5 bdf1e347b0 tui: open a PDF stored elsewhere by fetching it, with the shared progress display
Build Debug APK / build (push) Failing after 5m20s
The TUI's reader showed a PDF stored on another node as "not here, press s
to pull". Opening one now fetches it as the desktop does, and the reader
shows the transfer through copy::content_fetch — connecting, the byte counter
under a rule that fills when the total is known, wedged in the warning
color, a failure with r to try again. c or Esc cancels it and leaves. The
job rows are read every 500ms, since a stall sends no event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 00:48:33 -08:00
Greg ShuflinandClaude Opus 5.5 c473cc8b78 daemon: PdfCmd::Fetch streams a PDF from a peer; job rows carry byte counters
A client of the daemon had no way to open a PDF stored on another node short
of pulling it here for good. PdfCmd::Fetch runs the same fetch the desktop
reader does (fetch_pdf_bytes_remote, a cancelable ContentStream job) and
writes the bytes to the caller's path. JobSnapshot gains bytes_done and
bytes_total, so a client can show that transfer's progress through
copy::content_fetch rather than only a blended fraction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 00:48:33 -08:00
Greg ShuflinandClaude Opus 5.5 96c9dbf11b tui: keep the screen across the restart after a first run
Build Debug APK / build (push) Failing after 18s
The first run gave the terminal back before exec'ing itself, so the shell
underneath showed for as long as the new process took to start the daemon.
The exec now happens with the terminal still taken; the new process knows
it holds it (SYN_TUI_RESTARTED) and gives it back if it fails before
drawing, and clears once on taking it so the first-run screen can't show
through the main one's blanks. With logs off the screen, the first run no
longer needs to repaint after its setup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 00:18:44 -08:00
Greg ShuflinandClaude Opus 5.5 e9fd82999f tui: log to tui.log in the store, not over the screen
The logger wrote to stdout, which in the TUI is the screen; the first run's
setup publishes to the DHT from the TUI's own process, and pkarr's warning
about a malformed reply landed on top of the first-run screen.
init_logger_to sends the lines to a writer instead, uncolored, and the TUI
gives it tui.log beside daemon.log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 00:18:44 -08:00
Greg ShuflinandClaude Opus 5.5 b1cdf40573 deps: iroh on aws-lc-rs, so ring is no longer compiled
Build Debug APK / build (push) Failing after 18s
Two rustls crypto providers were built: aws-lc-rs for every HTTPS client
(pkarr's relays, our reqwest, http.rs's explicit provider) and ring for
iroh's QUIC, through iroh's default tls-ring. aws-lc-rs is the one with
post-quantum key exchange, so iroh moves to it — its defaults with
tls-aws-lc-rs in place of tls-ring — rather than everything moving to
ring and giving that up.

cargo tree -i ring now prints nothing, on every target and edge kind.
aws-lc-sys was already being built, so the saving is ring's own native
build and its code in the binaries. rustls's default features are what
turn on prefer-post-quantum, so iroh's QUIC between our nodes now leads
with X25519MLKEM768 as our HTTPS already did; the workspace's rustls
line says so, so nobody disables them by accident.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 23:33:18 -08:00
Greg ShuflinandClaude Opus 5.5 5f52ac3044 TODO: correct items that work since has overtaken
Build Debug APK / build (push) Failing after 10s
From an audit of every item against the code and history:
- Capability scoping is done (8d9b6a65); the bullet goes.
- A saved podcast episode is already governed by content policy; what
  is open is the back catalog nobody saved.
- Comics dedup on re-import (ADR 0054); the other importers don't.
- Title search is text_match(), not LIKE — also in ADR 0034, whose
  FTS5 option now notes that a trigram index folds differently.
- The peer walk skips revoked peers; its asset-sync pointer is fixed,
  here and in the scheduler's doc comment.
- Document-detail pulls show bytes and a percentage; the desktop just
  draws no bar.
- Syncs are jobs and the nav rail shows them running; the open gap is
  an ambient succeeded/failed signal. The TUI has an error popup; Video
  and Music also toast.
- Android already has the foreground service and network-constrained
  worker the slow-sync suspect asked for; the question is why it was
  blocked anyway.
- Command names, and a screenshots/ folder that never existed.
- "Queue a sync directive" moves to Core Functionality, which also
  puts the Documents bullets it had split back together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:38:34 -08:00
Greg ShuflinandClaude Opus 5.5 a3b2e4b9ab TODO: the pkarr 8 item is done; its registry-race property joins formal methods
pkarr 8.1 (the latest release) and the port landed in 1485b19b, which
accepted the lost compare-and-swap and documented the race in
publish_membership and BOOTSTRAPPING.md. What the item still had worth
keeping is the property "no registered node is lost from the registry"
under concurrent registration, now a candidate in the formal-methods
section with the fixes a spec should check first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:37:29 -08:00
Greg ShuflinandClaude Opus 5.5 22a6286033 docs: ADR 0039 — deleting clippings and scrapbooks is a purge, and asks first
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:37:29 -08:00
Greg ShuflinandClaude Opus 5.5 5e457b0097 android: Clippings deletes are confirmed purges
Deleting a clipping now asks first, as deleting a scrapbook did; one
DeleteDialog serves both and says the delete reaches every node. Both
call the FFI purge on Dispatchers.IO, since it blocks on the broadcast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:37:29 -08:00
Greg ShuflinandClaude Opus 5.5 1184dd05ef gui: Clippings deletes are confirmed purges; one purge path for the desktop
purge::purge_and_announce is the detail view's purge body lifted out:
the tombstone and the signing read on the background executor, the
broadcast on tokio. The document detail screen and the Clippings screen
both use it. Deleting a clipping now asks first, as deleting a scrapbook
already did, and both dialogs say the delete reaches every node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:37:29 -08:00
Greg ShuflinandClaude Opus 5.5 c68130599b clippings: deleting a clipping or a scrapbook is a purge
A local delete_recursive left the rows on every other node, which would
sync them back; a user deleting from a list means it gone. Both now go
through purge_recursive and return the purged ids for the caller to
broadcast. The broadcast's signing material moves into
p2p::gossip::PurgeSigning, which the daemon's and the FFI's existing
document purges now share with the clippings ones instead of each
reading the keypair and membership itself.

Daemon: ClippingCmd::Purge/PurgeScrapbook run on the async path (store
work on the blocking pool) and answer PurgeSnapshot; unlike a document
purge they don't demand P2P — doc-sync carries the tombstone. FFI:
purge/purge_scrapbook return PurgeResult and block on the broadcast.
CLI: syn clippings delete/scrapbook-delete ask [y/N] first (--yes to
skip) and print the same purge report as syn docs purge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:37:29 -08:00
Greg ShuflinandClaude Opus 5.5 f76bf9f183 android: the new-ensemble screen sets the node up, from shared copy
Build Debug APK / build (push) Failing after 0s
The welcome screen's "Generate ensemble key" only showed a phrase, to be
typed back on "Initialize New Node". Now, as on the desktop and TUI,
"Initialize new ensemble" opens the phrase over a node-name field and the
autistic toggle, and "I've written it down" sets the node up in it;
Back writes nothing. The spinner screen for minting is gone (minting is
local and instant), and both forms share one setup tail.

The labels came from the screen itself, disagreeing with the other
modalities; they are now KeyphraseCopy fields from copy::keyphrase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:36:00 -08:00
Greg ShuflinandClaude Opus 5.5 80513750c2 revocation: stop promising that ensemble register re-admits a node
It never did: it refused any node already in an ensemble, and a revoked
node still is. Say what is true — re-admission needs only a fresh cert,
nothing mints one for a node holding its revoked cert yet — and track the
gap in TODO.md, replacing the resolved item about first-run shapes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:17:22 -08:00
Greg ShuflinandClaude Opus 5.5 4ec462b752 tui: the first run's phrase step sets the node up, without a retype
Same shape as the desktop: the freshly minted phrase sits over a
node-name field, Enter sets the node up in its ensemble, Esc discards it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:17:21 -08:00
Greg ShuflinandClaude Opus 5.5 1cd25c87e2 gui: "I've written it down" sets the node up in the new ensemble
The phrase screen only showed the phrase, and the user then typed it back
on the join form to become a node. It now carries the node-name field
and autistic toggle itself, and its button does the setup with the
phrase it shows. Nothing is written until then, so Back — or closing the
window — leaves no node in an ensemble whose phrase nobody kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:17:20 -08:00
Greg ShuflinandClaude Opus 5.5 7dc0f80626 cli: syn init --new-ensemble makes the ensemble and the node in one step
`syn ensemble init` minted a keyphrase without a node and `syn init`
then needed it back; `ensemble register` joined a store that had a node
and no membership, which nothing ordinary makes any more. Both are gone:
`syn init --new-ensemble [--format-a]` sets the node up in a new
ensemble and prints its phrase once, and `syn init --keyphrase` (or the
prompt) joins one. The two are parser alternatives, so contradictory
flags are a usage error.

`syn init` now also finishes an existing store whose node is in no
ensemble, as the TUI's first run does, which gives NOT_IN_ENSEMBLE a
recourse that exists. NO_REGISTRY_NODES no longer suggests `register`,
which never worked on a node that already had a membership.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:17:13 -08:00
Greg ShuflinandClaude Opus 5.5 57ac2fb8d3 blob_store: seal and hash a blob's chunks across cores
Build Debug APK / build (push) Failing after 17s
A large import read and sealed a chunk at a time on one core: pass 2 ran
at ~370 MiB/s, slower than the disk feeding it. It now reads a 4 MiB batch
straight into its on-disk layout, seals the batch's chunks in parallel in
place (BlobCipher::seal_in_place, sharing seal's bytes; each chunk's nonce
is its index), and hashes the run with update_rayon, which gives the same
digest because BLAKE3 is a tree hash. The plaintext hash (pass 1) is read
in pieces of the same size and hashed across cores too, rather than
memory-mapped: a mapped file that shrinks mid-import is a SIGBUS.

just bench-store-io, 2 GiB file on the test VM: seal + hash 0.4 -> 1.4 GB/s
in memory; store_file 9.6-12.6 s -> 5.5-8.4 s cold. It is now bound by
reads and writes here, not the CPU; the TODO keeps measuring on a phone.

The streaming-matches-encrypt_blob and file round-trip tests gain cases
that cross batch boundaries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 21:33:08 -08:00
Greg ShuflinandClaude Opus 5.5 9d09cb31c0 stores: name the pool's idle limit MAX_IDLE_DB_CONNECTIONS
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 21:33:08 -08:00
Greg ShuflinandClaude Opus 5.5 57057e9c9e stores: a connection pool per store instead of a connection per transaction
Each new SQLite connection paid ~0.4 ms on its first statement to parse
the schema, never got a prepare_cached hit, and, since nothing else was
open, closed as the last connection: a checkpoint, an fsync and a deleted
WAL after almost every write. `stores::pool::ConnectionPool` keeps up to
four idle connections for the store's lifetime, shared by every sub-store
and clone. Per store rather than per thread, so connections live and die
with the store instead of with whichever executor thread ran the work.

just bench-store-io, before -> after:
  small read                    0.78 ms ->  0.009 ms
  one-row write                 24.5 ms ->  0.12 ms
  doc-sync sender, 100 docs      424 ms ->  10.7 ms
  doc-sync receiver, 100 docs   27.7 ms ->  2.1 ms

Sub-store constructors take the pool rather than a path. Settings' direct
opens go through it too; graph_copy keeps its own connection, since it
turns foreign keys off and ATTACHes. wipe_contents closes the pool before
deleting. Connections now set journal_size_limit, since the WAL is no
longer deleted on a last close. Commits are now durable only at
checkpoints, as open_conn's doc always claimed; the TODO audit covers the
writes that need more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 21:33:08 -08:00
Greg ShuflinandClaude Opus 5.5 fbd7289c46 TODO: audit which store writes have to survive power loss on commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 21:33:08 -08:00
Greg ShuflinandClaude Opus 5.5 d0e0d4bd34 TODO: replace the store I/O benchmark item with what it measured
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 21:33:08 -08:00
Greg ShuflinandClaude Opus 5.5 63dfc16cc2 lib: store I/O benchmarks behind just bench-store-io
Measures the two costs TODO.md held for benchmarking: a SQLite connection
per transaction (open, schema load, last-close checkpoint; reads, writes,
and both doc-sync chunk paths, fresh vs kept-open vs reused), and a large
file import (disk vs BLAKE3 vs seal, one core vs parallel).

Ignored tests rather than criterion benches so they can reach crate
internals (`open_conn`, `fetch_chunk`, which with `SyncCursor` is widened
to pub(crate) for it). The recipe runs them on rust/target, since /tmp is a
tmpfs, and compiles the lib at opt-level 3 so the inlined AEAD runs at
release speed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 21:33:08 -08:00
Greg ShuflinandClaude Opus 5.5 801a2a709a docs: clippings are done — ADR 0039 records rename/delete/move, TODO drops the section
Build Debug APK / build (push) Failing after 19s
Nothing is left open under Clippings: the rename guard, delete's
default-scrapbook refusal and move's stamped parent change are recorded
in ADR 0039's scrapbooks amendment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:46:13 -08:00
Greg ShuflinandClaude Opus 5.5 534a66c43b android: rename, delete and move on the Clippings screen
An app-bar menu makes, renames and deletes the scrapbook on screen;
Delete asks first (AlertDialog) and is disabled on the default. Each
clipping gets a Move to menu once there is another scrapbook, and its
date moves up beside the source line so four controls fit a phone.
ScrapbookNamingSession holds the rename form on an IncomingBodyBuffer,
so a name written elsewhere mid-rename is held and Save waits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:46:08 -08:00
Greg ShuflinandClaude Opus 5.5 4142b70987 gui: rename, delete and move on the Clippings screen
The header's Scrapbook menu makes, renames and deletes the scrapbook on
screen; Delete asks first and is greyed on the default. Each clipping
gets a Move to menu once there is another scrapbook. The rename form
holds the alert-don't-apply guard: a name changed on another node while
this one is typed is announced, and Save waits for Use theirs / Keep
mine. dropdown_trigger now takes any ElementId, for per-row menus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:35:16 -08:00
Greg ShuflinandClaude Opus 5.5 948c54bbeb clippings: rename and delete a scrapbook, move a clipping between them
ClippingsManager gains rename_scrapbook, delete_scrapbook (refused for
the default anchor, which the next capture would only bring back) and
move_clipping (a stamped parent change, so it reaches every node).
Scrapbook carries is_default so a screen knows not to offer Delete.
copy::incoming_change gains Subject::ScrapbookName for the rename
form's alert-don't-apply banner. FFI, daemon (Write/Remove/Write) and
CLI (scrapbook-rename, scrapbook-delete, move) carry it through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:35:16 -08:00
Greg ShuflinandClaude Opus 5.5 943bac11a8 docs: scrapbooks — ADR 0039 amendment, data model, TODO
The second clippings tree is built and recorded. Android linkages
folds into Mobile pairing: a phone cannot grant a linkage until
pairing runs there, so a list-and-revoke screen built ahead of it
would only ever show its empty state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 19:56:50 -08:00
Greg ShuflinandClaude Opus 5.5 e3fccdf3e5 android: scrapbooks on the Clippings screen
Scrapbook tabs (SectionTabs, scrollable) once there is more than one,
a New scrapbook form behind an app-bar action, and the line under the
tabs saying where the browser's captures land, with Send them here.
The composer files into the scrapbook on screen. keepingOrder is the
desktop's in_place: a sync appends new tabs and moves none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 19:56:50 -08:00
Greg ShuflinandClaude Opus 5.5 976996494e gui: scrapbooks on the Clippings screen
One tab per scrapbook once there is more than one, a New scrapbook
form, and a line under the tabs saying where the browser's captures
land, with Send them here to move them. A clipping made with New
clipping goes into the scrapbook on screen. A scrapbook synced in from
another node is appended to the tabs rather than slotted in by creation
time, so a sync never moves the tab under the pointer; [ and ] step
through them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 19:56:50 -08:00
Greg ShuflinandClaude Opus 5.5 36722c3ee0 clippings: scrapbooks — a second clippings tree, and a movable capture destination
DocumentType::Scrapbook is to a clipping what Notebook is to a note,
per ADR 0039's own instruction for the day a second tree was wanted.
The default anchor is now created as one. ClippingsManager gains
scrapbooks/create_scrapbook/set_destination, list_page_in and
capture_in; capture (what the extension calls) still names no
destination. A pointer to anything but a scrapbook falls back to the
anchor.

DocumentType is a sync wire enum, so SYNC_PROTOCOL_VERSION is bumped.

DocumentType is a sync wire enum, so SYNC_PROTOCOL_VERSION is bumped.

Carried through in the same change so every commit builds:
- FFI: list_page and capture name the scrapbook on screen;
  scrapbooks, create_scrapbook and set_destination are new, and the
  screen's words join ClippingsCopy.
- Daemon: Scrapbooks/CreateScrapbook/SetDestination (Read, Write,
  Write), List takes an optional scrapbook, and a Get by id, which
  `syn clippings show` now uses — a clipping can be in any scrapbook
  and a listing reads only one.
- CLI: syn clippings scrapbooks, scrapbook-new, destination,
  list --scrapbook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 19:56:50 -08:00
Greg ShuflinandClaude Opus 5.5 5938e8cd9c just: lowprio, to run a recipe at idle CPU weight
A full-width cargo build of the workspace makes the desktop it runs on
sluggish. `just lowprio <recipe>` runs the recipe in its own systemd user
scope with CPUWeight=idle and a soft MemoryHigh cap, so it still uses
every free core but yields to anything interactive; it falls back to
nice -n19 where there is no systemd user session. AGENTS.md tells agents
to prefix long builds with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 17:51:11 -08:00
Greg ShuflinandClaude Opus 5.5 14d60fa515 docs: post uri canonicalization is built; handle resolution is open
Build Debug APK / build (push) Failing after 19s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwfd5GfVr63BxhhcNHm
2026-11-01 17:07:22 -08:00
Greg ShuflinandClaude Opus 5.5 bb6b374c87 post_uri: canonical uris for captured posts, one file per platform
ADR 0050 derives a post's id from (platform, canonical uri), so two nodes
and a future Feeds agent saving one post reach one document. documents::
post_uri holds the rules: post_uri/{bluesky,mastodon,x_twitter}.rs each
carry one platform's input shapes and a table test pinning their outputs,
and canonicalize() is the one exhaustive match that dispatches to them.

A uri no rule recognizes is kept as given rather than refused, but under
Domain::RawPost rather than Domain::Post, so a raw key is never mistaken
for a canonical one and can be found and re-keyed later. A bsky.app link
naming its author by handle comes back UnresolvedHandle, for a caller
with network access to finish with the DID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwfd5GfVr63BxhhcNHm
2026-11-01 17:07:21 -08:00
Greg Shuflin 47de9582c9 TODO: restore the Music section heading
It was dropped by an earlier edit, leaving its bullets under the
Humans section.
2026-11-01 17:07:21 -08:00
Greg ShuflinandClaude Opus 5.5 35377f6a5c tui: bookmarks in the PDF reader
Build Debug APK / build (push) Failing after 18s
n bookmarks the page on screen. Once a document has bookmarks they are listed
in a pane beside the page (when the terminal is wide enough), where j/k move,
Enter goes to one and d removes it. Going to a bookmark records the place like
any page turn. A page turn is no longer recorded before the page count is
known, when the last page is still i32::MAX.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwcpgBWct6BZraE5iLL
2026-11-01 14:56:03 -08:00
Greg ShuflinandClaude Opus 5.5 b92c7b63ee daemon: list, add and delete a document's bookmarks over the socket
Reading(Bookmarks/AddBookmark/DeleteBookmark), each answering with the
document's whole list under its id. PageBookmark picks up serde for it. The
desktop's label-or-page choice for a bookmark row moves to
copy::pdf_viewer::bookmark_row, so the TUI's rows read the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwcpgBWct6BZraE5iLL
2026-11-01 14:56:03 -08:00
Greg ShuflinandClaude Opus 5.5 9487353e82 cli: syn docs reading-page shows or sets where a document was last read
Pages count from 1, as the readers show them. A reader that has the document
open announces the new place rather than turning to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 14:23:28 -08:00
Greg ShuflinandClaude Opus 5.5 07676b9023 flake: keep .ftl files in the Rust source, for lib's Fluent copy
lib/src/copy/messages.rs include_str!s copy/en-US.ftl, which the source filter
dropped, so every package failed to compile synchronicity_lib.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 14:23:28 -08:00
Greg ShuflinandClaude Opus 5.5 30c4aeb6cd tui: the PDF reader opens where the document was left, and holds a place set elsewhere
Opening turns to the shared reading place before the first render; each page
turn records this reader's (coalesced: one write per round trip). A place set
anywhere else while the document is open, by another node or by another
program on this one, is held and announced in the title and status line: r
goes there, turning the page keeps this one. The reader tells its own writes
apart by page, not by node: a look-up never runs while one of its saves is
pending, so a place it wrote is always the page it is on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 14:23:28 -08:00
Greg ShuflinandClaude Opus 5.5 083d925502 daemon: read and record a document's reading place over the socket
agents::reading gains ReadingPlace, which names the node that set the page.
The daemon serves it as Reading(Place/SetPage), with whether this node set it.
The copy for announcing a moved place is a new incoming_change::Subject,
ReadingPlace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 14:23:27 -08:00
Greg ShuflinandClaude Opus 5.5 a18381df14 flake: build uniffi_bindgen from a real directory, so askama finds askama.toml
Crane vendors each crate as a symlink to its own store path. askama_derive
0.16 canonicalizes the config path (resolving that symlink) and then diffs it
textually against the caller's un-resolved directory, so the relative path it
reads lands outside the store and every #[derive(Template)] in uniffi_bindgen
fails. Give it the same writable [patch.crates-io] copy mupdf-sys already gets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 14:00:31 -08:00
Greg ShuflinandClaude Opus 5.5 4b23ed6c99 tui: a PDF Viewer screen that draws pages with terminal graphics
The PDF Viewer agent gets a real TUI screen: a library of every PDF (the
daemon's PdfCmd::Library, with availability marked as the notes tree marks
it) and a reader that shows one page at a time as a picture, fitted to the
pane. Keys follow the keymap's pager convention: Left/Right and
PageUp/PageDown turn the page, g/G go to the ends, Back returns to the
library.

Whether the terminal can draw pictures is asked once at startup, after the
terminal is taken over and before the event loop reads input (graphics.rs).
ratatui-image picks the protocol (kitty, iTerm2's or sixel); a terminal that
only has its block-character fallback shows a sentence saying so, and what
would help, instead of a page.

A page is rasterized by pdf-render's thread and encoded for the terminal on
a worker, never on the event loop. Its bytes come from the daemon, which
materializes the PDF into a scratch directory in $XDG_RUNTIME_DIR. Each
render carries the document, page, size and scale it was asked for, one is
in flight at a time, and the next tick asks again if the reader has moved
on, so the latest request wins. A PDF stored on another node shows that as
a state, with s to pull it here.

Reading position isn't remembered or synced yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 06:03:32 -08:00
Greg ShuflinandClaude Opus 5.5 e3a0677244 daemon: serve the PDF library over the socket
PdfCmd::Library returns build_pdf_nodes' list, the one the desktop and
Android libraries show, so the TUI's PDF screen lists the same PDFs with
the same subtitles and, unlike ListDocuments, knows which are stored here.
PdfListItem picks up serde derives for it, with a round-trip guard beside
EnsembleStatus's.

Also corrects MaterializeDocument's doc comment, which still said only
collections and notes materialize; PDFs and music tracks have for a while.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 06:03:31 -08:00
Greg ShuflinandClaude Opus 5.5 55cab7e2ec build: every default build compiles MuPDF, for the TUI's PDF viewer
The TUI is about to render PDFs through pdf-render, which makes MuPDF part
of the default members' dependency tree rather than the desktop's alone.
pdf-render becomes a default member, so unit-tests-rust runs its tests and
unit-tests-gui goes back to gui-app alone.

flake.nix's mupdf-sys handling (the writable vendored copy, and bindgenHook
for libclang) moves from syn-gui's own arguments into commonArgs, since
buildDepsOnly and the syn-tui package now compile mupdf-sys too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 06:03:30 -08:00
Greg ShuflinandClaude Opus 5.5 5fbb0beec5 pdf-render: move the desktop's PDF render thread into its own crate
The thread that owns a parsed mupdf::Document, its page cache, prefetch and
tile rendering moves out of gui-app's pdf_viewer.rs into rust/pdf-render, so
the TUI's PDF viewer can share it. gui-app keeps RenderDispatch (getting the
bytes to the thread from the store or another node).

The crate is generic over the frontend's image type, through a PageImage
trait: the frontend names its pixel order, mupdf renders straight into it,
and the thread wraps the bytes. That keeps what the desktop already had,
pages built as gpui images on the render thread with no pixel pass on the
UI thread, without the crate knowing about gpui. AtlasImage implements it
for the desktop (BGRA); Arc<RgbaImage> is provided for everyone else.

Other API changes made along the way: RenderPurpose::Thumbnail { max_edge }
replaces recognizing a thumbnail by its magic scale, and errors are a
thiserror RenderError rather than String. The thread is started with
thread::Builder, so a failed spawn surfaces as a disconnected sender rather
than a panic.

pdf-render stays out of default-members, like gui-app, because it builds
MuPDF's C source; unit-tests-gui now runs its tests too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 04:10:47 -08:00
Greg ShuflinandClaude Opus 5.5 7929f7345c wikilinks: resolve by caseless_key, folding case but not accents
Build Debug APK / build (push) Failing after 18s
A [[wikilink]] was resolved two ways: the store's find_documents_by_title
by SQLite's NOCASE, ASCII only, so [[élan]] missed Élan, and the notes
screens' resolve_wikilinks_by_title by Rust to_lowercase. Both now compare
text_match::caseless_key, Unicode's compatibility caseless match (D146):
case and compatibility forms fold, marks don't, so [[resume]] does not
link Résumé. That is stricter than search on purpose — a name that
over-matches links the wrong document.

The store side registers caseless_key as a second SQL function beside
text_match. The TODO entry for this is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 03:31:44 -08:00
Greg ShuflinandClaude Opus 5.5 ce8cf7083b TODO: Unicode search matching is done; wikilink identity remains
Build Debug APK / build (push) Failing after 18s
Every search and filter now matches by text_match, so the entry shrinks to
the part that wasn't search: the two wikilink resolvers fold case
differently (SQLite NOCASE versus Rust to_lowercase) and want one identity
rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 03:18:56 -08:00
Greg ShuflinandClaude Opus 5.5 f3fab6f234 android: every list filter matches by text_match
Music, Comics, the PDF and podcast libraries, Pictures, Video, Humans
(name and subtitle) and the timezone picker each filtered with
contains(ignoreCase = true), which folds case and nothing else. They call
the lib's textMatches instead, so on Android as everywhere else 'cafe'
finds 'Café' and an uppercase letter demands its case.

The search design doc's Android section no longer describes Kotlin
matching as its own substring test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 03:18:56 -08:00
Greg ShuflinandClaude Opus 5.5 4ed1915abb android: highlight and filter the notes tree by text_match
ffi::text_match exports text_matches and text_match_ranges, the latter in
UTF-16 code units, which is what Kotlin String and AnnotatedString count.
highlightedRowName — the Documents list and the notes tree — takes its runs
from it instead of indexOf on a lowercased copy, which could not mark the
Café a query 'cafe' found and drifted wherever lowercasing changed a
string's length.

visibleNoteRows now takes its matcher as a parameter, textMatches at the
call site, so the notes tree selects rows by the rule its highlighting
draws them with. The JVM unit tests can't load the lib, so they pass a
lowercase stand-in and check only the tree's shape; the case-sensitivity
test moves to the rule's own tests in Rust.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 03:18:56 -08:00
Greg ShuflinandClaude Opus 5.5 f5730f1904 docs(search): the matcher is text_match and fuzzy::rank, not nucleo
The design doc said not to write the matcher by hand and to take nucleo.
Records why that stopped holding once matching had to work in every script,
what is taken from crates (ICU4X's Unicode data, frizbee's scoring) and what
is ours (the comparison), and that both search regimes share the character
rule even though they keep separate matchers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 03:18:56 -08:00
Greg ShuflinandClaude Opus 5.5 d6acfe8df8 fuzzy: rank by text_match's rule, with frizbee scoring folded text
frizbee folds ASCII case and nothing else, so a picker or name lookup
treated É and é as different letters and never folded an accent. rank now
hands frizbee text_match::fold'd query and candidates, so its typo-tolerant
scoring works in every script, and then drops any candidate missing a
strict query character — a marked or uppercase one — in order
(Query::strict_in_order). exact is computed against the original strings,
so find_human_by_name's verbatim tie-break is unchanged.

Kept frizbee rather than moving to nucleo, which the search design doc
recommends: nucleo-matcher has not released since 0.3.1 (2024-02), has no
typo tolerance (find_human_by_name depends on it), and folds only Latin
accents, per query word. frizbee's own match indices weren't usable for
the strict check — they are byte offsets despite being documented as
chars, with a noted case where alignment is lost — hence the in-order
check instead of a per-position one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 03:18:56 -08:00
Greg ShuflinandClaude Opus 5.5 f53ec7beee gui: every typed filter and its highlight match by text_match
The command palette, the notebook sidebar filter, the PDF library search
and the timezone search each lowercased both sides and called contains,
and the Documents list and sidebar found their highlight ranges the same
way. All now use text_match::Query, so they follow the rule the SQL title
search does: accents fold for a plain letter, an uppercase letter demands
its case, and a highlight lands on the characters that actually matched
rather than only where lowercasing kept byte offsets aligned.

The PDF and sidebar tests that pinned 'RUST' finding 'rust' now pin the
opposite, which is the smart-case rule fuzzy::rank already followed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 03:18:56 -08:00
Greg ShuflinandClaude Opus 5.5 fe2ad8ddcd stores: title search by text_match, as a SQL function
open_conn registers text_match(text, query) on every connection, and both
title searches call it in place of LIKE, which folded ASCII case and nothing
else, so 'cafe' now finds 'Café' in the desktop, Android and daemon search.

search_documents' title filter moves into the same SQL as the paged
search_document_items, joining the title property instead of filtering in
Rust with to_lowercase and one get_title per row. escape_like goes with
LIKE.

The query is decomposed once per statement: SQLite keeps it as auxiliary
data on the argument. Nothing in the schema refers to the function, so a
connection opened without it can still read the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 03:18:56 -08:00
Greg ShuflinandClaude Opus 5.5 0eed181729 lib: text_match, per-character asymmetric matching on ICU4X
A query character asks for exactly what it spells out: a plain letter
matches every variant of itself (e finds é, и finds й, か finds が), a
marked one demands its mark, and an uppercase one demands its case. This is
UTS #10's asymmetric search, applied per character to case as well, so
'résume' finds 'résumé'. Both sides go through NFKD and full case folding;
every Unicode fact comes from ICU4X (already in the tree via url and typst),
so the module holds only the comparison.

Query::is_match filters; Query::find_all returns whole-character byte
ranges for highlighting. Nothing calls it yet: SQL title search, the
palette and sidebar filters, fuzzy::rank and Android's highlighting move
onto it in following commits.

Cargo.lock also picks up two entries that were already stale on master
(data-encoding-macro-internal -> syn 3, phonenumber -> quick-xml 0.41);
any resolution produces them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 03:18:56 -08:00
Greg ShuflinandClaude Opus 5.5 be3f49033f extension: prefer the lib compiled to WASM over JS restatements
One line of direction, not a design: where the extension needs logic
synchronicity_lib already has, compile that Rust to WASM rather than port
it to JS. How that fits the no-build-step rule is left to the first
feature that needs it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 03:18:56 -08:00
Greg ShuflinandClaude Opus 5.5 96d4755129 gui: the Typst preview keeps its scroll across recompiles
Build Debug APK / build (push) Failing after 19s
Each recompile replaced the preview with set_content, which resets the
pan, so typing on page five snapped the preview back to page one at every
pause. A recompile of the note on screen now swaps the bitmap and keeps
the pan and zoom (replace_bitmap); a first render — the canvas is cleared
whenever another note is selected — still starts at the top.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:47:51 -08:00
Greg ShuflinandClaude Opus 5.5 a589a9be93 TODO: the remaining unoptimized RGBA-to-BGRA passes in debug builds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:41:44 -08:00
Greg ShuflinandClaude Opus 5.5 c4d90ff997 gui: build the Typst preview's image off the UI thread
Turning a compiled preview into a gpui image swaps red and blue on every
pixel of every page — ~3M pixels a letter page at 2.5 px/pt, all pages
merged into one image — and it ran inside the update that applies the
result, so each debounced recompile while typing stalled the window. It
now happens in the background compile task, and the update only places
the finished image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:41:44 -08:00
Greg ShuflinandClaude Opus 5.5 9ee84d19de gui: PDF page turns at deep zoom do less, and none of it on the UI thread
At high zoom a page turn moved a 4096px bitmap (~52 MB) through two
per-pixel passes — RGB to RGBA on the render thread, RGBA to BGRA on the
UI thread — after copying it out of the cache, then did the same for
every tile. In a debug build, where gui-app itself is unoptimized, that
was the sluggishness; a release build paid less, but paid it.

- mupdf renders into a BGRA pixmap with alpha, cleared to opaque white,
  so its samples are already gpui's layout: one memcpy, no pixel loop.
  The render thread builds the AtlasImage itself, and the cache shares it
  rather than copying a page per hit. Thumbnails render at a scale that
  fits THUMB_MAX_EDGE instead of rendering large and resampling.
- Past the clamp the whole-page bitmap is only a backdrop until tiles
  land, so it drops from 4096 to 2048px: a quarter of the render, upload
  and cache memory (12 cached pages: ~600 MB to ~150 MB).
- The render thread waits PREFETCH_GRACE before each speculative page, so
  the tile batch that follows a page landing isn't queued behind one.

A test renders a generated PDF and checks the bytes are BGRA on white,
and that a tile lands on the same pixels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:32:30 -08:00
Greg ShuflinandClaude Opus 5.5 7770d721c7 android: PDF zoom carries across page turns; swipe past the edge to turn
Build Debug APK / build (push) Failing after 21s
Every page turn reset to the fitted page. Now a turn keeps the zoom and
lands at the top of the next page with the horizontal position kept
(ZoomState.panToTop), as on the desktop. Since a zoomed one-finger drag
pans rather than swipes, ZoomableBitmap now reports an edge swipe — a
drag that pulls a quarter of the width past the pan limit and lets go —
and the PDF viewer turns the page on it. The PDF viewer's zoom limit
goes to 10x; tiles keep memory independent of zoom.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:18:25 -08:00
Greg ShuflinandClaude Opus 5.5 df98fb170e android: PDF page chevrons at the ends of their row, full touch size
They were clustered around the page count at 32dp — a leftover from when
the row also held the zoom and history controls (moved out in 6ce43739),
not a choice made for them. Now they sit at the row's two ends at the
default 48dp target, where a thumb finds them, with the count centered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:18:25 -08:00
Greg ShuflinandClaude Opus 5.5 746d597904 gui: Whole page / Page width zoom modes, 1000% limit, page turns keep the column
"Fit" didn't say which fit. The zoom control now names what fills the
window: "Whole page" (the old Fit) and the new "Page width", which fills
the canvas's width and scrolls down the page — the mode a portrait page
is read at on a landscape monitor. Each canvas is built with the fits it
offers (FitModes): pages get both, Pictures gets "Whole picture" alone.
The PDF viewer's sharp-Fit raster follows whichever fit is drawn.

The zoom limit goes from 500% to 1000%; tiles make deep zoom cost the
same as shallow. A PDF page turn now keeps the horizontal scroll and goes
to the top of the next page (ZoomableImage::turn_page), rather than the
top-left corner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:13:38 -08:00
Greg ShuflinandClaude Opus 5.5 9c68d0a5bd TODO: what PDF 100% should mean, and the gpui-ce route to paper size
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:11:06 -08:00
Greg ShuflinandClaude Opus 5.5 90b276e9cd android: PDF zoom re-render steps aside once tiles will cover the screen
Past the zoom render's clamp, a settled pinch still rendered the whole
page first (up to ~42 MB), holding PdfPageCache's render mutex while the
visible tiles waited behind it. tilesWillCover asks the same question the
tile planner does — will a bitmap at this scale be softer than the
screen? — and the re-render skips the bitmap when it would be, leaving
the one already showing as the layer under the tiles. Closes the TODO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 01:42:48 -08:00
Greg ShuflinandClaude Opus 5.5 29da300ab9 gui: PDF viewer skips re-rendering a page the clamp leaves unchanged
Past MAX_RENDER_EDGE_PX every zoom step asked for a new whole-page render
that the clamp turned into the same 4096px bitmap already on screen, and
the render thread did it ahead of the tile batch the screen was actually
waiting for. The view now remembers the scale its bitmap was rasterized
at and skips a re-render that would come out the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 01:42:48 -08:00
Greg ShuflinandClaude Opus 5.5 9ebd0a99ff gui: Ctrl+wheel zooms the zoom canvas, double-click the percentage for 100%
In ZoomableImage, so the PDF viewer, Pictures, Comics and the Typst
preview all get it. Ctrl+wheel (Cmd on macOS) zooms about the pointer,
from the scale actually on screen so leaving Fit doesn't jump, by one
toolbar step per wheel notch or per 50px of touchpad scroll. It listens in
the capture phase on a Normal hitbox over the viewport, since gpui runs an
element's own scrolling before any on_scroll_wheel added to it. The
ModeChanged a vector consumer re-rasterizes on waits for the wheel to stop.

Double-clicking the zoom percentage goes to 100%; its tooltip says so
(copy::reader::ACTUAL_SIZE_HINT).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 01:16:56 -08:00
Greg ShuflinandClaude Opus 5.5 5c2e4679de gui: PDF library thumbnails keep the page's aspect
image::imageops::thumbnail resizes to exactly the size it is given, so
every page render larger than THUMB_MAX_EDGE was squashed into a 480px
square. DynamicImage::thumbnail fits within it instead, as the other
thumbnail decoders already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 01:14:28 -08:00
Greg ShuflinandClaude Opus 5.5 bde6d2727c gui: release images from the GPU, and bound remote images
gpui never forgets an image on its own: the first paint uploads a
RenderImage to the window's sprite atlas and nothing evicts it when the
last Arc drops, and an img(url) with no image cache is decoded at full
size into gpui's asset map for the life of the app. Between them, every
QR code typed, math formula edited, note image revisited, cover cache
rebuilt and podcast cover browsed stayed resident for the session.

- render_image::AtlasImage replaces Arc<RenderImage> everywhere: when its
  last handle drops it queues itself, and each window root releases the
  queue every frame. ZoomableImage's own release list goes away.
- url_images::UrlImageCache is a bounded LRU ImageCache, installed by each
  window root over its whole tree. It releases what it evicts and keeps
  remote images shrunk to 640px, since nothing draws one larger than a
  200px card; podcast art arrives at up to 3000px square.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 01:14:09 -08:00
Greg ShuflinandClaude Opus 5.5 5dbc2bc8bd TODO: PDF deep zoom is tiled; note Android's re-render ordering
Build Debug APK / build (push) Failing after 19s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 01:42:00 -07:00
Greg ShuflinandClaude Opus 5.5 c5c67138ba android: PDF viewer renders deep zoom in tiles past the zoom render's clamp
Same shape as the desktop: the clamped whole-page bitmap stays underneath,
and once the screen shows the page at more pixels per point than it
carries, the visible part is rendered over it in tiles from lib's
pdf_tiles grid, at screen resolution. MuPdfDocument renders a tile from a
per-page display list (AndroidDrawDevice with an origin, as MuPDF's own
viewer patches a zoomed page); PdfTiles.kt plans and caches them under
collectLatest, so a pan or pinch cancels what the last one still had to
render, and an overlay is drawn only over the page it was rendered for.

ZoomableBitmap takes the overlay inside its zoom transform, placed with a
draw transform rather than whole-pixel dst rects, and ZoomState now knows
its viewport so it can say what part of the content is on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 01:41:50 -07:00
Greg ShuflinandClaude Opus 5.5 435ec7f577 gui: PDF viewer renders deep zoom in tiles past the 4096px clamp
The whole-page bitmap is still clamped at MAX_RENDER_EDGE_PX, but past the
clamp the visible part of the page is now rendered over it in 512px tiles
at the full zoomed scale (lib's pdf_tiles grid), so a deep zoom stays
sharp instead of upscaling. Tiles come from a per-page display list on the
render thread, stream back one at a time center-first, and stop as soon as
the view drops the receiver (pan, zoom, page turn). A zoom step keeps the
previous scale's tiles under the new ones until the screen is covered.

Also fixes the page's on-screen size past the clamp: it was derived from
the bitmap's pixels over the *requested* scale, so once the clamp engaged
the page stopped growing however far the zoom went. The render thread now
reports the page's size in points and the size comes from that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 01:26:41 -07:00
Greg ShuflinandClaude Opus 5.5 56826f750d gui: ZoomableImage overlay tiles, and release replaced bitmaps from the atlas
A vector consumer zoomed past what one bitmap can hold can now lay sharp
tiles over the image, placed by the fraction of the image each covers.
visible_region() says which part is on screen and a debounced
ViewportSettled says when it stopped moving (pan, scroll, zoom, resize).

Separately: gpui uploads a RenderImage to the sprite atlas on first paint
and never evicts it, so every re-rasterized PDF page (and every picture,
comic page and Typst render) stayed resident on the GPU for the session.
The canvas now drop_image()s whatever it stops showing, at its next render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 01:26:36 -07:00
Greg ShuflinandClaude Opus 5.5 5d7eb452b5 lib: pdf_tiles, the tile grid for rendering a deeply zoomed page
Both PDF viewers clamp a whole-page raster at 4096px, so past that a deep
zoom is upscaling. The fix is to render just the visible part of the page
in fixed-size tiles at the zoomed scale; this is the grid both modalities
share — tile edge, a 1px overlap against seams, center-first order, and
the sharpness test for when tiling is worth doing. Positions travel as
fractions of the page, since the viewer and the rasterizer measure it in
different pixels. Exported over uniffi for Android.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 01:14:25 -07:00
Greg ShuflinandClaude Opus 5.5 b46365b6ba TODO: watch gpui-ce's fork of gpui-kit for its editing engine
Build Debug APK / build (push) Failing after 18s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 23:48:06 -07:00
Greg ShuflinandClaude Opus 5.5 3cc4ce5668 comics: re-importing a file updates the comic already standing for it
Build Debug APK / build (push) Failing after 18s
Every import used to mint a new Comic, so a second look at a file duplicated it,
and a corrected ComicInfo.xml had no existing issue to reach. A comic is now
matched among its import parent's children by SourceName (the file or folder
name, a new generic property), or, for a file renamed on disk, by
ComicPagesHash when the old name is gone from the folder. Series and volume
Collections match by name. A match is rewritten only where it differs
(DocumentStore::set_or_clear_if_changed), cleared where the file dropped a
field, and keeps a title the user changed and a reading direction they chose.
Pages match by position: unchanged ones keep their document (and get their
bytes stored if this node only had them remotely), changed ones are replaced.

Re-importing the ~/Manga sample (256 comics, 6433 pages) now writes nothing
and takes ~6s instead of duplicating every document. ADR 0054 records the
identity rules and why derived ids and paths were rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 23:17:07 -07:00
Greg ShuflinandClaude Opus 5.5 d38a18321e comics: fractional chapters sort in reading order
A chapter number's digits after the dot are a sub-chapter, so Order is now
chapter*1000 + part: "Chapter 10.5" reads between 10 and 11 and "Ch.8.10"
after "Ch.8.9", instead of every fractional chapter being left unordered at
the end of the series. ComicNumber keeps the digits as written ("51.10",
which the old f64 path printed as "51.1"), and unordered siblings fall back
to a natural title sort rather than a lexical one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 23:17:07 -07:00
Greg ShuflinandClaude Opus 5.5 21475cd794 gui: bump gpui-ce to bc577476 (Parley text system)
Build Debug APK / build (push) Failing after 18s
59 upstream commits, the bulk of them gpui-ce's move from its per-platform
text systems to Parley. What that took here:

- Linux backends: gpui_platform's default feature set is now empty and
  gpui's own wayland/x11 flags only reach it through a dev-dependency, so
  as declared the app built with no windowing backend. Both are now named on
  gpui_platform explicitly.
- Multi-line text: shape_text returns one ShapedText for the whole buffer
  rather than a WrappedLine per source line. MultilineTextElement and
  MultilineBuffer hold that one layout, and offset_for_position /
  position_for_offset ask it (closest_byte_index_for_pixel_point,
  visual_position_for_byte_index) instead of walking source lines.
- Single-line text: LineLayout no longer has x_for_index or
  closest_index_for_x; caret placement is the backend layout's job. The
  new editable_text::LineCaret trait answers both through
  PlatformTextLayout, so TextInput's call sites read as before.
- shape_line lost its force-width argument; Font gained `width`;
  ContentMask gained `fade_out`; Window::activate_window is activate().
- Deprecations: hover/group_hover/active become their *_style forms, and
  fill() becomes the PaintQuad::new builder.

Compiles warning-free under clippy and the gui-app unit tests pass. Not yet
looked at: text rendering, caret placement and selection under Parley.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:40:00 -07:00
Greg ShuflinandClaude Opus 5.5 4fbab4c6dd gui: bump tree-sitter-php 0.25
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:46:37 -07:00
Greg ShuflinandClaude Opus 5.5 1485b19bf6 rust: bump pkarr 8, rusqlite 0.41, zip 9, rodio 0.23, lru 0.19, rstest 0.28
Also iroh-mainline-address-lookup 0.6, which needed no code changes.

pkarr 8 replaces resolve_most_recent (an Option) with
resolve(key, ResolvePolicy::NetworkOnly) returning a Result, and drops the
compare-and-swap argument from publish — the DHT client no longer offers
one at all. The registry's read-then-write therefore loses its race guard:
two nodes registering at once can each publish a packet lacking the other.
BOOTSTRAPPING.md and publish_membership's docs now say so.

A resolve that fails for a reason other than NotFound used to be
indistinguishable from an empty registry. It is now
EnsembleError::PkarrResolve, and publish_membership aborts on it rather than
publishing a packet that would drop every sibling's entry.

zip 9's ZipFile::name() is fallible (its CP437 fallback can in principle
fail); extract_cbz propagates it like any other bad-archive error.

hayro-syntax stays at 0.7, matching typst per ADR 0035.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:46:10 -07:00
Greg ShuflinandClaude Opus 5.5 485aa994e1 rust: cargo update to latest semver-compatible versions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:04:28 -07:00
Greg ShuflinandClaude Opus 5.5 b00cd3cb82 docs: ADR 0053 covers commands and desktop sub-tabs
Build Debug APK / build (push) Failing after 28s
The keymap ADR and the AGENTS.md rule now say a key is a keymap::Action
(navigation or command, one meaning program-wide) and how desktop
sub-tabs reach a screen. The two finished TODO follow-ups are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:42:57 -07:00
Greg ShuflinandClaude Opus 5.5 ce8268c790 gui: [ ] steps any screen's sub-tabs, and palette/zoom keys come from keymap
Most tabbed screens never take keyboard focus, so a key handler in them
never heard [ or ]. The window's root, always in the focus path, now
hands Nav::PrevTab/NextTab to whichever screen it shows through the new
sub_tabs::SubTabs: Documents (list tabs, or Overview/Sync with a document
open), Jobs, Humans (Profile/History, or the circle filter), Podcasts,
Settings (as a click would, so the sidebar follows), the PDF viewer's
Outline/Bookmarks, and the media libraries of Music, Video, Comics and
PDFs. A pop-out window does the same for its screen, and focuses itself
on opening so it hears keys at all.

keys::bind takes any keymap::Action, so Ctrl+P and the zoom chords are
the table's Command::CommandPalette and Zoom* rather than literals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:42:56 -07:00
Greg ShuflinandClaude Opus 5.5 a01a233586 tui: screens act on keymap::Command, and quitting is the app's
Screen::handle_key takes an Option<Action>; no screen matches a
character for a command any more. q and ? are the app's: a screen leaves
Quit unhandled and the app takes it, so KeyOutcome::Quit is gone, and a
mode that takes every key (a prompt, a confirmation, the editor) still
keeps q by handling it.

Documents' status line held the list's hints in the same field as a
pull's outcome, so the detail screen advertised search and the hidden
toggle, which do nothing there. The field is now only the outcome, and
each screen's hints are computed beside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:26:03 -07:00
Greg ShuflinandClaude Opus 5.5 dd4ce55179 keymap: screen commands in the table beside Nav, one key one meaning
A Command enum (Refresh, New, Rename, Sync, ToggleHidden, Ping, ZoomIn,
...) joins Nav, and Action is either — the one type a script would hand
the program in place of a key press, serialized by bare kebab name. One
table maps chords to actions program-wide, and a test holds every chord
to one meaning, so commands are named for what they do rather than for
the screen that has them.

That settles three keys that meant two things: r was refresh and rename
(rename is now R), d was delete and show hidden, f was new collection
and full ids. Hidden rows — documents and revoked nodes alike, d and v
before — are '.', the file managers' key; full ids are '#'.

A Ctrl chord now passes a text field, so Ctrl+P works from inside one.
key_hints reads every key it names from the table, and spaces a pair of
punctuation keys ('{ }') rather than slashing them, since '{/}' read as
a third key.
keymap::tab_step/next_tab hold the wrapping tab arithmetic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:26:03 -07:00
Greg ShuflinandClaude Opus 5.5 e1aade7f9e docs: ADR 0053, one keymap for every modality
Records the keyboard convention and the choices behind it — Left is out one
level, sub-tabs and agents share a shifted key family, a text field keeps its
keys — adds the rule to AGENTS.md, and replaces the TODO it closes with the
follow-ups it leaves: desktop tabs on screens that never take focus, screen
commands into the keymap, and a shared TUI list/detail shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 05:47:32 -07:00
Greg ShuflinandClaude Opus 5.5 a4f06886b6 gui: navigate by keymap::Nav, and switch agents with { }
gui-app/src/keys.rs turns a gpui keystroke into the lib's Chord, and every
view that moved on raw key names now asks it for a Nav instead: the tree
(hierarchical_sidebar), the media library grid, the PDF and comic readers,
and the zoomable page's panning. All of them gain hjkl alongside the arrows,
g/G and page keys. Readers close on Back (Esc/Backspace), and the media
library cycles its tabs with [ ].

The action-based components — focus traversal, popup menus, suggestion
lists — get their KeyBindings generated from the keymap rather than written
out. Text-editing roots carry a Typing key context so a keystroke on its way
to a text field is never read as navigation.

{ } at the app root step along the rail, the keyboard agent switcher the
rail never had.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 05:46:32 -07:00
Greg ShuflinandClaude Opus 5.5 54f128dd80 keymap: list cursor arithmetic in the lib, clamping at the ends
keymap::list_cursor is where a list cursor goes for a Nav, so the desktop
and the terminal agree on page size and on what happens at the ends. It
clamps: the TUI's lists used to wrap and the desktop's didn't, and with g/G
there is a key for the top.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 05:33:58 -07:00
Greg ShuflinandClaude Opus 5.5 e540e4470d tui: navigate by keymap::Nav, and write the hints from its table
Every screen is handed the Nav its key means and acts on that, rather than
matching j/k/Down itself. Lists gain g/G, Home/End and page keys; trees get
Left to collapse-or-ascend and Right to expand-or-descend, matching the
desktop's tree; Left off a screen's top level goes out to the sidebar. Sub-
tabs move from the Shift+Tab stopgap to [ ], and { } switch agent from
either pane. 'b' for back is gone: Left, Esc and Backspace are back.

copy::key_hints now reads the navigation keys it names from the keymap, so
a hint cannot name a key that no longer does what it says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 05:30:14 -07:00
Greg ShuflinandClaude Opus 5.5 934202a47e lib: keymap — one Nav type for keyboard navigation, and the keys bound to it
Every modality that takes keys turns a press into a toolkit-free Chord and
asks keymap::nav what it means. Both hjkl and the arrows navigate; [ ] cycle
a screen's sub-tabs, { } cycle agents, Tab/Shift+Tab move focus. While a
text field has the keyboard only the keys a field doesn't use for itself
navigate. The module docs are the convention a new screen follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 05:30:13 -07:00
Greg ShuflinandClaude Opus 5.5 389cfa6d86 docs: autistic mode, and what leaving it doesn't do yet
docs/autistic-mode.md says what the mode is, why it isn't called offline,
every way to turn it on, where it is enforced, and that leaving it doesn't
publish a registry entry. TODO.md drops the offline-mode item and records,
under the DHT bootstrap item, a mode that holds a re-entered ensemble key in
memory only as long as it is needed: the way to close that gap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 04:04:14 -07:00
Greg ShuflinandClaude Opus 5.5 7ecee6f840 android: autistic mode on the setup screen and in Settings > Sync
The setup form gets a small switch under its fields, passed to
joinExistingEnsemble; Settings > Sync gets the same On/Off section the
desktop shows. P2PService.start is now the one way the app starts the
service and does nothing in autistic mode; the service also stops itself
if the mode was turned on while it was retrying. Turning the mode off
starts it again.

Checked on the emulator: on stops the node cleanly and the service with
it, Run now says why it can't, resuming the app doesn't restart it, off
brings the node back; set up autistic, the node skips the pkarr publish
and never starts P2P.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 04:03:35 -07:00
Greg ShuflinandClaude Opus 5.5 0a5c969127 Autistic mode: a node setting that stops all contact with the ensemble
A persisted per-node setting (Settings::autistic). While it is on the node
runs no P2P endpoint at all: no relays, no pkarr publishing, no DHT, no
gossip, no sync. It may still reach the internet for what the user asks of
it directly, which is why it is not called offline mode.

- P2PNode::start refuses (P2PStartError::Autistic): the one gate every
  frontend's networking goes through.
- network_supervisor::supervise starts and stops a host's NodeRuntime as the
  setting changes. The desktop app runs it from launch, so onboarding no
  longer starts the node itself; syn-daemon makes its first start in the
  foreground as before and hands over to it.
- P2PNode::shutdown takes &self, so a node still shared can be stopped in
  place.
- set_up_node takes the setup screen's choice and skips the pkarr publish
  when it is on; so does join_existing_ensemble. Nothing republishes when
  the mode is turned off: no node keeps the key that signs the record.
- --autistic on syn, syn-tui and syn-gui turns the setting on at launch.
  Toggles: syn settings autistic on|off, the TUI ensemble screen's 'a', the
  GUI's setup screen and Settings > Sync.
- Network actions refused in autistic mode say so (copy::autistic) rather
  than "P2P not running". Android's FFI fails fast instead of parking on a
  P2P node that will never start, and SettingsFfi::set_autistic stops it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 03:45:04 -07:00
Greg ShuflinandClaude Opus 5.5 fbe69e0231 gui-app: drop needless borrows clippy flagged
Seven needless_borrows_for_generic_args warnings in the documents detail
view and Notes, applied by `just lint-rust-fix`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 02:27:58 -07:00
Greg ShuflinandClaude Opus 5.5 540d1357af p2p: Android uses iroh's default DNS resolver, not DNS-over-HTTPS
The DoH override dated from the emulator dropping UDP DNS to 8.8.8.8:53.
iroh's default resolver no longer goes there on Android: it reads the
active network's nameservers from LinkProperties over JNI, through the
ndk_context that initAndroidContext already installs, with public
resolvers as a deferred fallback tier.

Checked on the Android 17 emulator: the resolver picked up fec0::3,
10.0.2.3 and 10.0.2.4, every query went to them and none to the
fallback, dns.iroh.link and all four relays resolved, pkarr publish
succeeded, and the node was online in about three seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 02:10:01 -07:00
Greg ShuflinandClaude Opus 5.5 68f8811c8d justfile: canon-cli's setup is scratch-store now
Its comment named init-test-ensemble-cli, a recipe that no longer exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwfXLyeYuKc4RdWEkc8
2026-10-31 00:26:08 -07:00
Greg ShuflinandClaude Opus 5.5 59bda95ea4 dev: a headless GUI workflow that works on the first try
- scripts/gui-input.py drives the headless session through wayvnc: one
  RFB connection keeps a pointer and keyboard alive, which wtype,
  wlrctl and swaymsg's seat cursor can't on a seat with no devices.
- just scratch-store makes an initialized store in a single-node
  ensemble of its own, so a look at the GUI needn't touch the default
  store or click through first-run setup.
- just doctor reports the sway-headless session, so a machine with no
  display doesn't read as one that can't show the GUI.
- AGENTS.md points at rust/gui-app/AGENTS.md before any GUI work, and
  that file now covers the store, the launch (with lavapipe from the
  flake's nixpkgs), and input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwfXLyeYuKc4RdWEkc8
2026-10-31 00:25:30 -07:00
Greg ShuflinandClaude Opus 5.5 c237ed11bc TODO: a Vulkan driver for the headless GUI from the devShell
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwfXLyeYuKc4RdWEkc8
2026-10-31 00:25:30 -07:00
Greg ShuflinandClaude Opus 5.5 11582d1743 syn-gui: exit when the main window can't open
It printed the error and ran on with no window, holding the store lock,
so the next launch was refused too. Now it quits and exits 1. The quit
goes through a task: this runs before the event loop starts, and calloop
clears a stop requested before run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwfXLyeYuKc4RdWEkc8
2026-10-31 00:25:29 -07:00
Greg ShuflinandClaude Opus 5.5 e01cdb50e2 Store directory: a label and the path, with no explainer
The path speaks for itself, so STORE_DIRECTORY_HELP goes from copy, the
desktop's Settings, and Android's (and the FFI record that carried it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwfXLyeYuKc4RdWEkc8
2026-10-31 00:12:40 -07:00
Greg ShuflinandClaude Opus 5.5 98af90faaf TODO: a website backup agent
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwfXLyeYuKc4RdWEkc8
2026-10-31 00:08:57 -07:00
Greg ShuflinandClaude Opus 5.5 1cf2630dc6 Show the store directory in every modality
A read-only "Store directory" row, worded once in copy::settings: the
desktop's Settings › System (middle-truncated, with Copy), Android's
Settings (full and selectable, via a new SyncNode::store_path), and,
since neither has a Settings screen, the TUI Ensemble screen's identity
block and `syn node status`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwfXLyeYuKc4RdWEkc8
2026-10-29 18:17:19 -07:00
Greg ShuflinandClaude Opus 5.5 49fda821f1 TODO: the Android emulator's DHT works; narrow the slow-sync item to what's left
Tested on the syn emulator (Android 17): raw UDP, mainline DHT
publish and resolve all work from the app's uid, and the node's pkarr
record is visible from outside through public pkarr relays. What
remains open is why Android-initiated syncs were slow, with two new
suspects (Android 15+'s background network block, the emulator's
endpoint-dependent NAT), and whether the Android DoH workaround is
still needed now that UDP DNS answers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M7mmwfXLyeYuKc4RdWEkc8
2026-10-28 18:53:04 -07:00
Greg ShuflinandClaude Opus 5.5 ffc1e47ab9 TODO: benchmark the per-transaction SQLite connection and large-file hashing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 18:59:30 -07:00
Greg ShuflinandClaude Opus 5.5 12029075ee syn-daemon: answer store-only commands on the blocking pool
commands::run answered every command inline in the request handler, so
a SQLite transaction or an import hashing files ran on one of tokio's
worker threads and held up the iroh connections and gossip scheduled
on it. The commands that await the network stay in run; everything
else moves to a synchronous run_local that run hands to spawn_blocking.
A new command lands in run_local by default, the safe side to be on.

AwaitChange no longer needs a spawn_blocking of its own. Ctx's job
runner is an Arc now, to go to the blocking pool with the store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 18:58:56 -07:00
Greg ShuflinandClaude Opus 5.5 8559901bc8 syn-daemon: stop without waiting out a TUI's long-poll
axum's graceful shutdown lets every request in flight finish, and a
TUI's AwaitChange stays in flight until its 30-second timeout, so
`syn daemon stop` with a TUI open warned that the daemon had not exited
and it went on running for up to half a minute.

ChangeLedger::close (Store::release_change_waiters) wakes every waiter
and answers every later one at once; the standalone daemon calls it as
its shutdown begins. Not the GUI's embedded socket, whose store goes on
serving the GUI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 18:58:56 -07:00
Greg ShuflinandClaude Opus 5.5 ba3a3b37bb TODO: the daemon starts by exec now
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:10:44 -07:00
Greg ShuflinandClaude Opus 5.5 70658aa77b syn-daemon: start the daemon by exec'ing the client, not by forking it
A background daemon is now the client's own binary executed again —
/proc/self/exe on Linux, so it is the client's build even after a
rebuild replaced the file — named syn-daemon with the store as its
argument, its start-report pipe mapped to fd 3 with command-fds, and
its exit status collected by a reaper thread so a long-lived TUI keeps
no zombie.

Fork-without-exec made the daemon a copy of its client. It carried the
client's argv, which proc_title.rs overwrote through 270 lines of
mostly-unsafe /proc/self/stat parsing; and when it stopped it returned
through the client's call stack, so a TUI's daemon went on to try to
take over a terminal it no longer had, and a CLI's to send its command
to the socket it had just removed. Both are gone with the fork, as are
proc_title.rs and the daemonize dependency. What daemonize did that
still matters — setsid, umask 027 — the child does itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:10:37 -07:00
Greg ShuflinandClaude Opus 5.5 b29ad8ea77 syn-daemon: an entry point for a daemon started by exec'ing its client
Both mains call server::enter_if_spawned first thing. A process whose
environment carries SYN_SPAWNED_DAEMON runs as the daemon for the store
in its first argument, sends its start report down fd 3, and exits;
every other process returns from it at once. Nothing spawns one yet —
the next change does, replacing daemonize's fork.

run's foreground and forked paths now end in one be_the_daemon, which
also writes the PID file daemonize used to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 03:42:01 -07:00
Greg ShuflinandClaude Opus 5.5 dab9fb729e AGENTS.md: how an agent drives the desktop app and the emulator when it's the one looking
Build Debug APK / build (push) Failing after 27s
The gui-app file still told agents never to run the app themselves, against
the root Testing rule. Adds what a session that does look needs: the headless
sway session and its environment, transient units so started processes stop by
name, emulator setup and input quirks, the Gradle daemon's Java 17 pin, and
symbolizing a native hang from debuggerd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:44:51 -07:00
Greg ShuflinandClaude Opus 5.5 019a44fabc TODO: the node runtime keeps the DHT bootstrap record alive; setup stops publishing it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 00:59:16 -07:00
Greg ShuflinandClaude Opus 5.5 c5df07d048 ensemble: setup gives up on the pkarr publish after 10s instead of waiting forever
On the Android emulator outbound UDP is dropped, so the mainline DHT never
answers and publish_membership never returns: the first-run screen spun on
"Initializing node…" indefinitely, though the node was already set up.
The registry entry is optional to a node in any case, since an entry expires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 00:59:03 -07:00
Greg ShuflinandClaude Opus 5.5 73d66b25c9 AGENTS.md: GUI output is looked at by the developer or by the agent; ask which
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 02:30:14 -07:00
Greg ShuflinandClaude Opus 5.5 b7c251a160 TODO: show where the store is, in every modality
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 02:29:54 -07:00
Greg ShuflinandClaude Opus 5.5 ab9af909b0 TODO: decide how making a new ensemble should look across the CLI and first-run screens
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:40:59 -07:00
Greg ShuflinandClaude Opus 5.5 dc32115472 TODO: an offline mode, for a node that never reaches the network
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 8f3370f39d cli: syn init always joins an ensemble; --no-ensemble is gone
The flag predates working ensemble code, and was the last ordinary way to
make a node with a key but no membership — a second shape of node every
other path had to allow for. A node meant to stay on its own is an ensemble
of one: run `syn ensemble init`, then `syn init` with that phrase, and never
add another node. Its prompt variant and two copy strings go with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 34ef6ed7f3 cli: a closed pipe ends syn quietly instead of panicking
`syn ensemble status | head -2` panicked with "failed printing to stdout:
Broken pipe": Rust ignores SIGPIPE before main, so println! gets EPIPE and
panics on it. syn now restores the default disposition, and exits on
SIGPIPE like other Unix tools. The daemon, which is forked from syn and
inherits that, sets it back to ignored before serving, so a client hanging
up mid-response still costs it only an EPIPE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 61f31d8a56 init: setting a node up is one transaction, and keeps a key already there
Every first-run path (desktop, Android, TUI, syn init) wrote the node key,
then its name, then joined in separate steps, and called initialize_node
again on each retry — which INSERT OR REPLACEs the key. A failure after the
membership was saved but before the vault key left a membership certifying
key 1; the retry swapped in key 2, then failed with AlreadyInEnsemble, and
the next launch saw a key, skipped onboarding, and ran with a cert for a
key it no longer had.

init::set_up_node now writes the key, the name, the membership and the vault
key in one transaction, keeping a key that is already saved, then publishes
to pkarr best-effort. register() takes the transaction, so join_local and
create_new_ensemble are atomic too, and the AlreadyInEnsemble check sits in
the same transaction as the write it guards. All four first-run paths call
set_up_node.

A node name settings rejects now fails the desktop's join with that error,
rather than being logged and dropped while the join went ahead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 f83e1be19f cli tests: the gossip test reads the roster heading from copy
91ee328e renamed the heading to "3 nodes in ensemble:", and the test kept
waiting for "3 members" until it timed out, though all three nodes had
found each other. It now asks copy::ensemble_roster for the heading, and
drops three asserts that repeated what wait_for_members already checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 fe2424f03a TODO: frame the Quint item as formal-methods research, with Verus beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg Shuflin c02bd0d894 New test key 2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 768d404bef tui: a first-run screen sets up a node when the store has none
The TUI used to fail on a missing store, or on one the desktop app created
and was closed before finishing setup. It now shows the terminal's form of
the desktop's initialization screen, with the same words from
copy::keyphrase: mint a new ensemble's keyphrase, or join an ensemble with
one. The join runs on a worker thread, creating the store if needed.

After a successful join the TUI execs itself rather than starting the
daemon in-process: the join leaves the process-wide pkarr client's DHT
thread running, and forking the daemon with that thread alive deadlocked
it. Daemon start also moves back outside any terminal session, since the
forked child returns through run_tui and must not find a terminal to
restore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 22a169d6ee copy: the ensemble's roster says "nodes", as the desktop does
The TUI's Members/Member panes become Nodes/Node, and `syn ensemble
members` heads its listing "3 nodes in ensemble:". The rest follows: no
node selected, pick another one, the help overlay's bindings, and the
desktop's own loading line, which was the last place to say "members".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 825c14c566 tui: screens take their words from copy
Every user-visible string in tui-app now comes from synchronicity::copy, as
on the desktop and the CLI. The terminal's key hints and its ? overlay get a
subject of their own, copy::key_hints; the overlay is a table padded at
runtime, since a run of spaces in a copy string fails the indentation test.
Where the TUI paraphrased words the other modalities share, it now uses
theirs: the ensemble identity labels (Ensemble key, Gossip topic, Bootstrap
link, Cert issued), the member pane's labels and ping result, the document
detail's labels and empty sections, presence words, job labels, and the
note-absent sentences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 a0887488f2 copy: one "Ensemble key" label everywhere; name the two "Created"s by modality
The CLI said "Ensemble pubkey" only so its integration tests could find the
value by prefix without matching "Ensemble key generated (…)". The tests'
parser now matches the label from copy plus its colon, so the CLI uses the
same label as the desktop and Android. CREATED/CERT_ISSUED become
CREATED_DESKTOP/CREATED_CLI, saying in the name which one each modality uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 297e3f25d5 lib: copy.rs splits into one file per subject under copy/
copy.rs now only declares the subjects, holds msg!, and re-exports the
formatters (copy/format.rs). The few loose items join their subject:
ContentRowCopy and PeerSyncCopy get files of their own, placement_content/
summary become placement::content/summary, job_activity becomes
job_state::activity, job_history_times* become job_list::history_times*, and
the podcast search and pomodoro sessions copy move into podcasts and pomodoro.
Each subject's tests move with it. The two tests that read the copy's own
source (no run of spaces in a string, msg! ids against the .ftl) now read
every file under copy/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 3f4c29c703 TODO: the remaining copy has moved into copy.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 dcc28eb4fe android: words shared with the desktop come from copy.rs
Kotlin now reads every word it shares with the desktop and CLI through
copy records and export functions in free_fns.rs, held in SharedCopy.
Where Android had worded an idea its own way, copy.rs's wording wins:
"Manage sync for", "Add a person", the keyphrase warning, the Danger
Zone buttons, the wipe-failed sentence and others. Counts it used to
pluralize itself (running jobs, selected types, skip buttons, sync
intervals) are Fluent messages now. Words only Android shows stay
literals, as SharedCopy's doc says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 832c0a4ff9 cli: output takes its words from copy.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 5d53d4ef91 gui: screens take their words from copy.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 27679391be lib: the rest of the frontends' copy, grouped by subject in copy.rs
Every subject the desktop and CLI still wrote out themselves gets a home:
new modules for the app shell, settings, keyphrase onboarding, ensemble
status, jobs, document fields, placement, presence survey, notes, the
reader, PDFs, pictures, video and podcasts, and the existing ones extended.
Duplicates the move turned up are folded together: one "This node" and
node labels in node_display, one Import… in import_picker, the Reclaim
dialog's words in eviction::Dialog, back_to() for every "‹ Place" button,
the agent registry named by each screen's HEADING, and job labels from
document_job in the FFI and the daemon too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 0f55ff4ede extension: pluralize the node count with Intl.PluralRules
The extension can't call the lib's Fluent messages, so it asks the
browser's copy of the same CLDR rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 32dce51fbb android: counts come from copy's Fluent messages
Podcast search, the directory import summary and the hash-row pull
outcome call the lib rather than writing their own plural.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 fd997b25d2 gui: counts come from copy's Fluent messages
Linkages, podcast search, the presence grid, the hash-row pull outcome
and the player's skip tooltips stop pluralizing for themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 e5e94f5346 cli: counts come from copy's Fluent messages
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 1add44c766 lib: counts in copy are Fluent messages, pluralized by CLDR rules
A sentence with a number in it is now a message in copy/en-US.ftl,
rendered through fluent-bundle by copy.rs's msg!, so "1 artifact" and
"3 artifacts" come from the locale's plural rules instead of
"artifact(s)" or an if n == 1 at each site. Only English for now, but a
second language is a second .ftl. A test keeps copy.rs and the .ftl
naming the same set of messages.

Adds copy::count for bare "N things" labels and the sentences the CLI,
desktop and Android still composed for themselves, ready for them to
call. Fixes the plurals that were simply wrong ("1 total nodes").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:39:15 -07:00
Greg ShuflinandClaude Opus 5.5 9851aed695 android: library covers load through Coil, keyed by cover_key
Build Debug APK / build (push) Failing after 2m35s
Comics, music and PDF cards name their cover as a DocumentCover; one Fetcher
reads it through the FFI (MuPDF renders a PDF's first page at the requested
size) and a Keyer caches it under the lib's cover_key, registered app-wide by
a new SynchronicityApplication. The per-screen thumbnail maps and decode loops
are gone, and a cover that changes through sync is no longer held stale for as
long as the screen is open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WsxkM2ja42H2h5BPRexf2r
2026-10-04 04:44:34 -07:00
Greg ShuflinandClaude Opus 5.5 2e394cadc0 lib: library lists say what each cover is cached under
PdfListItem, ComicTreeItem (with ComicShelf::cover for a series' card) and
music's LibraryEntry carry a cover_key: the hashes of the blobs the cover is
drawn from, set only while they are stored here. A frontend that caches covers
by it gets a new key when a cover changes or arrives through sync, rather than
the old picture. LibraryEntry::has_cover becomes cover_key, and an artist's key
is its portrait's or its mosaic's covers'.

Comics read every first page's key in bulk alongside the availability roll-up,
choosing the first page the way list_comic_pages does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WsxkM2ja42H2h5BPRexf2r
2026-10-04 04:44:34 -07:00
Greg ShuflinandClaude Opus 5.5 f8fad97f81 AGENTS.md: a background result knows what it was for
The rule F1's sweep applied across Notes, the player, document detail and the
readers: a buffer carries its record's id, a load into a selection is held
rather than detached, and work that can't be canceled checks a generation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 04:44:34 -07:00
Greg ShuflinandClaude Opus 5.5 d47c21cf86 cli: 'syn init --no-ensemble' says the same sentence as every other no-ensemble path
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 04:44:34 -07:00
Greg ShuflinandClaude Opus 5.5 27892ffe7a TODO: four daemon findings from the manual checks
A long store path can't bind its socket, the local API's 2 MB body limit, the
daemon never closing its iroh endpoint, and a canceled 'syn docs import' that
doesn't say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 04:44:34 -07:00
Greg ShuflinandClaude Opus 5.5 2ec882a90a daemon: 'syn daemon start' says why a daemon didn't start, and fails
Restart forked with daemonize's start(), which exits the parent with status 0
the moment the first child does — so a daemon that then failed (a socket path
too long to bind, a node in no ensemble) said so only in daemon.log.

Both daemonizing modes now fork with execute() and wait on a pipe the child
reports through once its node runtime is up: its error if it failed, nothing if
it died. A child whose socket answers but that hasn't reported within five
seconds is still connecting to the network, and counts as started.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 04:44:34 -07:00
Greg ShuflinandClaude Opus 5.5 c2c7fc453f daemon: a SIGTERM while starting stops it cleanly instead of killing it
The signal handlers were installed only once the server was running, so a
signal during Store::open or NodeRuntime::start took the default action and
left the socket and PID file behind. They are now installed first thing, and
startup is raced against them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 04:44:34 -07:00
Greg ShuflinandClaude Opus 5.5 3278634710 daemon: waiting for a stop means waiting for the process, not its socket
The daemon removes its socket on the way out, before the tasks holding the
store have finished, so 'syn ensemble retire' could find the socket gone and
then fail to open a store still locked. A daemon killed outright never removes
it at all, which a restart reported as 'did not exit within 5 seconds'.

wait_for_exit now takes the pid read before the stop was asked for and waits
for that process to be gone, then clears any socket and PID file it left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 04:44:34 -07:00
Greg ShuflinandClaude Opus 5.5 77ad1fea65 cli: a node in no ensemble is told how to join one, in one sentence everywhere
Rendering syn ensemble members from EnsembleStatus lost the old
snapshot's recourse: on a node in no ensemble it printed a bare "Error:
not part of any ensemble", and so did the retire and renew
confirmations. The daemon's ensemble_status now says
copy::ensemble_roster::NOT_IN_ENSEMBLE, which names what to run — the
sentence syn ensemble status, gossip-status and dht-peers also use,
where before they said it two different ways. The status and members
help no longer claim a certificate check and a gossip-only list that
they stopped doing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 04:44:34 -07:00
Greg ShuflinandClaude Opus 5.5 3a08adea65 android: build the Rust library for the device's ABI, x86_64 included
The x86_64 emulator was running the arm64 .so through the native bridge,
which returns JNI jbooleans with junk in the register's upper bits. Since
jni-sys 0.4 reads jboolean as a Rust bool, every ExceptionCheck reported a
pending exception, so rustls-platform-verifier could neither initialize
nor verify a certificate on the emulator.

Still one Rust cross-compile per build: -PrustAbi wins, else the ABI
Android Studio injects for the device it deploys to, else arm64-v8a. The
.so is now synced into build/rustJniLibs rather than src/main/jniLibs, so
clean removes it and a previously built ABI can't ride along in the APK.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 02:29:29 -07:00
Greg ShuflinandClaude Opus 5.5 7e7f331fd8 lib: initialize rustls-platform-verifier on Android
The cargo update in d370691e took reqwest 0.13.2 -> 0.13.5 and with it
rustls-platform-verifier 0.6 -> 0.7. On Android 0.7 has to be handed the
JavaVM and app Context explicitly, and nothing did, so the first TLS
connection (node init's network setup) failed with "Expect
rustls-platform-verifier to be initialized". initAndroidContext now does
it alongside ndk-context.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 02:29:29 -07:00
Greg Shuflin ffa43e9e5b Commit new test key 2026-10-04 02:29:29 -07:00
Greg ShuflinandClaude Opus 5.5 8e3a49bea9 TODO: a peer's jobs from the remote Sync view, and a Coil fetcher for document covers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:39:01 -07:00
Greg ShuflinandClaude Opus 5.5 4a4789e440 p2p: doc-sync stages each record as it arrived instead of re-encoding it
read_chunk decoded every record off the wire, stage_chunk encoded it
again to stage it, and promote_session decoded it a third time. A record
that decodes is already exactly what promotion will read, so it is now
kept as the bytes it arrived in (ReceivedRecord: its id and those
bytes) and staged as is — one full encode pass less per record on every
catch-up. The decode that checks each record, and drops one this build
can't read, is unchanged. (audit-lib-p2p F3, the type-3 item)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:29:14 -07:00
Greg ShuflinandClaude Opus 5.5 49211050f9 android: one podcast cover composable, loaded through Coil
PodcastCoverArt and PodcastListThumbnail each decoded stored cover bytes
with BitmapFactory on the main thread, fell back to a Coil painter for
the remote URL, and swapped in a placeholder on error; the search
screen inlined the same shape a third time with no error state at all.
PodcastCover hands Coil the stored bytes or the URL as one model — Coil
2 takes a ByteArray — so the decode is off the main thread, downsampled
and cached, with a placeholder for a missing cover and another for a
failed one. A search result whose cover fails to load now shows the
podcast glyph rather than a blank. (F7, the podcast half)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:29:14 -07:00
Greg ShuflinandClaude Opus 5.5 5db5589cba lib: the comics library rolls page availability up in one pass
build_comic_tree_nodes rolled each comic's availability up from its
pages one comic at a time: a page listing, a page-count read and a bulk
availability check per comic, so a library of N comics cost 3N queries.
comic_availabilities does the whole library at once — one read of the
page documents, grouped by comic, and one bulk availability check — and
takes each comic's expected count from the OrderTotal the library tree
already read. The roll-up rule is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:29:14 -07:00
Greg ShuflinandClaude Opus 5.5 1d25080846 lib: one ensemble_peer_ids, freshest first and without revoked peers
The desktop, the daemon and the FFI each had their own ensemble_peer_ids
for a user's pull or push, walking peers in store order with revoked
nodes included — dialling a node whose credential is revoked can only end
in a refusal at admission. scheduler::ensemble_peer_ids is now the one
list, the nodes of ensemble_peers_freshest_first, which already filters
revoked certs and tries the freshest peer first; the three callers keep
only their own error for an empty list, in copy::asset_sync::NO_PEERS's
words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:03:25 -07:00
Greg ShuflinandClaude Opus 5.5 e2628ba6dc p2p: artifact values travel in pages, and the frame cap drops to 64 MiB
An artifact-sync response carried every value asked for in one frame, and
a node catching up asks for every value it is missing at once — the one
message with no bound, which is why MAX_FRAME was 256 MiB. A response
past the cap failed, and failed again on every later pass since each
asked for the same set, so that peer's values never arrived; and an
admitted peer could make this node allocate 256 MiB in one go.

Values now travel in pages of about 4 MiB in both directions: the
responder answers a fetch page by page (reading its store one page at a
time, so its memory is bounded too), and a push is sent the same way
with one ack at the end. A single value too large for a frame is left
out rather than answered None, which would record the peer as lacking
it. The client applies each page as it lands, so a fetch cut off by the
per-peer timeout keeps what arrived and the next pass asks only for the
rest. The session's message count changed, so ARTIFACT_SYNC_ALPN is
bumped.

With nothing unbounded left, MAX_FRAME is 64 MiB. Its doc comment lists
each protocol's bound, and blob-sync, blob-stream and artifact-sync
each have a test building their largest legal message and checking it
fits. (F3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:14:01 -07:00
Greg ShuflinandClaude Opus 5.5 2cf2322a92 gui: Button is an element, and a button is enabled exactly when it has a handler
button(theme, id, label, primary, enabled) decided only how a button
looked; the caller attached the handler separately, so a plain
.on_click on a disabled button still fired. on_click_if gated it, but
the same bool was still written twice and nothing stopped a new call
site from forgetting.

Button is now an opaque RenderOnce element built by button(id, label,
ButtonKind), bar_button, icon_button, transport_button and
transport_button_primary. on_click/on_mouse_down and their _if forms are
the only ways to give it a handler, and having one is what enables it:
no handler draws flat and inert, with no tooltip. There is no
Stateful<Div> left to hang a second handler on; the few adjustments
callers made (w, h, self_start, tooltip) are builder methods.
ButtonKind {Primary, Secondary, Danger, Ghost} replaces the primary
bool and the danger_button/ghost_button functions, and the theme comes
from the context rather than an argument. The one control styled as a
button that isn't clicked, import_trigger's menu, builds on
label_button_shell.

Two buttons changed behavior as a result: Podcasts search's Subscribe
took a plain .on_click, so "Subscribed ✓" subscribed again —
subscribe_button now takes the handler and gates it itself; and the
subscriptions screen's placeholder Sort, drawn clickable with nothing
behind it, now draws disabled. Android needed nothing: its hand-rolled
.clickable uses are rows and cards, none drawn disabled. (F2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:49:54 -07:00
Greg ShuflinandClaude Opus 5.5 13854685d9 TODO: the document detail drops a property edit when it reloads
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:36:35 -07:00
Greg ShuflinandClaude Opus 5.5 ef8c77fb65 podcasts: subscribe takes a NewFeed record across the FFI
Adding the RSS URL gave PodcastFfi::subscribe eight positional arguments
(clippy's too_many_arguments, which lint-rust reports but does not fail
on). NewFeed is now a uniffi::Record and the one argument, so Android
builds the same struct the desktop does; its last-fetched time crosses
as a Timestamp rather than a string parsed on the Rust side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:27:36 -07:00
Greg ShuflinandClaude Opus 5.5 76f110f4d8 gui: Pictures' fetch progress and Ensemble's revoke outcome stay on their own item
An image fetch that finished after the user moved on cleared the newer
image's progress block; a revoke that finished after its dialog was
canceled and another node's opened wrote its outcome into that dialog.
Both now check the item they were about. (F1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:16:00 -07:00
Greg ShuflinandClaude Opus 5.5 1a0d57f876 gui: PDF page turns and bookmark reads land only for the page and PDF asked
go_to_page renders could land out of order — the toolbar, scrub bar and
outline aren't gated on loading — showing, and saving as the reading
position, a page the user had already left; the page turn is now a held
Task that the next one replaces. refresh_bookmarks applies its list only
if that PDF is still the selected one. (F1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:16:00 -07:00
Greg ShuflinandClaude Opus 5.5 c81a9ebdd2 gui: a comic that finishes opening late doesn't replace the one picked after it
open_comic was detached and unguarded, and the library stays clickable
while a remote first page arrives — so opening A then B could end with
A in the reader, or with the reader popping open after Back. The open is
now a held Task that opening another comic or closing the reader drops.
(F1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:15:59 -07:00
Greg ShuflinandClaude Opus 5.5 ab0a7747ce gui: Music's selection and library reads can't land after a newer one
select_track resolved a track into the shared selected-track mutex in
the background, before checking whether the user had since picked
another — so a slow load of A could leave A's decoder there while the
bar named B, and Play sounded A under B's title. A selection counter is
now checked under that mutex immediately before the write, as the player
does, and the selection's Task is held so a newer one cancels the
stream fallback's network wait too (which also stops a stale load
clearing the newer one's progress block). refresh_library_view's Task is
held for the same reason: rows from a level the user had left put
library_rows out of step with library_path. (F1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:15:59 -07:00
Greg ShuflinandClaude Opus 5.5 7366805c9a gui: a document detail's async results land only on that document
Every async step on the detail screen — the detail load, the delete-
locally presence check, pulls, pushes, peer overrides, purge, eviction —
wrote its result into whichever detail was open when it finished. Start
the delete-locally check on A, go back and open B, and B's dialog
offered A's eviction plan, which Confirm then executed under B's id; a
slow load of A could seed B's properties table, and B's Edit/Save would
write them to B.

Results are now written through detail_for(id), which returns the open
detail only if it is the document the step was about; per-peer results
find their Placement row by node rather than by an index taken when the
action started, since a placement reload re-sorts the rows. The detail
load is held in Detail rather than detached, so opening another
document cancels it. A purge that finishes closes the detail only if
it is still the purged document's. (F1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:11:20 -07:00
Greg ShuflinandClaude Opus 5.5 8bc9dacd09 gui: a stream that opens after a newer play can't replace it in the player
start_audio opened the stream (the slow part) and loaded it into the
shared player in the background, and checked play_seq only afterwards,
in the apply step. Play episode A then B, and if A's stream opened last
it replaced B's in the sink while the bar still said B: the next Play
sounded A, and the ticker reported A's position as B's, which Podcasts
persists into B's listen state. play_seq is now shared with the load and
checked under the audio lock, immediately before the load, so a load
that has been superseded never touches the player. (F1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:09:18 -07:00
Greg ShuflinandClaude Opus 5.5 40a054e0eb gui: Notes' editor knows which note it holds, and a stale load can't land
The A/B autosave race was fixed by one check in the load's apply step,
with about ten more of that shape guarding the rest of the async steps.
Two structural changes make the class impossible instead:

- The editor, its note's id and the sync guard are one OpenNote, held
  by ContentState::Loaded rather than beside it. schedule_save and
  flush_save take their destination and their text from the same
  OpenNote, so a save can only write a note's own buffer into it; the
  open-note re-read, the incoming-version actions and Export read it
  the same way. close_note is the one place it is dropped, and updates
  the rail with it.
- The note load is held in _load_task instead of detached. Selecting
  another note, switching notebook or losing the note to a tree reload
  replaces or drops it, and gpui cancels it before its result can land,
  so the apply step no longer checks the selection.

Also: "Start this note over" reopens the note only if the user is still
on it, rather than pulling back one who moved on while it ran. (F1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:07:03 -07:00
Greg ShuflinandClaude Opus 5.5 414c06eacd TODO: interactions with more than one attendee, which the lib supports and no frontend reaches
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:53:45 -07:00
Greg ShuflinandClaude Opus 5.5 1a3eb9f65f AGENTS.md: a preferences screen is not a record, so editing-as-a-mode doesn't reach it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:44:19 -07:00
Greg ShuflinandClaude Opus 5.5 da4336a791 podcasts: one feed episode list, podcast::feed_episodes, for both frontends
The desktop's with_store_state and Android's withStoredEpisodes each
took the Podcast Index page, folded in the stored episodes it was
missing, and re-sorted newest first, and each one's doc comment said it
mirrored the other. That rule is now podcast::feed_episodes over a new
FeedEpisode record (api id, title, description, published, duration,
stream URL, image), which fetch_episodes returns across the FFI and
PodcastFfi::feed_episodes exposes.

Only the list is shared. What the store knows about each episode stays
each frontend's to layer on: the desktop folds it into EpisodeRow (rows
already on screen are kept, so a save in progress stays marked), and
Android keeps its separate storeState map, applied as it arrives while
list changes wait behind the held-episodes strip. Android drops its
PodcastIndexEpisode and PodcastEpisodeItem mappers for one FeedEpisode
mapper; list_episodes and PodcastEpisodeItem leave the FFI, and
PodcastIndexEpisode stops crossing it. (P4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:29:59 -07:00
Greg ShuflinandClaude Opus 5.5 3820d4e81b podcasts: the Podcast Index id is PodcastIndexFeedId, and the RSS URL is kept
A subscription stored the feed's Podcast Index id in a property named
PodcastFeedRssUrl, and the search result's real RSS URL was dropped. The
id now lives in PodcastIndexFeedId, named for what it holds, and
PodcastFeedRssUrl holds the URL — written at subscribe on desktop and
Android from the search result, and read back as PodcastFeed::rss_url /
PodcastItem.rss_url. Nothing fetches from it yet; it is the publisher's
own address for the feed, which reading feeds without the directory
(docs/rss-reader.md phase 6) would need.

Not converted in place: a store holding feeds from before this change
reads their old id as an RSS URL, and is recreated rather than migrated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:07:12 -07:00
Greg ShuflinandClaude Opus 5.5 4ba394af1d TODO: starting the daemon by exec, which would retire proc_title.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:14:16 -07:00
Greg ShuflinandClaude Opus 5.5 932a901bd8 cli: syn ensemble status and members render the lib's EnsembleStatus
The CLI had its own EnsembleMembers daemon command, whose snapshot
re-derived by hand what ensemble::screen::build_ensemble_status computes
— the revoked set, per-peer health, this node revoked or left behind by
an epoch — and syn ensemble status re-derived the pkdns link and gossip
topic the same status already carries. Both now read EnsembleStatus, the
snapshot the TUI already gets, and EnsembleMembers, its two snapshot
structs and the daemon's builder go. So do the retire and renew
confirmations' counts and syn ensemble gossip-status's peer list.

What changes in the output: "last seen" is the shared relative wording
rather than a UTC timestamp; with the daemon running the member list
also shows nodes known only from the pkarr registry, marked "not seen
via gossip yet"; and syn ensemble status drops the pkarr z32 line
(it is in the DHT bootstrap link) and the cert-signature line. The
gossip integration test now waits for every member to be seen via gossip
rather than for the count, which registry-only members reach first. (F3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:14:01 -07:00
Greg ShuflinandClaude Opus 5.5 c418d8e218 daemon: one NotesItem Delete/Rename for notebooks, collections and notes
NotebookCmd, NoteCmd and CollectionCmd each carried their own Delete and
Rename, all six answered by the same delete_item/rename_item on the same
tree. They are now DaemonCommand::NotesItem(NotesItemCmd::{Delete,
Rename}); the CLI keeps its three verbs per kind and sends that, and the
TUI drops the ItemKind mapping that existed only to pick a variant.
A daemon-protocol change; no ALPN is involved. (F21)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:00:24 -07:00
Greg ShuflinandClaude Opus 5.5 bc207e6bc4 cli, tui: syn jobs cancel, and c on the TUI's Jobs screen
Three daemon comments and a protocol doc told the reader to run syn jobs
cancel, which did not exist; the TUI's Jobs screen said it had no cancel
because the protocol had no command for one. The daemon's JobRunner
could always cancel. JobsCmd::Cancel { id } now asks it to (Write, the
reach that starts an import), syn jobs cancel <ID> sends it and says
what happened in copy::job_cancel's words, and c cancels the selected
job on the TUI's Active tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:58:30 -07:00
Greg ShuflinandClaude Opus 5.5 1409666a5e AGENTS.md: no database migrations; a store is recreated, not converted
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:42:28 -07:00
Greg ShuflinandClaude Opus 5.5 b97bf4fb49 TODO: ship one rustls crypto provider; pkarr's relays are what keeps two
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:31:13 -07:00
Greg ShuflinandClaude Opus 5.5 94b52ac31a lib: a blob on another node is None, and Notes says so in Pictures' words
load_image_bytes, load_pdf_bytes and load_comic_page_bytes returned
BlobStoreError::NotFound when the document was here and its bytes were
elsewhere, and five callers matched that arm out to mean "ask a peer".
They now return Option, with None for exactly that (load_blob_if_local),
and the callers lose the match. ComicsFfi::get_cover_bytes is Option too,
so Android stops logging an absent cover as a failure.

The one caller that showed the error was Notes' embedded images, whose
placeholder read "blob not found: blake3:…". It now gets
ImageState::Absent with copy::picture_absent's headline for the
image's availability, drawn as a plain placeholder rather than an
error — absence is not an error. (M3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:31:13 -07:00
Greg ShuflinandClaude Opus 5.5 3767af658b android: a picked file streams to disk instead of into the heap
Both Android import paths — a single picked file and a folder import —
read each file whole into a ByteArray and handed it across the FFI, where
Rust wrote it back out to a staging file because the importers take a
path. A large video or PDF was the whole file in the heap, twice.
Kotlin now streams the content into the app's cache, and
ImportBatch::import_file takes that path: StagedFile::adopt moves it
under the name dispatch needs (a rename on one filesystem, a copy and
delete otherwise) and removes it once the import is done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:31:13 -07:00
Greg ShuflinandClaude Opus 5.5 d42c4cd974 lib: a registry entry drops the cert signature nothing could check
Each pkarr registry entry carried a copy of its node's delegation-cert
signature, which was never verified and could not be: the cert's signed
payload also covers its version and epoch, which the entry doesn't hold,
and the packet is already signed by the ensemble key. It was 64 of every
entry's 105 bytes against pkarr's 1000-byte packet, so the registry held
6 members before evicting the oldest; it now holds 13.

Entries are written at version 2 (version, pubkey, created_at). The
decoder still reads a version 1 entry's identical prefix, so a registry
an older build published keeps bootstrapping until a node republishes
it. The packet-size tests become one parameterized case at the new
ceiling; the eviction test, which re-implemented the loop rather than
calling it, goes with them. (F21)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:13:44 -07:00
Greg ShuflinandClaude Opus 5.5 ec46db167e lib: EnsembleMembership reads its ensemble key from the cert
It stored the ensemble pubkey twice — once beside the delegation cert and
once inside it — with nothing keeping the two equal. The field goes and
ensemble_pubkey() reads the cert's, which is the one the signature
covers. A membership saved by an older build still loads: serde ignores
the field it no longer has. (F21)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:06:37 -07:00
Greg ShuflinandClaude Opus 5.5 27ac27e7e6 lib: an agent's type follows from its group
AgentType::Control is exactly the System group — Ensemble, Jobs and
Settings — so each registry row stopped saying so a second time.
AgentGroup::agent_type derives it, and AgentMetadata::agent_type reads
it; the FFI record still carries the field. (A-1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:01:28 -07:00
Greg ShuflinandClaude Opus 5.5 37db71fa81 lib: drop the retired-human-kinds conversion at artifact-store open
The project takes no explicit database migrations — a store from an
older schema is deleted and recreated, not converted — so the one-shot
rewrite of human_job/human_religion/human_pet/human_web_presence rows
into facts goes, with its four tests and the Json/Uuid error variants
only it constructed. Also drops a doc comment left behind when the ADR
0038 migration's test went, which had attached itself to the next test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:00:01 -07:00
Greg ShuflinandClaude Opus 5.5 99dd0eaf0c TODO: one rule for Unicode case-insensitive matching, in every modality
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:57:25 -07:00
Greg ShuflinandClaude Opus 5.5 ebb276b77e ffi: JobSubject and ContentKey cross as themselves
Kotlin named a job's subject through JobSubjectRef and an artifact through
DocumentAssetRef — FFI-only copies of JobSubject and ContentKey, each with
a TryFrom back. They existed because the real enums had tuple variants,
which uniffi hands Kotlin as v1/v2. Both now have named fields (Peer
{ node }, DocumentToPeer { document_id, node }, Blob { hash }, Artifact
{ id }, …) and derive uniffi::Enum, so the copies and their conversions
go. BlobHash crosses as its "blake3:<hex>" string and a bare Uuid as its
hyphenated one; a malformed one from Kotlin lifts as InvalidInput.

job_match_key now takes the subject a job row is built from, so the
drift-guard test that compared the two spellings has nothing left to
compare. (F4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:31:56 -07:00
Greg ShuflinandClaude Opus 5.5 dcd8ed77a6 ffi: JobState crosses as itself; Failed names its message
JobItem.state was a snake_case tag beside an error field only Failed
ever set, and the Jobs screen compared the tag against "running",
"queued", "done" and "failed". JobState is now a uniffi::Enum and
JobItem carries it; Failed(String) becomes Failed { message } so Kotlin
reads .message rather than .v1. JobItem.error goes — Kotlin never read
it, since the failure already reaches it through status_line. (F4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:11:17 -07:00
Greg ShuflinandClaude Opus 5.5 651085adca ffi: JobKind crosses as itself, and Kotlin's JobKinds mirror goes
JobItem.kind was a snake_case string, so Android compared it against
string constants it kept itself — a JobKinds object, a private
CONTENT_STREAM_KIND, and two bare "push"es on the Jobs screen. JobKind
is now a uniffi::Enum: JobItem carries it, job_match_key and
job_kind_label take it, and a misspelled kind is a compile error rather
than the InvalidInput that job_match_key used to return for one. (F4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 16:54:35 -07:00
Greg ShuflinandClaude Opus 5.5 bb88bdacce lib: a node-bearing record hands back its NodePubkey, not hex
DelegationCert, RegistryMember, PeerNode and RevocationRecord each kept
their own node_id_hex, and two of them a node_short_id that cut the key
with no ellipsis. Each now has one typed accessor — node(), or
revoked_node() on a revocation — and callers say .to_hex() or
.short_id() on what it returns, so a shortened node id goes through
copy::short_id like every other. The NodePubkey(x.node_pubkey) wrappers
at call sites fold into the same accessor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:54:11 -07:00
Greg ShuflinandClaude Opus 5.5 7b25aadf91 lib: NodePubkey::short_id is copy::short_id, ellipsis and all
short_hex cut the key to its first 8 hex characters with no ellipsis,
and its TODO asked for exactly the helper copy::short_id now is. Peer
labels in the sync logs now read like every other shortened id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:40:55 -07:00
Greg ShuflinandClaude Opus 5.5 4f05c05ca4 gui: Documents, the PDF side panel and QR Code empty states use components::note
Each drew its own centered line: Documents a bold large "No documents"
beside fill_note's "Loading…" and "Nothing matches.", the PDF side panel
a MICRO-sized row, QR Code a default-sized one. They now share note's
look and keep only their own placement. Humans' empty state stays: it
carries an "Add a person" button, which a note does not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 05:07:33 -07:00
Greg ShuflinandClaude Opus 5.5 80cb4aca40 gui: the PDF toolbar says "Zoom:" like Comics and Pictures
The PDF reader drew its zoom controls bare while the other two readers
labeled them. It now builds the group with components::reader::zoom_group
and keeps its info button inside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 05:06:07 -07:00
Greg ShuflinandClaude Opus 5.5 d3d9f08782 gui: Notes guards its open note with SyncGuarded
The open note's stored_body/incoming_body pair and its hand-written
broadcast loop (watch_open_note) were the last hand-rolled copy of the
alert-don't-apply shape. Notes now holds the body as
OpenNote { id, body: SyncGuarded<String> }, and check_open_note does
Clippings' check: read the note on the background executor, treat text
equal to the editor as this node's own save, and only then
observe_fetched. It runs from store_watch::follow, so it follows the
store while Notes is on display and catches up on arrival.

Two behaviors change, both accepted in the audit decision:
- Keep mine dismisses the incoming version, so a re-read of that same
  version no longer re-alerts. That memory replaces stopping the watch
  until the overwrite finished.
- A version that arrives while Notes is off display is announced on
  return rather than as it lands, and a newer version replaces a pending
  one instead of being missed until the first is resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 04:19:51 -07:00
Greg ShuflinandClaude Opus 5.5 ea16c4aab8 gui: a rail click never re-reads a popped-out screen
Clicking a rail row whose screen is popped out only raises its window.
App::set_current_view already declined to reload Documents and Jobs in
that case, since a re-read would move what the user is pointing at, but
every screen using store_watch::on_arrival/follow re-read anyway.
on_arrival now holds the one rule: skip when popped out. A popped-out
screen is on display, so watch_on_screen has kept it current.

Documents and Jobs move their arrival reload out of app.rs into
on_arrival, and Clippings drops its own visibility plumbing
(clippings_visible/sync_clippings_watch/hide) for on_arrival plus
watch_on_screen like every other screen. Clippings therefore no longer
re-reads when it is popped out or back in, only on arrival.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 04:17:49 -07:00
Greg ShuflinandClaude Opus 5.5 4d705e170a lib: one filtered document tree for desktop and Android
The filtered Documents listing (matches plus their ancestor chain) was
assembled twice, in gui-app's visible_filtered_rows and Kotlin's
filteredDocumentTree, and the copies disagreed on one edge: a row that
arrived as both a match and context was drawn once on the desktop and
twice on Android. documents::filtered_tree is now the one assembly, over
(id, parent_id) pairs; the desktop calls it directly and Android through
the filtered_document_tree export. It also no longer repeats an expanded
match's child that the listing already placed. The mirrored test suites
become one rstest table in the lib.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 04:15:17 -07:00
Greg ShuflinandClaude Opus 5.5 1b5b35420b cli: the binary is syn
It was built as syn-cli while every message it prints, and the daemon's,
tells the user to run `syn …`. The [[bin]] is now syn (the package stays
syn-cli, so -p syn-cli still selects it), and the justfile recipes, the
integration tests' CARGO_BIN_EXE lookup and the flake's package follow —
nix's default package is now .#syn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 04:27:41 -07:00
Greg ShuflinandClaude Opus 5.5 8c4ff271a0 lib: pictures and music share one LibraryTreeItem
PictureTreeItem and MusicTreeItem were the same record but for music's
subtitle. Both libraries now hand out agents::LibraryTreeItem, built by
TreeNode::into_item; pictures leave the subtitle empty. Video and comics
keep their own item types, which carry more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 04:18:12 -07:00
Greg ShuflinandClaude Opus 5.5 86ee31c116 lib: a library leaf with no availability answer is Unavailable in every library
library_tree took the fallback as a parameter because the libraries
disagreed: pictures said Local ("nothing known to be missing"), video,
music and comics said Unavailable. It only arises when a leaf vanishes
between two reads in one transaction, and there claiming the bytes are here
is the one answer that can be wrong, so it is Unavailable everywhere and the
parameter goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 04:03:37 -07:00
Greg ShuflinandClaude Opus 5.5 6e7e77de31 android: stop threading nativeLib through every screen
With NativeLib an object, the ~60 nativeLib parameters and the ~100
arguments passing it down — from MainActivity through each screen, its
sections, its repositories and its helpers — carried nothing a call to
NativeLib doesn't. They go, along with the repositories' now-empty
constructors. (F2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 03:36:46 -07:00
Greg ShuflinandClaude Opus 5.5 88146069a4 android: NativeLib is an object
Every instance was a stateless view of the process-wide node handle held
in its companion, and 15 sites constructed one (most as
remember { NativeLib() }). It is now the singleton it always behaved as.
The JNI binding is unchanged: initAndroidContext is still an instance
method, now on the object's one instance. (F2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 03:34:01 -07:00
Greg ShuflinandClaude Opus 5.5 07766080f5 android: the scheduler worker leaves Wi-Fi and charging to WorkManager
SchedulerConstraints re-checked the unmetered-network and charging
constraints the WorkRequest already declares — schedule() rewrites them on
every settings change, and WorkManager stops a worker whose constraints
stop holding — and its doc still said no Android driver ran the scheduler.
The worker now checks only that the scheduler is enabled. (F4i)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 03:12:54 -07:00
Greg ShuflinandClaude Opus 5.5 973c427c89 android: delete the Documents row menu and its settings dialog
Each row's ⋮ opened a menu with one item, "Settings", which opened a
read-only dialog of the title, type and created date — what the row itself
and the detail screen already show. (F4h)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 03:12:54 -07:00
Greg ShuflinandClaude Opus 5.5 e3bbfefe42 android: delete the Node Key screen
Settings → System opened a screen showing one HashChip of the node's key,
which Settings → Ensemble already shows in its membership grid. The screen,
its route, the button, the System tab's now single-route nav graph, and the
FFI field that carried its explainer go. (F4g)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 03:12:54 -07:00
Greg ShuflinandClaude Opus 5.5 fc5ed4720f android: the player drops its unused artwork and visualization regions
No Android player turned artwork on, and Visualization had only NONE, so
the capability flags, the Artwork and Visualization composables and
NowPlaying.artworkUri go. ADR 0046 and the design doc note that Android no
longer carries them; the desktop keeps both. (F4f)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 03:03:26 -07:00
Greg ShuflinandClaude Opus 5.5 fecc759717 android: delete the Notes screen's empty right-hand tab panel
NoteTabSidebar offered Info/Tags/Links/History/Attachments tabs that only
highlighted when tapped and had no content behind them, and the desktop has
no such panel. The panel, its header toggle, and the edge swipe that opened
it go; the notebook sidebar is unchanged. (F4e)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 03:02:04 -07:00
Greg ShuflinandClaude Opus 5.5 80fa9488e8 android: Pictures and the comic reader zoom through ZoomState
Both hand-rolled their own scale/offset and transformable, without the
shared viewer's pan clamp or double-tap. ZoomState now takes a per-viewer
zoom range (Pictures keeps 0.5–8x) and a rotation (Pictures' quarter
turns), ZoomableBitmap takes an ImageBitmap, and it only pans once zoomed
in — the rule the comic reader's pager needed, and harmless to the rest,
since an unzoomed image has nowhere to pan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:51:08 -07:00
Greg ShuflinandClaude Opus 5.5 d7b3947d3a android: one stacked label/value row, ui/LabeledValue
Four private variants — InfoRow, DocumentSettingsRow, MetadataRow and
FactRow — and Humans' ReadOnlyField each laid out the same line, two of
them as a two-column grid that CLAUDE.md says Android does not use. They
are all LabeledValue now, which carries the stacked-on-a-phone rationale
that lived on ReadOnlyField.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:48:27 -07:00
Greg ShuflinandClaude Opus 5.5 9ff527e39a android: the podcast detail screen is a SubAppScreen
It hand-rolled the Surface, back handler and a back-button row that
SubAppScreen provides. The podcast's title moves into the header (so the
body no longer repeats it), and the info button becomes a header action.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:46:56 -07:00
Greg ShuflinandClaude Opus 5.5 a18bd4b8f0 gui: the PDF info popup is a Modal
It hand-rolled the backdrop, card and click-swallowing that Modal already
does, with a bespoke ✕. It now uses the dialog pieces every other modal
does and closes with a Close button — copy::action::CLOSE, which Android's
two info dialogs now read too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:45:08 -07:00
Greg ShuflinandClaude Opus 5.5 09d8f6d00b gui: Video, QR Code and the podcast detail screens use screen_header
They each drew their own title row: Video a bold text_xl clone of the
header, QR Code a title inside its padded body, and podcast detail and
episode a "← Back" button beside a heading in the scrolling column. They
now open with the same header row as every other screen, and their back
buttons read "‹ …" like the rest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:44:05 -07:00
Greg ShuflinandClaude Opus 5.5 ed7e3171bb gui: one held-list strip for Documents, Clippings and podcast episodes
Three screens each drew "N new … — Show" for a list a sync is holding
back, in two different looks. components::incoming_banner::held_strip is
the list-level counterpart of incoming_banner, and all three use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:44:05 -07:00
Greg ShuflinandClaude Opus 5.5 b66874262e gui: Clippings' incoming-change banner is the shared one
It drew its own column of text over two buttons; incoming_banner is the
strip Notes and the podcast queue already show for the same choice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:41:18 -07:00
Greg ShuflinandClaude Opus 5.5 c28ffc5a88 gui: the PDF reader's Outline/Bookmarks switch is the shared tab bar
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:40:55 -07:00
Greg ShuflinandClaude Opus 5.5 8468ef5eef gui: the media library's tabs and layout toggle are the shared components
Its tab bar hand-rolled what tabs::{tab_bar, tab_pill} draw, and its
cards/list toggle was two separately rounded squares beside an existing
icon_segmented_bar that does the same job (and gives each option a
tooltip, now from copy::library_layout).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:40:29 -07:00
Greg ShuflinandClaude Opus 5.5 bdffc838e3 copy: a fetch no peer answered names what it was fetching
Folding PdfError/ComicError into ContentFetchError (X-6) turned "couldn't
reach a node that has this PDF" into "…this content", right after the
reader had said "Finding a node with this PDF…". The sentence is now
copy::content_fetch::unreachable(subject); the PDF, comic and picture errors
word their wrapped fetch error with their own noun, and the FFI keeps that
wording rather than the inner error's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:17:14 -07:00
Greg ShuflinandClaude Opus 5.5 778fbe8209 android: the podcast held-episodes strip counts, like the desktop's
It always said "Episodes changed elsewhere." while the desktop said "3 new
episodes." Both now read copy::podcast_episodes::held; Android through
podcast_episodes_held.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:08:08 -07:00
Greg ShuflinandClaude Opus 5.5 c7a72a990c copy: the Sync settings "Run now" summary is one sentence, shared
The desktop and Android each built it, capitalized differently, and both
counted thumbnails, artifact values and whole files together as
"artifact(s)". copy::settings::run_summary counts the three apart, and
says so plainly when nothing arrived; Android reaches it through
scheduler_run_summary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:07:01 -07:00
Greg ShuflinandClaude Opus 5.5 9386ca7576 copy: a document with no title reads "Untitled" in every modality
The desktop Documents screens and Android said "Untitled Document", the
TUI "(untitled)", the CLI "(untitled)" or "(no title)", and the lib's
own import and title fallbacks spelled out "Untitled" rather than naming
copy::document_display::UNTITLED. All of them now use the constant
(Android through placeholders().untitledDocument).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 01:31:16 -07:00
Greg ShuflinandClaude Opus 5.5 a88bca4982 copy: an unnamed "Other" contact protocol has its own validation sentence
The desktop's "Name the protocol first" was not a paraphrase of
CONTACT_NEEDS_PROTOCOL (no protocol picked) but a different condition:
Other picked with its name left empty. It gets its own constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 01:28:26 -07:00
Greg ShuflinandClaude Opus 5.5 8ee258ad54 copy: a retired node's closing sentence says what happened and what to do next
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 01:28:09 -07:00
Greg ShuflinandClaude Opus 5.5 c42454854d copy: a shortened id keeps its prefix, the way git shortens a hash
truncate_id/short_id kept the first `keep` characters and the last four
(3fa9c1d2…a1b2), cutting ids from the middle like readable text. Every id
here is random (UUIDv4/v5, node keys, BLAKE3 hashes), so the end is no more
distinguishing than the start, and the prefix is the conventional handle:
3fa9c1d2…. A scheme label such as `blake3:` is kept whole and not counted, so
a blob hash still shows eight characters of the hash itself. Every hash chip
on desktop and Android (via the short_id/truncate_id exports) and the browser
extension's truncateId change with it; ADR 0026 records the amendment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X3HRVnoLened7RocqUkvFs
2026-09-28 20:25:08 -07:00
Greg ShuflinandClaude Opus 5.5 8c43229925 AGENTS.md: ids keep their prefix when shortened; the middle cut is for readable text
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X3HRVnoLened7RocqUkvFs
2026-09-28 20:13:17 -07:00
Greg ShuflinandClaude Opus 5.5 220bc4e15e TODO: move the remaining user-visible strings into copy.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X3HRVnoLened7RocqUkvFs
2026-09-28 20:13:17 -07:00
Greg ShuflinandClaude Opus 5.5 1f58066562 TODO: pluralize copy with a library, in every modality
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X3HRVnoLened7RocqUkvFs
2026-09-28 20:09:01 -07:00
Greg ShuflinandClaude Opus 5.5 93a0042601 rust: a job's status line is Job::status_line
The desktop's render_status_line and Kotlin's JobStatusLine derived the same
text (progress message while running, the failure once failed, otherwise the
state's word). Job::status_line now does, JobItem carries it as statusLine,
and each screen keeps only its color choice. The job_state_label export lost
its one caller and is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X3HRVnoLened7RocqUkvFs
2026-09-28 19:38:58 -07:00
Greg ShuflinandClaude Opus 5.5 615b2d1bcf rust: a music folder's "N tracks" line comes with its tree item
MusicTreeItem carries its subtitle, computed in build_music_nodes (every
track counts toward each folder above it, walking parent links once rather
than recursing per card) with the words in copy::music::track_count. The
desktop's descendant_track_count and Kotlin's descendantTrackCount — the same
recursion with the same sentence — are gone. So are the desktop's and
Kotlin's per-level re-sorts of the music and video trees: the lib already
lists them collections-first by lowercase title (sort_for_display), and a
filter keeps that order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X3HRVnoLened7RocqUkvFs
2026-09-28 19:28:59 -07:00
Greg ShuflinandClaude Opus 5.5 713a3f4504 copy: a node's presence word comes from copy::content_presence
The desktop's PresenceLook::label and Android's PresenceLook.label derived
the same word ("Not here" for Absent/Removed, the model's own word
otherwise); both now call copy::content_presence::presence_label, exported
for Android. The row-level words ("Partly here", "Arriving") are
desktop-only and stay where they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 19:19:03 -07:00
Greg ShuflinandClaude Opus 5.5 2d1122a075 copy: the music build summary line lives in copy::music
The desktop's summary_line and Kotlin's buildSummaryLine/plural were the
same sentence built twice ("N tracks in N albums by N artists; N not yet
available", "Library build canceled"); both now call
copy::music::library_build_summary, exported for Android.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 19:19:03 -07:00
Greg ShuflinandClaude Opus 5.5 5a2e8419c6 rust: one case-insensitive wikilink title lookup for every notes screen
markup::resolve_wikilinks_by_title builds the lowercased title index that
the desktop Notes pane and the FFI's resolve_wikilinks (Android) each built
by hand, so the matching rule is written once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 19:19:03 -07:00
Greg ShuflinandClaude Opus 5.5 37dd66b072 rust: the comics library's derivations live in lib's ComicShelf
The desktop's ComicsView and Android's ComicRepository each carried the same
tree logic ("Mirrors the desktop …"): sibling order, the recent filter,
latest-read leaf resolution, series root and effective direction, first
descendant / cover comic, the "N chapters · Continue: X" subtitle and the
In Progress list. They agreed rule for rule, so both now ask
agents::comics::ComicShelf (a uniffi Object on Android), with the words in
copy::comics. ComicTreeItem carries its latest_read_child, which ends
Android's one FFI call per collection on every load (and one per
standalone comic on entering In Progress, now one call); ComicsFfi.list and
get_latest_read_child give way to shelf/in_progress. RECENT_WINDOW_DAYS moves
from agents::pdf to agents and stops being redeclared by the desktop comics
screen and Kotlin. Sibling order keeps both frontends' plain case-insensitive
title fallback (the lib doc had claimed natural-name order; corrected).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 19:07:53 -07:00
Greg ShuflinandClaude Opus 5.5 dd3e0265ac rust: one async typed Podcast Index client, records across the FFI
agents::podcast's search and episode fetches are one async index_get<T>:
the credential read, one SHA-1 auth header, reqwest's query encoder,
error_for_status (a 401/429 no longer surfaces as a serde "missing field"
error) and .json() in place of text + serde_json. Gone: the two catch_unwind
wrappers, the reqwest::blocking call, the per-call runtime + block_on, the two
description-cleaning loops (one clean_description), and the parse ->
re-serialize -> re-parse round trip. PodcastSearchResult and
PodcastIndexEpisode (trimmed to the fields a frontend reads, which also drops
the non-optional dateCrawled that could fail a page) derive uniffi::Record.

Desktop: search and the episode fetch are awaited on the tokio runtime via
network_task instead of blocking a gpui worker (CLAUDE.md: network waits never
occupy a UI worker thread); the store overlay stays on the background
executor. PodcastsView holds AppServices to hand the runtime down.
Android: PodcastFfi.search/fetchEpisodes return the records directly (run on
a current-thread runtime of their own, since they need no P2P node);
PodcastApi.kt and its four @Serializable mirrors are deleted. Search now uses
GET, as the Podcast Index documents for every endpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:50:32 -07:00
Greg ShuflinandClaude Opus 5.5 ff6190f502 rust: MusicError carries AudioError and the decoder's error typed
MusicError::Audio(String) took both the audio player's AudioError and
symphonia's probe/decoder errors through e.to_string(). It is now
Audio(#[from] AudioError), transparent, and Decode(#[from] symphonia's
Error), so the four map_errs go (queued by the lib-agents batch).

Fixes a doubled prefix: an AudioError already reads "audio error: ...",
and wrapping its string in Audio's "audio error: {0}" showed
"audio error: audio error: ...".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:02 -07:00
Greg ShuflinandClaude Opus 5.5 fb3a156423 rust: AgentGroup derives VariantArray in place of a hand-kept all()
The rail, the FFI's get_agent_groups and the registry test iterate
AgentGroup::VARIANTS, so a new group cannot be left out of a hand-written
list. gui-app takes strum (already in the workspace) for the trait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:02 -07:00
Greg ShuflinandClaude Opus 5.5 eca7bfc717 rust: pomodoro phase words come straight from copy::pomodoro
PomodoroPhase::label and completion_message only forwarded to
copy::pomodoro::{phase, completed}; the desktop timer and the FFI call copy
directly and the two methods go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:02 -07:00
Greg ShuflinandClaude Opus 5.5 b48e4eff90 rust: podcast listen state is saved through save_listen_state alone
save_listen_progress and save_listen_finished were one-line wrappers over
save_listen_state (queued by the lib-agents batch). The desktop's player
subscription now maps its two events to a ListenState and makes one save,
the FFI's two methods (unchanged for Kotlin) build the state themselves, and
the wrappers go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:02 -07:00
Greg ShuflinandClaude Opus 5.5 a000dbebd3 copy: the desktop's "P2P not running" lives in copy::p2p
It is the failure text a network action's row shows, so it belongs in
copy.rs with the rest of the user-visible words (queued by G1, which
gathered its twelve literals into network_task.rs). Wording unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:02 -07:00
Greg ShuflinandClaude Opus 5.5 78dc8d5b8f rust: the last blob-load triplets use blob_document's helpers
ffi/documents, ffi/podcasts, ffi/music and agents/podcast each spelled out
blob_store.load(hash, plaintext_hash, vault_id) or the PrimaryContent
get_blob_ref batch; they now call agents::blob_document::{load_blob,
primary_blob_ref} (queued from the lib-agents batch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:02 -07:00
Greg ShuflinandClaude Opus 5.5 aea0143f05 rust: materialize takes the Store
materialize() took four store references that every caller pulled out of
one Store (queued once the daemon batch landed); it now takes &Store. Its
primary-content read uses blob_document's primary_blob_ref and load_blob
instead of spelling out the triplet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:02 -07:00
Greg ShuflinandClaude Opus 5.5 98582f3942 ffi: a malformed DocumentID or Timestamp from Kotlin lifts as InvalidInput
Their uniffi custom types failed with a bare anyhow error, which Kotlin sees
as SyncException.Internal ("report a bug"). They now fail with
SyncError::InvalidInput, as NodePubkey's already did; one test covers all
three types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:01 -07:00
Greg ShuflinandClaude Opus 5.5 28aa2bb686 rust: list_notebooks returns a named NotebookItem
NotebookManager::list_notebooks returned (DocumentID, String) tuples that the
FFI re-wrapped as its own NotebookItem and the daemon as NotebookRow. The lib
now defines NotebookItem (uniffi Record, serde) once; the FFI returns it
as is, the daemon's protocol carries it, and the desktop Notes screen reads
its fields by name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:01 -07:00
Greg ShuflinandClaude Opus 5.5 51e2966af4 rust: one library tree builder for pictures, video, music and comics
agents::library_tree reads a media library's folder tree — every leaf of
one type plus the containers above it — with DocumentStore::ancestors_of
(one recursive query), one bulk property read for every node's title and
extras, and one bulk availability read. The four builders each had their
own collect_ancestor_collections walk (a query per ancestor) and then two
queries per collection and one or two per leaf; they are now a map over the
shared nodes, and pictures/video/music share one collections-first sort.

Each library keeps its own default for a leaf the availability read has no
row for (pictures Local, video/music Unavailable) and comics keep rolling
availability up from their pages; see handoff notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:01 -07:00
Greg ShuflinandClaude Opus 5.5 89a655175d rust: importers take one ImportTarget, and the lib marks imports present
Every importer took (blob_store, doc_store, artifact_store, path, node,
parent, progress) — five clippy::too_many_arguments allows in comics alone,
and a table macro and a comic adapter that only forwarded the seven. They now
take ImportTarget { store, node, parent, progress } and the path; ImportFn is
fn(&ImportTarget, &Path), the directory walk's ImportOne closure receives the
target, and create_collection_node, import_blob_document and import_from_url
take it too. The cbz/cbr dispatch is comics::import_comic_file, which the
comic tree calls directly instead of looking itself up in the table.

SupportedFileType's functions are private behind import/import_directory,
which (like import_file and import_from_url) mark the new document present on
the importing node. Every frontend did that by hand after these calls
(gui import_job::mark_present and Documents, the daemon's mark_present,
Android's ImportBatch), so those copies go. Fixes: the desktop Comics folder
import (import_comic_tree) marked nothing present, and the desktop's and
Android's URL imports didn't either; both now do, as the daemon's did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 18:26:01 -07:00
Greg ShuflinandClaude Opus 5.5 689ad5b276 rust: one reading module for PDF and comics reading page and bookmarks
agents::reading holds the reading page, PageBookmark (a uniffi Record with
label: Option<String>), list/add/delete bookmark and DeleteBookmarkError.
agents/pdf.rs and agents/comics.rs each had a byte-for-byte copy, and
ffi/pdf.rs re-implemented all of it inline (looking the node key up by hand
three times); ffi/comics.rs copied PDF's get_reading_progress. Both FFI
objects now delegate in one line, BookmarkInfo (which turned a missing label
into "") is gone, and Kotlin reads the label as nullable.

Behavior: list_bookmarks and reading_page now return their store errors
(the desktop keeps its old default of empty / page 0); the listing is sorted
by (page, id) everywhere; ComicsFfi::add_bookmark takes an optional label and
returns the new id like PdfFfi's. ComicMetadata::info_rows and the
comic_info_rows export had no caller anywhere and are deleted, so the PDF's
info rows stay where they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:36:06 -07:00
Greg ShuflinandClaude Opus 5.5 adab0c1ffd gui: TextInput builds its text runs with the multiline element's builder
TextInput split its line into three runs by hand to underline an IME
composition — what multiline_text_element::build_content_runs already does
(audit C3.2). It now calls that with no selection, since a single-line field
paints its selection as a quad; the runs, and so the field, are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 9b3c698a0f gui: import gpui types in components, settings and the top level
About forty gpui::Type paths in code (not doc comments) across twenty files in
this batch's scope, and crate::sizing::scaled in three, are now imported
names, per the Code Style rule against fully-qualified type paths. Mechanical;
text_editing's macro keeps its $crate/gpui paths on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 3f5d33f113 gui: resizable dividers drag through gpui's drag; screens stop wiring it
Every screen with a resizable sidebar (Notes twice, PDF, Pictures) had to wrap
its root in resizable::on_drag, which hung mouse-move/up/up-out handlers and
the resize cursor on the whole screen while a drag was in flight, so the drag
kept tracking once the pointer left the thin strip (audit M12). The divider
now does that itself: gpui's on_drag/on_drag_move follows the pointer
window-wide and keeps the strip's cursor, and its own mouse-up and
mouse-up-out end the drag. resizable::on_drag and its four call sites go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 7b3c0e6475 gui: the scrubber and speed slider are one slider, dragged through gpui's drag
render_scrubber and render_speed_slider drew the same groove, fill and ringed
thumb and did the same ratio-from-cursor math (seek_to_cursor,
drag_speed_slider) (audit M1). They are one slider() with its proportions in
a SliderLook, ratio_at, and an on_slide that sets the value on a press and on
every move of a drag begun there. The drag now goes through gpui's
on_drag/on_drag_move, which follows the pointer window-wide, so a scrub or a
speed drag no longer stops dead when the pointer leaves the 24px strip (B6).
The speed thumb sits half a pixel higher, now centered on its groove.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 92dac4bb67 gui: the player thumbnail builds one img for either kind of art
TrackArt::Url and ::Decoded built the same cover element twice; they map to
an ImageSource first (audit M9).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 511a9648dd gui: remote_fetch's tone is one function, and callers use the copy constants
The wedged/failed/ordinary color match was written in both remote_fetch_note
and remote_fetch_line; it is tone(). cancel_label()/try_again_label() only
wrapped content_fetch::CANCEL/TRY_AGAIN, which Comics, Pictures and PDF now
name directly, and remote_fetch_note is private — only the overlay calls it
(audit M8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 3b5da91131 gui: ZoomableImage's small redundancies
set_content is replace_bitmap plus a scroll reset; pan_by only forwarded to
scroll_by (pan_for_key now calls scroll_by, which takes the doc); the two
scrollbar blocks are one loop over the axes; and render_content takes the
image rather than an ImageSource the Render impl built for it (audit M7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 8568fac23e gui: TextInput and TextArea share their field chrome
Both text widgets set the same field background, border, focus/invalid
border color and rounding (audit C3.3); text_editing::field_chrome is that
box once. TextArea passes invalid=false, so it draws exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 d7aef8f9d5 gui: the last work-then-apply spawns in settings and teardown use spawn_then
Revocation import, the System tab's public-key load and the teardown wipe
each spelled out cx.spawn + background_spawn + this.update + notify, the
shape G1's background::spawn_then already names (left for this batch in the
G1 handoff).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 374876908a gui: one eviction dialog and one checked execute for Delete Locally and Reclaim
The document detail screen's "Delete Locally" and Settings' "Reclaim…"
drew the same evidence dialog (verified / unverified / shared lines, Cancel,
the override-gated "… anyway", the confirm) and ran the same execute step
that re-reads the unverified-deletion override before honoring "anyway"
(audit S2). Both are now components::eviction_dialog: eviction_dialog() takes
the words that differ and the view's cancel/confirm, and execute() is the
checked run. Reclaim's dialog reads the override from the Settings view's own
field instead of a SQLite read on every frame. Words and layout unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 17346b270d gui: one ActionOutcome for every control's last-action line
Documents' AsyncActionState, Ensemble's ActionState and Settings'
RunNowState and RemoteTriggerState were four spellings of Idle / Pending /
succeeded-with-a-sentence / failed-with-a-sentence (audit S3). They are
job_binding::ActionOutcome — the half of a control's state the module doc
already said a job can't carry — with from_result for the "Ok → Done, Err →
Failed" match each result handler wrote, and is_pending. Settings' two
status-line matches are one widgets::outcome_line. Each screen keeps its own
colors and rendering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 67e3f30e8a gui: the Sync tab's local and remote policy tables share their rows
render_local_sync_policy and render_remote_sync_policy built the same
SyncPolicyControl per content-bearing type, differing only in where the
policy and ledger came from and whether Reclaim is offered (audit S7); both
now go through policy_rows. set_scheduler_enabled and set_scheduler_interval
were one persist-log-notify body (S12) and are one set_scheduler; the content
ledger reload is spawn_then, and sync.rs no longer spells out
std::sync::Arc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 77f8fcbf92 gui: Ensemble reads the display timezone from the app global
The roster load and a member's Sync both re-read the settings row from SQLite
for the timezone the app already holds as a gpui global (audit S10); they now
take cx.timezone() when the work is started. Same zone either way (Settings
writes both), minus a store read per load and per sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 c38b91ba31 gui: Ensemble's retire and reset confirmations are one dialog
render_retire_dialog and render_reset_dialog were one dialog written twice
behind two bools (audit S6): same modal, title, two notes, Cancel and a danger
button. They are one ending_confirm: Option<Ending> and one
render_ending_dialog that picks its four copy constants by Ending; the words
are unchanged. The self-revoked banner and the load-error box share the red
error_card they both drew by hand (S13).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 48b7920ffe gui: agent screens are built from one AppServices bundle
SynchronicityView::new passed the same store, node, node runtime, tokio
handle and job runner (plus the media session or nav status for some) to
eleven agent constructors, five to seven loose arguments each in whichever
order that screen listed them, and cloned store/node_runtime/rt aside first
so it could keep its own after the last move (audit T2). Each of those
screens now takes (&AppServices, &sidebar, cx) and destructures what it uses;
app.rs builds the bundle once. Constructors only — no screen's behavior
changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 8f64e58f4c gui: NodeRef and DocumentRef are one IdentityRef, its id a HashChip
node_ref.rs and document_ref.rs were one component written twice (audit C6):
identical render bodies around node_display::resolve and
document_display::resolve, each with a TODO for the copy-to-clipboard HashChip
already does. IdentityRef::node/document resolve the name and render it
beside a HashChip, so the Jobs screen's peer and document ids are now the
app's standard bordered chip (full id on hover, click copies) instead of dim
mono text with a whole-row tooltip — a visible change, on that screen only.

hash_chip()'s wrapper (an unused theme argument around HashChip::new and an
optional prefix) is gone for HashChip::new(..).prefix(..) at its twelve call
sites, and availability.rs's label() forwarder for DocumentAvailability::label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 85c735d541 gui: window-geometry saves debounce by replacing a Task; one popout::open
Root and PopoutWindow each kept a bounds_save_generation counter, bumped it on
every bounds change, and had the delayed save compare it afterwards — hand-
emulated cancellation (audit T3). They now hold the pending save as a Task and
replace it; debounce_geometry_save returns that task, and the SQLite write it
runs has moved off the UI thread onto the background executor.

popout::open and open_at differed only in where the window went (T4): there
is one open(.., WindowBounds, ..) plus cascade_bounds, and app.rs's pop_out
and restore_popouts share one open_popout for "open, record, watch for close".
popout.rs no longer spells out crate::root:: paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 1968d09ac0 gui: no unwrap or expect left in gui-app's top level
main's tokio runtime build is a ? (main returns io::Result), the quit
shutdown handle's mutex tolerates poisoning, and a reqwest client that can't
build (only if TLS won't initialize) is logged and leaves gpui's default HTTP
client in place — remote cover art won't load — instead of panicking at
startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 8cacdbe922 gui: the player's ticker runs only while something plays; transport resets are helpers
Every PlayerControls — one per media screen — woke every 200ms for the life
of the app, playing or not (audit B7). The ticker now starts with playback
(play, restart, resume) and ends at the first tick that finds the bar paused
or stopped.

The transport reset was written out by hand five times (M4): play repeated
replace's load line for line, the Preempted handler repeated stop, and the
ticker's two end-of-track branches were identical. They are load_track, halt
and finish_track; emit_position still flushes before any reset. The custom
speed dialog's three fields (open flag, value before, live value) are one
Option<SpeedDialog> (M6), and the fifteen audio.lock().unwrap() calls go
through a lock helper that tolerates a poisoned mutex (M10).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 b0975bcde0 copy: one hours-aware playback clock, copy::clock
The M:SS / H:MM:SS formatter was written in the player (format_time), in
lib's music track list, and reached by video through the player; the listen
progress line in copy::artifact_value::summary had its own M:SS with no hours
field, so a 90-minute position read "In progress: 90:00" (audit M3). All now
use copy::clock(total_secs); each caller keeps its own rounding (a track
length rounds, a playback position truncates).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 0d45f062c8 gui: syntax highlighting is one language table, built per language and cached
syntax_highlight registered its 21 languages with 21 near-identical calls
(audit M5); they are one LANGUAGES table of aliases, grammar and queries (the
TypeScript-over-JavaScript and C++-over-C query deltas are just two queries in
a list).

Bug (B5): the first code fence in any language compiled every grammar's
queries on the UI thread, and every code block was re-parsed on every render —
every keystroke in Split mode. Each language's configuration is now built the
first time a fence in it is highlighted, and highlight() remembers the spans
for recent (language, code) pairs, so re-rendering an unchanged block is a hash
lookup. Highlight output is unchanged; it hands back shared spans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 fc0e4767fe gui: one RGBA-to-RenderImage conversion, and formulas keep their image
render_image::rgba_to_render_image, thumbnails::to_render_image and the PDF
viewer's to_render_image were three BGRA swaps (audit M2). render_image.rs now
has the one to_render_image(RgbaImage) and a from_rgba(buf, w, h) that returns
None instead of panicking when a buffer doesn't match its size; the PDF page
and thumbnail paths and the typst preview go through them (a mismatched page
bitmap is logged and the previous page stays up), and Notes' image embed
converts its decoded RgbaImage directly.

Every formula in a note preview built a new RenderImage from a clone of its
RGBA bitmap on every frame — a new image id each time, so every formula on
screen was re-uploaded to the GPU atlas per repaint (B4). markup_view keeps
one image per cached MathRender (keyed by the Arc, pruned when the math cache
drops it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 aa8560bb6e gui: the zoom control's scale group fills with accent_fill under its text
In explicit-zoom mode the −/percentage/+ group sat on theme.accent with
text_on_accent over it; theme.rs reserves accent for marks and requires
accent_fill under any text (white doesn't reach AA on the brighter one), which
is what the Fit segment beside it already uses (audit B3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 cb13c2568e gui: the Import… pickers don't block the UI thread
import_trigger opened rfd's synchronous FileDialog inside a menu item's click
handler, so the window stopped repainting and taking sync arrivals for as long
as the native dialog was open (audit C10, an instant-feedback violation). It
now awaits rfd::AsyncFileDialog in a window task and hands the picked paths
to the same callbacks, as Notes' Export to PDF already does. Filters and titles
are unchanged; this was the last synchronous file dialog in gui-app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 c7e8739eca gui: tree indents, the indeterminate bar and the player thumbs follow UI zoom
Three raw px() in render code measured against rem-sized neighbors, so each
was right only at 100% zoom: the notes/pictures tree's row indent
(pl(px(8 + 16n)), written twice; audit C8), the indeterminate progress bar's
slide (left(px) against a scaled() width; B1), and the scrubber and speed
thumbs' centering offsets (B2 — the speed thumb's -7px was also half a pixel
short of its 15px icon::SM). The indent is now INDENT_BASE/INDENT_STEP in
scaled() via one row_frame shared by the editing and normal rows; the others
are scaled() or derived from the thumb's own size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 e37a4b9063 gui: one hairline, and every rule is flex_none
The one-pixel divider was spelled out by hand at a dozen sites, half without
flex_none — and in a squeezed flex_col a 1px child that may shrink collapses to
0 and the rule vanishes (audit C7). reader::hairline moves to
section::hairline and is used for the rail's two rules, markup headings and
thematic breaks, the Pictures sidebar, the document list header, the document
detail's section divider and the popup menu separator. The collapsed rail's
inset rule keeps its margins and gains flex_none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 3dfea0f9e9 gui: a focused text field redraws per caret blink, not every frame
TextInput's and MultilineTextElement's paint called request_animation_frame on
every paint while focused, so a focused field kept its window redrawing at the
display's refresh rate for as long as it held focus, to animate a 500ms blink
(audit C3.4). text_editing::paint_caret now paints the caret and schedules one
timer for the next toggle; EditableText::claim_next_blink hands each toggle out
once, so a paint for another reason doesn't start a second timer and a
keystroke (which restarts the phase) starts a fresh one. The blink phases
themselves are unchanged. The 2px caret width is one CARET_WIDTH.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 1734bd9cb2 gui: MultilineTextElement reads its widget through MultilineEditing
MultilineTextHost's only implementor was a blanket impl over MultilineEditing,
so the element now takes H: MultilineEditing directly and reads buffer(),
placeholder() and height(); it also stops taking a focus handle its widget
already owns. The measured-layout .expect in prepaint is a let-else that
paints nothing, and the module doc no longer claims gpui's
index_for_position is private — it is public now, but panics before layout,
which is why ours stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:31 -07:00
Greg ShuflinandClaude Opus 5.5 cd22eb1315 gui: one suggestion list for Combobox, TagInput and the palette; lib fuzzy::rank
Combobox, TagInput and CommandPalette each declared their own SelectNext/
SelectPrev actions and up/down bindings, their own wrapping select_next/
select_prev, the clamp-the-highlight block and (the two dropdowns) the same
panel and row styling. components/suggestions.rs now holds the actions,
bind_keys(context), a Highlight, a Suggesting trait with one step() and
navigate() wiring, and panel()/row(). The frizbee config with its typo cap
(written in Combobox, TagInput and lib's find_human_by_name) is lib
synchronicity::fuzzy::rank; gui-app drops its direct frizbee dependency.

Bugs (audit C2): TagInput's dropdown was an in-flow absolute child at a magic
40px offset, so it was clipped by and painted under later siblings; it now
floats like Combobox's does. TagInput's focus handle was never tracked, so
focusing it did nothing; it now hands out its field's handle, as Combobox does.

The "capture the control's bounds, float the popup below it" code the
dropdown menu and Combobox each wrote (audit C9) is components/anchor.rs:
anchored_to (below, or above for TagInput's open_upward) and
track_first_child.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 16:12:30 -07:00
Greg ShuflinandClaude Opus 5.5 9202aae376 gui: right-click menus take focus; one AnchoredMenu, and the dead menu API goes
The rail's and the notes tree's right-click menus were never focused, so
Up/Down/Enter/Escape did nothing in them (audit C1). A PopupMenu now focuses
itself on its first paint — in whichever window paints it, which also covers a
popped-out Notes — and gives focus back on dismiss unless the chosen item moved
it on purpose (Rename's inline editor, a dialog field).

app.rs and notes each hand-rolled the same "record the right-click, build the
menu on the next paint, subscribe to DismissEvent, float it" state machine
(three fields, four methods each); both are now an AnchoredMenu in menu/mod.rs.
Since building no longer needs a Window, PopupMenu::build and the dropdown
builder take just the menu.

Deleted as unused: context_menu.rs (ContextMenuExt was never called), the
action-dispatching half of PopupMenu (menu, menu_with_*, action_context,
PopupMenuItem::action/icon/label, the Label variant, max_w, is_empty) and the
module-wide allow(dead_code) that hid it. The goal of mirroring upstream
gpui-component's API is dropped: it is built on Zed's gpui, not gpui-ce.
DropdownMenuState's close reset is one method.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 15:11:25 -07:00
Greg ShuflinandClaude Opus 5.5 b8fed7d593 gui: Ensemble's "Sync both ways" re-enables after a sync it didn't start
load.rs seeded a row's sync state as Pending when a CatalogSync for that peer
was running at load time, and carry_over_actions carried that Pending across
every later refresh; only this screen's own click ever resolves it, so after a
scheduler-started sync the button stayed disabled for good (audit S1a). Rows
now load Idle — the button already asks ActiveJobs about the job itself.
reload and refresh share one load helper over spawn_then, and the job watch is
ActiveJobs::watch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 15:08:04 -07:00
Greg ShuflinandClaude Opus 5.5 86b4e0314e gui: Settings' Credentials buttons enable when they should, and disabled Settings buttons are inert
Credentials' Save passed `!has_input` as its enabled flag, so it greyed out
exactly when there was something to save; Clear, its confirm and Cancel
passed `false`, so they always drew disabled (audit S1b). The clicks still
fired because a disabled button only restyled. Every Settings button whose
enabled flag is computed now attaches its handler with on_click_if, so the
node-name Save, Sync now, Run now, the revoke dialog and a member row's
Ping/Sync both ways commit nothing while drawn disabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 15:07:14 -07:00
Greg ShuflinandClaude Opus 5.5 0c79c28e9f gui: Humans opens and closes its create dialog through one method
The header's and the empty state's "Add" buttons each cleared the name field
and opened the dialog inline, and the backdrop and Cancel each closed it
inline; set_create_open does both. Same behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 15:00:00 -07:00
Greg ShuflinandClaude Opus 5.5 7983eb85be gui: SyncGuarded::current_mut, and one queue edit path
The podcast list's four optimistic row edits each cloned the whole episode
list to change one row and set it back; SyncGuarded::current_mut edits in
place (set_current was already a plain assignment). The queue's move up, move
down and remove were three copies of guard / optimistic local change /
background write / log; PodcastQueueView::edit is that sequence once. Same
behavior and log lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:59:30 -07:00
Greg ShuflinandClaude Opus 5.5 3fcac3eaa2 gui: one "is the bar holding this episode?" rule, and one Play control
The podcast list, episode screen and queue each tested id match plus
has_audio_session against the transport bar (with the same comment about
set_pending), and the episode screen and queue each mapped the answer to
Play/Pause/Resume. PlayerControls::holding and
podcasts::episode_actions::play_control hold those once. Same labels, same
behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:58:17 -07:00
Greg ShuflinandClaude Opus 5.5 65bb9fc032 gui: the podcast screen's Subscribe control is search's subscribe_button
detail.rs wrote out the same Subscribe / Subscribing… / Subscribed ✓
tri-state and sizing as search.rs's subscribe_button; it now uses it.
Render-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:57:30 -07:00
Greg ShuflinandClaude Opus 5.5 dcff113661 gui: held-change Show buttons and the properties Edit use copy::action
Documents' and the podcast episode list's held-change strips spelled "Show"
and the document detail's properties control spelled "Edit" where
copy::action::SHOW and ::EDIT exist for exactly these (the former's doc names
every changed-elsewhere marker). Same words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:56:15 -07:00
Greg ShuflinandClaude Opus 5.5 9854ba295f gui: one header_search_field for Notes and Documents
Both screens framed their bare search input in header_search and showed
header_search_clear while it held a query, identically apart from the id and
what clearing does. components::screen_header::header_search_field is that
field once. Render-identical. The PDF library's header search has no clear
button, so it keeps its own frame (a decision, see handoff).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:55:09 -07:00
Greg ShuflinandClaude Opus 5.5 82d129f9a6 gui: Notes forgets the open body through one helper
Three places (the open note vanishing from the tree, selecting another note,
switching notebook) each stopped the body watch, dropped the stored baseline
and any held incoming body, and republished the rail slot, four lines apiece.
forget_open_body does it once. Same behavior; Notes' hand-rolled guard is
otherwise left as is (see handoff on SyncGuarded adoption).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:54:24 -07:00
Greg ShuflinandClaude Opus 5.5 e9596366ec gui: MediaLibrary::new takes its tabs
Each of the four library screens constructed a MediaLibrary with an empty
message for a placeholder "library" tab, then immediately replaced the tabs
(repeating that message). new() now takes the tab list; the placeholder tab
and its DEFAULT_TAB_ID are gone. The first tab is active, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:53:31 -07:00
Greg ShuflinandClaude Opus 5.5 4ccee0c0b6 gui: MediaItem carries its DocumentID; drop the always-true activatable
Every MediaLibrary consumer built items with `activatable: true` and an id
stringified from a DocumentID, then parsed ItemActivated's string back into a
DocumentID. MediaItem::id and ItemActivated are DocumentIDs now, and the
activatable knob (true at all six construction sites) is gone, its rationale
folded into availability's doc. Render-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:52:19 -07:00
Greg ShuflinandClaude Opus 5.5 190af3cc91 gui: disabled buttons are inert — OnClickIf::on_click_if
button()'s doc asks every caller to gate its click handler on the same
`enabled` it drew with, since the disabled look alone does not stop a click.
Some callers did (`let mut btn … if enabled { btn = btn.on_click(…) }`, and
the podcast queue's own gated_button); most did not. on_click_if(enabled, …)
is that gate as one call, used at every agent button that draws a disabled
state.

Bug fix: disabled buttons that still fired now don't — most visibly the
podcast episode list's "Loading…" (Refresh) button, which restarted the
fetch it said was running; also PDF/Pictures/Comics prev/next at the ends,
Pictures' rotate with no image, Humans' Save with nothing changed, and the
document detail's busy Sync/Pull/Push/Purge/Delete-locally controls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:50:46 -07:00
Greg ShuflinandClaude Opus 5.5 38bdb65bef gui: TextInput/TextArea::with_content for fields seeded as they are made
Humans, Notes' dialog and the document detail's property editor each built a
field with new, then set_content on a mutable binding. A with_content
builder does that in the chain; the property editor's five typed branches
become one local constructor. Humans' seeded fields drop their empty-string
guard, since setting empty content is a no-op on a new field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:48:34 -07:00
Greg ShuflinandClaude Opus 5.5 6dc622bcec gui: Pictures and QR convert bitmaps through thumbnails::to_render_image
Both re-implemented the RGBA-to-BGRA swap and RenderImage build that
thumbnails::to_render_image already does. Render-identical. (QR decoding via
gpui::Image::from_bytes was not adopted: gpui loads that source
asynchronously and caches every image, so the preview would blank for a
frame per keystroke — see handoff.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:47:33 -07:00
Greg ShuflinandClaude Opus 5.5 003b1a9245 gui: one error_line for errors said under their control; one set_field_error on Humans
The small error-colored sentence under a field or control was spelled out in
Humans (5x), Podcasts (2x), Clippings (2x) and the document detail; it is
components::note::error_line now. Humans' four identical set_*_error methods
(mark the input invalid, set the sentence under it) become one
set_field_error over a FormField enum, and labeled_field_with_error builds its
label with field_label like its siblings. Render-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:46:30 -07:00
Greg ShuflinandClaude Opus 5.5 85e82b592f gui: one dismissible error box for Documents and Notes
Documents' error_banner and Notes' render_error were the same bordered error
sentence with a ✕ (Notes floats it at the bottom over a window-colored
ground). components::note::dismissible_error is that box once; each screen
keeps its own placement. Render-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:43:59 -07:00
Greg ShuflinandClaude Opus 5.5 857e20dbee gui: podcast screens share one card and one description block
The bordered card (p_4, card background and border, CARD radius) was spelled
out seven times across the podcast screens, and the "Description" heading
over a card twice (detail and episode). podcasts::card and
podcasts::description_block hold them once. Render-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:42:50 -07:00
Greg ShuflinandClaude Opus 5.5 aa0ef6035e gui: Humans' circle tabs are tab_bar and tab_pill
render_circle_tabs/render_circle_tab re-implemented components::tabs line for
line apart from the bar's height (control::ROW_XL) and padding (px_4); it now
uses tab_pill and tab_bar with those two overridden. Render-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:40:58 -07:00
Greg ShuflinandClaude Opus 5.5 6064020390 gui: shared reader chrome for Comics, PDF and Pictures
The three readers each built the same toolbar strip, fixed and flexible
toolbar groups, page-counter caption, "Zoom:" group, hairline, media canvas
and absolutely-positioned zoom layer, and Comics and PDF each declared
PAN_STEP and matched up/k/down/j by hand. These now come from
components::reader and ZoomableImage::pan_for_key. Render-identical; the PDF
toolbar keeps its zoom controls without the "Zoom:" label the other two have
(left as a decision, see handoff). The library's two hairlines use the same
helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:40:11 -07:00
Greg ShuflinandClaude Opus 5.5 06841fd720 copy: the podcast episode list's held-change sentence lives in copy.rs
detail.rs wrote "N new episodes." / "Episodes changed elsewhere." on the
screen; it is now copy::podcast_episodes::held, worded exactly as before.
Android's strip still says only "Episodes changed elsewhere." (the zero
case) — whether it should count too is left as a decision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:29:02 -07:00
Greg ShuflinandClaude Opus 5.5 e8a7b566f1 gui: one incoming-change banner component for Notes and the podcast queue
notes' render_incoming_body_banner and the queue's render_incoming_banner were
the same strip (icon, copy::incoming_change sentence, take/keep buttons) with
different ids and handlers. components::incoming_banner is that strip once —
the desktop counterpart of Android's ui/IncomingBodyStrip. Render-identical.
Clippings keeps its in-card column variant (a layout decision, see handoff).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:28:09 -07:00
Greg ShuflinandClaude Opus 5.5 11eeca1334 gui: one import pipeline for the five library screens
Comics, Music, PDF, Pictures and Video each wrote an import-files and an
import-folder method (ten ~50-line copies of start job, walk, filter, import,
mark present, finish, report first error, re-read). They now implement
import_job::ImportHost (their file type, their fields, what re-reading means)
and call import_job::import_files/import_folder, which import through the
lib's SUPPORTED_FILE_TYPES table — so comics stops re-implementing the lib's
cbr/cbz dispatch. Comics' folder import keeps import_comic_tree, through the
shared import_job::run.

Small behavior fixes: Comics and Video now tick progress past a skipped file
the way the others did (the job's total counts every picked path, so its bar
could stop short of the end); Music clears its artist-mosaic cache after a
folder import too, not only after a files import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:15:52 -07:00
Greg ShuflinandClaude Opus 5.5 0b3a54d7e7 gui: podcast episode actions shared by the list's cards and the episode screen
Save (as a tracked job), remove, queue, and the Save/Saving/Remove and
Queued/Add control states were written out twice, in podcasts/detail.rs and
podcasts/episode.rs; they now live once in podcasts/episode_actions.rs, each
screen keeping only its own optimistic bookkeeping. EpisodeMeta carries the
list's EpisodeRow instead of restating eleven of its fields, so
to_new_episode exists once, and the episode screen's own saving flag is the
row's.

Bug fix: a refused second save on the episode screen said the raw lowercase
clause ("a save of that episode is already running"); it now shows the same
sentence the list does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:13:17 -07:00
Greg ShuflinandClaude Opus 5.5 c3ff6e861c gui: Notes' persist and manager helpers
Five best-effort preference writes (active notebook/note, view mode, math
dialect, split fraction) were each a ten-line clone-spawn-build-log block;
NotesView::persist(what, write) is that block once, with the same log
lines. manager(store, node) replaces the twelve spelled-out
NotebookManager::new(&store.doc_store, &store.artifact_store, node) (audit
N1, the part spawn_then didn't already cover).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 ba06b32802 gui: give each Documents spinner its own element id
import_spinner handed every spinner on the Documents screens the id
"docs-import-spinner" — the load-more row, each Placement row's override
and job line, each Artifacts row's job line and the Danger zone's — so any two
on screen together shared one animation state (audit bug 15/D22). The
misnamed wrapper is gone; each call names its own id (keyed by row where
there are rows).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 d7599670df gui: Documents sizes use copy::format_bytes
The Documents screens had their own format_bytes in SI units (1000) with no
GB tier, so the same file showed a different size here than in the TUI and
on Android, which use the lib's copy::format_bytes (1024, with GB) (audit
bug 10). The local copy is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 21fe15c97a gui: no expect/unwrap left in agents' non-test code
render_detail and Notes' render_dialog take the Detail/Dialog their caller
already matched instead of expect()ing it back out; Humans' save returns if
the detail is gone rather than expecting it; the PDF thumbnail skips a
bitmap whose buffer doesn't match its size instead of panicking; the math
cache capacity is a NonZeroUsize const checked at compile time; Music's
player and the PDF viewer's loaded-document cell recover a poisoned lock
(audit bug 17).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 b141e6da61 gui: put misplaced doc comments back on their items
Comics, PDF, Music, Notes and Humans each had doc comments that had slid onto
the wrong item (a glyph's doc above a tab id, an import doc above the library
build, three orphaned helper docs stacked on Humans' today()) or described
constants that no longer exist; each is moved to its item or deleted (audit
bug 19). The PDF viewer's own THUMB_MAX_EDGE was a copy of
thumbnails::THUMB_MAX_EDGE (same 480) and now uses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 3ed9c4093c gui: drop an orphaned doc comment spliced onto row_sizes
Two doc comments had run together above documents::row_sizes: its own, and
one for a per-row "all blob-backed content here" function that no longer
exists (the column reads lib content_ledger::subtree_content now, which
documents itself). Queued from the lib-stores batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 5765a63d05 gui: SettingsStore::membership() at the five one-read sites
Documents detail (purge broadcast, ensemble_peer_ids, placement rows) and
Settings (remote peer list, ensemble load) spelled out
settings_store.batch(|tx| settings_store.load_ensemble_membership(tx)); the
lib now has that as membership() (queued from the lib-p2p batch). The
presence survey's read stays as it was: it shares its transaction with the
node-name read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 8332005101 gui: Follow policy and the PDF no-match sentence come from copy.rs
The Placement picker's "Follow policy" is copy::sync_override::FOLLOW_POLICY
and the PDF library's "No PDFs match “q”" is copy::library_empty::no_match,
which Android already uses (both queued from the FFI batch). Same words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 758f437585 gui: Documents date filter comes from copy::date_filter
DATE_FILTERS/DateFilter restated the lib's copy::date_filter::OPTIONS (the
keys the search query takes and their labels), and "Any Date" was typed
twice in list_view; all three now read the lib's (queued from the FFI
batch). Same keys, same words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 94008126f9 gui: copy::busy::sentence in place of byte-slice capitalizing
import_job's already_running and podcasts' busy_saving capitalized a busy
clause with clause[..1].to_uppercase(), which panics on a multibyte first
letter; the lib's busy::sentence does it by char (queued from the FFI batch).
Both one-use wrappers are inlined into their only call site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 88300275cd gui: network_task::on_endpoint(_as_job) for the endpoint → run_msg → apply shape
Five documents-detail actions (pull, per-artifact pull, push, remote
override, delete-locally evaluation) and six settings ones (ping, peer sync,
reclaim evaluation, remote sync config read/write, Run now) each read the
endpoint, cloned the runtime, spawned, mapped a missing node to "P2P not
running", awaited run_msg, and applied the result; the tracked ones also
wrapped the job handle in an Arc to report progress and finish it. The two
helpers do that once (the job is finished whether or not the view is still
there), with the sentence as network_task::P2P_NOT_RUNNING until copy.rs
takes it (audit D2/X3). Also moves push_document's doc comment back onto it
from row_job_control.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 8ab6b78d08 gui: scheduler driver runs synchronicity::scheduler::tick
The loop body (read settings, run every pass when enabled, log the outcome,
clamp the interval) is the lib's scheduler::tick now, which the daemon
already uses; MIN_INTERVAL goes for scheduler::MIN_TICK_INTERVAL (queued F14
from the frontends batch). Log sentences are identical. The per-tick
set_job_runner and the startup wait stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 e610f1f06c gui: NodeSlot for the shared P2P node, in place of Arc<Mutex<Option<Arc<NodeRuntime>>>>
The type was spelled out 29 times and read through 29 .lock().unwrap()s (a
poison-panic each), 17 of them the same .as_ref().map(|rt| rt.p2p.endpoint()).
network_task::NodeSlot wraps the same cell with get/endpoint/set and recovers
a poisoned lock; the embedded daemon socket still gets the raw cell
(shared()), since syn-daemon reads it per request. A watch channel ticks on
every set, so the scheduler's startup wait is NodeSlot::ready under a timeout
instead of a sleep-poll loop (audit gui-core T1). Also drops the stale
"inferred iroh Endpoint, so this crate avoids a direct iroh dep" comments —
the type is the lib's EnsembleEndpoint — and moves comics' fetch_page_remote
doc back onto it from fetch_page_for_reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 71948f5db2 gui: hold Tasks instead of generation counters in podcasts and pomodoro
Podcast search (debounce + in-flight search), the podcast detail's episode
fetch, and Pomodoro's tick loop each bumped a u64 and had the stale task
check it before applying. Replacing a held Option<Task<()>> drops, and so
cancels, the task it supersedes, which is the same thing with less
bookkeeping (audit P8). Documents' page fetches keep their counter: load_more
shares it without superseding, which one Task slot can't express.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 8736a5c9ee gui: background::spawn_then for the work-then-apply shape in agents
About 50 agent call sites spelled out cx.spawn → background_spawn(work).await
→ this.update(apply; cx.notify()).ok(). background::spawn_then(cx, work,
apply) is that shape once; it returns the Task so the sites that hold one in
a field (search, episode fetch, typst compile) still can. Fire-and-forget
writes that only awaited a background task and never touched the view become
a bare cx.background_spawn(..).detach(). Converted mechanically (script),
only where the body was exactly that shape; apply now always repaints, which
at worst adds a harmless notify.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 0537c7525e gui: cx.background_spawn in place of cx.background_executor().spawn
gpui's AppContext::background_spawn (on Context and AsyncApp alike) is the
same call; podcasts already used it, the other 87 sites didn't. Mechanical,
across the crate (rustfmt had been splitting the long form over three
lines).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 ba825b2796 gui: document detail uses copy::artifact_value::summary
summarize_artifact_value was a near-verbatim copy of the lib's
copy::artifact_value::summary (queued F2 from the frontends batch), down to
the Gender words, plus an unreachable! for blob-backed kinds. The row now
calls the lib with the same 120-char middle cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 a09685a7b1 gui: PDF zoom re-render checks the document as well as the page
rerender_current_page applied its bitmap if the page index still matched,
so switching to another PDF at the same page while a re-render was in flight
painted the old document's page over the new one (audit bug 14).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 ba404c6111 gui: decode a comic's cover whenever its first page is here
load_thumbnails only decoded a leaf comic's cover when the comic was Local,
but a comic is Remote as soon as any one page is missing, so covers sitting
right here were withheld (audit bug 13). Android fixed the same thing
deliberately (ComicRepository.kt coverComicId); a first page that really is
absent just fails the load and leaves the placeholder, as collections already
did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 fb29f766eb gui: Jobs uses JobSubject::document()/peer() and copy::job_history_times
The screen spelled out JobSubject's variants twice (job_peer,
referenced_document_ids) and built "Started … · Finished …" by hand; the lib
now has those as JobSubject::document()/peer() and copy::job_history_times
(queued from the FFI batch). Also moves reload's doc comment back onto
reload — it had slid onto publish_nav_slot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 3b304c6b98 gui: Jobs history follows a timezone change immediately
JobsView kept its own copy of the timezone, read from the settings store on
each reload, so after a Settings change its history timestamps stayed in the
old zone until the next job event (audit bug 12). It now reads the display-tz
global (cx.timezone()) at render, like every other screen, which
timezone::set already repaints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 f05e3952c4 gui: show video durations past an hour as H:MM:SS
The Video library's format_duration wrote M:SS only, so a 83-minute clip read
"83:20" — the rendering player_controls' format_time already calls wrong
(audit bug 11). It now delegates to format_time (made pub), keeping its
round-to-nearest-second.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 25e8873757 gui: don't block the UI thread on Notes' Export to PDF file dialog
export_to_pdf opened a synchronous rfd::FileDialog inside the click handler,
so the window could neither repaint nor take sync arrivals while it was open
(audit bug 8, instant-feedback invariant). It now awaits rfd's
AsyncFileDialog (which runs the portal call on its own thread) from the spawned
task. components/import_trigger.rs has the same problem; it's the components
batch's (C10).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 5dbcd53167 gui: mark media-screen imports present on this node
The Documents screen and Android's import record each imported document as
present on the importing node; the Comics, Music, PDF, Pictures and Video
screens never did, so their imports didn't count toward this node's holdings
(e.g. the Ensemble screen's per-node document counts) (audit bug 6). The mark
moves to import_job::mark_present, used by Documents and by each media
screen's file and folder imports. A comic *folder* import (lib
import_comic_tree) is not covered — it returns no ids; queued for the lib batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 fa6fe10d8b gui: re-read Humans and Podcasts on arrival
Both screens follow the store only while on display (watch_on_screen), which
relies on arriving at a screen re-reading it, but neither did: a person or
subscription that synced while the screen was hidden stayed missing until the
next store event (audit bug 5). Humans now uses store_watch::follow; Podcasts
re-reads its showing tab on arrival, as switching to that tab does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 4a23c2142a gui: one store_watch::follow for re-read-on-arrival plus watch-on-screen
Comics, PDF, Pictures, Video, Music and Notes each paired a nav-sidebar
subscription (re-read on arrival) with a watch_on_screen call and the same
six-line "applied outright" comment. store_watch now has on_arrival and
follow (the two together), carrying that rationale once. Behavior is
unchanged, including that a rail click on a popped-out screen still re-reads
it (App::set_current_view deliberately doesn't for Documents/Jobs; see
handoff notes). Music keeps its focus hand-back as a second on_arrival.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:49 -07:00
Greg ShuflinandClaude Opus 5.5 f65b4d4a0f gui: don't seed an undated interaction's edit form with "date not synced"
InteractionRow stored its date as the display string, so editing an
interaction whose date hadn't synced copied "date not synced" into the When
field and Save always failed to parse it (audit bug 4). The row keeps the
Option<PartialDate>; the timeline renders the same sentence, and the edit form
starts empty instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:48 -07:00
Greg ShuflinandClaude Opus 5.5 158079c7a9 gui: fill the document detail's Created row
Detail.created_at was initialized empty and never set, so the Created row was
always blank (audit bug 3). The timestamp now comes from build_detail's
document read, next to Updated, formatted the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:48 -07:00
Greg ShuflinandClaude Opus 5.5 24ef3febf8 gui: clear the incoming-change banner when the open note disappears
When reload_tree found the open note gone it closed the editor but kept
incoming_body, stored_body, the watch task and the rail slot, so a dead banner
stayed up with buttons that did nothing and the rail kept saying "1 incoming"
(audit bug 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:48 -07:00
Greg ShuflinandClaude Opus 5.5 f1028905d0 gui: keep a stale note load out of the newly selected note
select_note applied its background load without checking that the note was
still the selected one. Click A then B, and if A's load finished last its body
showed under B's title and the next autosave wrote it into B. The apply now
returns early unless the note it loaded is still selected (audit bug 1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:36:48 -07:00
Greg ShuflinandClaude Opus 5.5 30fb1d6a4a rust: MusicTreeItem's doc no longer says the list is unsorted
build_music_nodes sorts it, collections first then by title (audit A-7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 4eed02cf37 rust: podcast downloads carry their errors typed, and record the copy in one transaction
PodcastError::Http(String) and Blob(String), and the seven
map_err(to_string)s that fed them, are #[from] reqwest::Error and
BlobStoreError; the release path's EvictionError gets its own Release
variant instead of being reported as 'failed to store'. The status check is
reqwest's error_for_status. save_episode_audio writes the PrimaryContent
artifact and the mark_present in one transaction instead of two (audit
P-9). A failed download's message now reads as reqwest words it
('HTTP status client error (404 Not Found) for url (...)') rather than
'404 Not Found for ...'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 3ade17ce73 rust: podcast listen state is saved through one save_listen_state
save_listen_progress and save_listen_finished were the same upsert with a
different ListenState; both delegate to save_listen_state now (audit P-10).
The two wrappers stay because gui-app calls them (queued for the GUI
batch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 63e9711aa7 rust: audio_player's tempo is an atomic, and its tests drive the real stretch stage
- The shared tempo was an Arc<Mutex<f64>> whose lock the cpal audio thread
  took (and .unwrap()ed) on every step; it is an AtomicU64 holding the
  f64's bits.
- StretchSource is generic over any rodio Source rather than a Decoder, so
  the tests run the real type over a SamplesBuffer instead of a test-only
  copy of its SoundTouch loop. The decoder pull is extend(take(want)).
- AudioError::Audio(String) and its map_err(to_string)s are #[from]
  variants for rodio's two errors (same message). reset_sink hands back the
  Output it reset, which removes the two .expect("sink opened above")s
  (audit P-7, B6).

Needs a manual check: music and podcast playback, including a speed change
mid-track.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 77dc8c443b rust: streaming's state lock tolerates poison, and its waits are wait_timeout_while
- Eleven .expect("streaming state poisoned")s — one on the audio thread's
  read path — are one Shared::state() that reads through a poisoned lock.
- The blocking read polled with a 20 ms sleep and the reconnect wait
  looped on wait_timeout; both are Condvar::wait_timeout_while with the
  stall deadline, woken by the notify_all the downloader already sends.
- download's five mark_failed exits are one: download_into_cache returns
  the failure's message and download records it. write_at's seek was
  redundant (the file is written sequentially from the window's start).
- State derives Default; resolve_seek_target uses saturating_add_signed
  (audit P-6).

Needs a manual check: remote music playback, including a seek past the
buffered window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 a7b72e2e7e rust: podcast_queue reads its entries through one helper
The list-filter-sort of the queue's entries was written four times
(list_queue, queued_episode_ids, add_to_queue, move_entry); it is
entries(). key_after(p) was key_between(p, None) and is gone (audit P-5).

Bug fix (audit B9): add_to_queue read the clock twice, so an entry's
added_at and its row's modified_at could disagree; it reads it once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 5d5f6035b0 copy: tests are rstest tables, and the indentation test can see what it hunts
- The display-resolve, job_activity, placement, clippings source-line and
  pending, and content_fetch display tests were repeated asserts; they are
  rstest cases (human_display::resolve, untested before, is a case now).
  Peer-health's skew()/ahead() share an issue() builder, and two caseless
  #[rstest]s are #[test] (audit C-2).
- no_copy_string_carries_a_run_of_spaces reset its in-string state at every
  line, so it could not see the slip it exists for: a string that spans
  source lines without a \ continuation, whose indentation lands at the
  start of a line the string did not start on. It is a small lexer now
  (strings, escapes and line continuations, comments, char literals), and
  was checked to fail on such a string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 a63af4c1a8 copy: one resolve_or for the three display resolvers, and tidier peer-health copy
- node_display/document_display/human_display::resolve differed only in the
  placeholder; they share a private resolve_or (audit C-6).
- peer_health::severity's two same-shape arms compute 'losing' and map it
  once; copy() no longer recomputes headline and detail to build one_line
  (C-8).
- content_fetch's module doc had landed on credentials.
- American spelling in doc comments (forever, capitalizations, parenthesize,
  spelled; music's 'anymore'). No user-visible string changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 2939004852 rust: CachedMathEngine renders through its MathRenderer impl only
The inherent render and the trait impl were two copies of one method, the
trait one delegating to the other; the body now lives in the trait impl
(audit Math-1). gui-app already imports MathRenderer where it calls it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 e80707e6bb rust: one typst compile path, and the dead custom-font path goes
- TypstWorld::new -> typst::compile -> comemo::evict -> map diagnostics was
  written three times (PDF export, preview, math); it is typst::compile
  now. compile_to_pdf's two identical map_err blocks are one closure, and
  compile_document no longer returns a world both callers discarded. The
  math engine's parse errors now carry typst's hints, which it used to drop
  (audit T-1).
- FONT_CACHE was an Arc<FontCache> around a FontStore; it is a plain
  static FontStore. The sources map was never written. The main Source is
  parsed once per world (Source::detached) instead of on every source()
  call, which also removes main_id()'s non-test .unwrap() (T-3).
- The custom-font path (compile_to_pdf_with_fonts, new_with_fonts,
  extra_fonts, merged_book, FontCache::infos, load_font_data) lost its only
  caller when the FFI batch removed the export; deleted with its two tests
  (T-2, lib side).
- Pixmap bytes are moved out (take) rather than copied (to_vec).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 17d89bf76c rust: comics names its (entry name, bytes) page pair
extract_cbz and extract_cbr_pages returned (Vec<(String, Vec<u8>)>,
ComicInfo), which clippy's type_complexity rejects; a Page alias names the
pair everywhere it is spelled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 1e0e873a40 rust: markup's parser pushes each block once and drains with next_if
- parse's nine Block literals are one: each arm yields its kind and end
  offset, and the loop pushes (audit M-1).
- Peek-then-next-then-unreachable!() drains are Peekable::next_if (and a
  concat_while helper), which also removes flatten_inline's non-test
  events.next().unwrap() (M-2).
- ParagraphContent was a subset of BlockKind; parse_paragraph returns
  BlockKind. Builder gains push_link (the enter/push/exit triple, three
  copies) and push_span (the merge, two copies) (M-3).
- parse's doc comment had landed on wikilink_targets.

Bug fix: heading anchors could collide. 'Foo', 'Foo', 'Foo 1' got foo,
foo-1, foo-1; the allocator now skips any anchor already taken (foo-1-1
for the third), as GitHub does. Test case added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 6693407360 rust: qrcode encodes through one helper
generate_qr_png and generate_qr_terminal each spelled out the encode and
its error mapping (audit H-12).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 0e8108777f rust: the Pomodoro phase words live in copy.rs
PomodoroPhase::label and completion_message were user-visible copy written
in the agent; they are copy::pomodoro::{phase, completed} now, and the two
methods (which gui-app and the FFI call) delegate. reset_phase was enter()
of the current phase (audit H-11). No wording changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 061c75417e rust: clippings reads a page of clippings in one transaction
clipping_from opened two connections per clipping and found the page
title by listing every fact; it now takes the caller's transaction and
reads the one fact by id (facts::get_fact). list_page and get read in one
transaction, and update writes body and title in one (audit H-10).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:31:29 -07:00
Greg ShuflinandClaude Opus 5.5 24ff913ee8 rust: fixtures for the repeated store-test setups
S4. facts.rs and contact.rs tests spelled out
store.artifact_store.batch(|tx| f(&store.artifact_store, tx, ..)).unwrap()
22 times; a local in_tx helper does it once, and contact's try_add takes a
label so the relabel and unnamed-protocol tests stop re-spelling the full
eight-argument add_contact_method. The document-store tests' 31 copies of
"Document::new; let id = doc.id.clone(); add_document(tx, doc)" become one
add(store, tx, type, parent) (make_note now goes through it), and
availability's two record-holder helpers take a ContentKey.

Deletes documents/document.rs's has_blob_content_matches_the_documented_set,
which restated the implementation's matches! list verbatim and so could not
fail independently of it; comic_and_podcast_feed_are_excluded stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:54 -07:00
Greg ShuflinandClaude Opus 5.5 4e8e2b153e rust: one set of search filters, one keyset cursor and one pager in document.rs
search_documents and search_document_items each built the same only_roots
/ document_types / date filter / hidden-provenance predicates; the keyset
predicate (created_at < ? OR (created_at = ? AND id < ?)) was written in
both search_document_items and list_children_page; and the "fetch one past
limit, truncate, derive the next cursor" step in both list_children_page
and search_document_items_page. They are now push_search_filters,
push_cursor and paginate (S17).

Also B2: ancestors_of's doc comment had been left sitting on
descendants_of, which then carried both.

Left alone on purpose: search_documents still filters titles in Rust (one
get_title per row) — the SQL LIKE the paged path uses folds case for ASCII
only, so moving it would change which non-ASCII titles match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:54 -07:00
Greg ShuflinandClaude Opus 5.5 5d9ff98cc6 rust: one tombstone_if_present for removals keyed by a derived id
remove_fact, remove_list_fact, remove_contact_method and the podcast
queue's remove_from_queue each spelled out "if get_artifact_by_id is None
return false, else tombstone_artifact(..., now, ...) and return true".
ArtifactStore::tombstone_if_present is that, once (S18). The derived-id
upserts already build through Artifact::with_id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:54 -07:00
Greg ShuflinandClaude Opus 5.5 d2bb2eeb79 rust: derive TextFormat's name and ChangeChannel's variant list with strum
TextFormat::as_str re-spelled the serde names by hand; it is now strum's
IntoStaticStr under the same snake_case rule, with a test pinning both
spellings. ChangeChannel::ALL was a hand-kept list of all five variants,
which strum's VariantArray gives as VARIANTS without the chance of a new
channel being left off it.

Skipped from S14 on purpose: ContactProtocol's slug (frozen into derived
ids) and ArtifactKind-from-ArtifactValue (renames stored strings). The
store-local enums were done with their stores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:54 -07:00
Greg ShuflinandClaude Opus 5.5 65ed79d55f rust: the store-lock registry recovers a poisoned mutex instead of panicking
B6: three HELD_LOCKS.lock().expect("store lock registry poisoned") calls
in non-test code, one of them in Drop. They go through held_locks(), which
recovers the guard (each access is a single get/insert/remove, so there is
nothing half-updated to protect), the way change_bus already does. The
lock-file holder reader duplicated in acquire and foreign_holder becomes
read_holder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:54 -07:00
Greg ShuflinandClaude Opus 5.5 52f16c5d28 rust: graph_copy reads each table's columns from the schema at copy time
GRAPH_TABLE_COLUMNS re-listed every column of nine tables, and a test
existed only to catch it drifting (provenance was once silently dropped
from reseeded stores that way). The copy now asks pragma_table_info for the
destination's columns and names them in both the INSERT and the SELECT, so
only the table list is kept and the drift test goes with the class of bug.

Store::db_path returns the PathBuf instead of a String built through
expect("store path is valid UTF-8"), and the ATTACH, which does need text,
reports a non-UTF-8 path as StoreError::NonUtf8Path rather than panicking
(B6, twice).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:54 -07:00
Greg ShuflinandClaude Opus 5.5 9d1bfe848f rust: put ImportCounts' message doc back on message, and fix ImportProgress's
B2: message()'s doc comment had been glued onto bytes_so_far, which then
carried both. B9: ImportProgress's doc said the blob store has "no chunk
hook, so a file contributes its whole size the moment it lands", which
StoreProgress/add_partial a few lines below contradict; it now says what
happens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:54 -07:00
Greg ShuflinandClaude Opus 5.5 1dc54b0467 rust: import_from_url writes in one transaction, with its docs where they belong
Fixes B8: the document and its properties committed in one transaction and
the PrimaryContent artifact in a second, so a failure between them left a
PDF/image/track document with no content pointer. Both stores share
store.db, so it is now one doc_store.batch (UrlImportError gains the
Busy/Db pair every store error has, for the transaction's own errors).

Fixes B2 here: import_from_url's doc comment had been spliced into
download_reporting's mid-sentence, leaving "to matter." as the whole doc
of import_from_url. Also drops the (Title, FileType) match whose
unreachable! arm was a non-test panic (B6), and the three copies of the
Http error closure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:54 -07:00
Greg ShuflinandClaude Opus 5.5 bf5c0e157c rust: the peer roster fails on a database error instead of coming back short
Fixes B7 for get_peer_nodes_for_ensemble: .flatten() over the mapped rows
skipped every Err, including real SQLite errors while stepping the query
(BUSY mid-iteration), and returned a silently short roster. The mapper now
turns only a row it cannot decode into a skip, as the comment intended, and
a stepping error propagates. (peer_health::all got the same fix earlier.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:54 -07:00
Greg ShuflinandClaude Opus 5.5 c6252478d3 rust: add_edge announces the document it bumps
Fixes B5: add_edge updated the from document's modified_at through
touch_document_in_tx without marking it touched, so an edge-only
transaction (a derived-graph rebuild) never published a DocumentEvent,
while remove_edge did. add_edge and write_property now go through
touch_document, and ArtifactStore's CRDT restamp reuses the same
touch_document_in_tx instead of its own copy of the UPDATE. A test pins
the announcement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:54 -07:00
Greg ShuflinandClaude Opus 5.5 a3ff3fc312 rust: write_property and sync_receive_property share their property SQL
Both carried the identical INSERT OR IGNORE (Immutable) and the identical
last-write-wins upsert; they are now insert_property_immutable and
upsert_property_lww, the latter returning whether the row changed.

Fixes B4: write_property appended the old value to property_history before
an upsert whose WHERE excluded.modified_at > properties.modified_at could
reject the write (an older stamp, a clock stepped back), leaving a history
row duplicating the unchanged current value. History is now recorded only
when the upsert applied, on both paths; a test pins it. Also corrects
write_property's doc, which claimed local writes replace regardless of
timestamp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 4c3f14e43c rust: fold materialize's tests onto run/remote_child helpers and rstest cases
Every test re-spelled the four-store destructure and the seven-argument
materialize(...) call. A run() helper, a notebooks() manager and a
remote_child() stub builder replace them, and the music-track/PDF pairs
(primary content written, unavailable content skipped) become one rstest
each with a case per type (S4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 450d05108a rust: materialize through one Materializer, with no unreachable! arms
The four store references were threaded through materialize,
materialize_children and a nine-argument
materialize_primary_content_child; they now live in a private
Materializer, so the recursion takes (parent, dir, skipped).
write_artifact_file and artifact_extension dispatched on an ArtifactKind
that only ever took two values, with unreachable! (non-test panics, B6) for
the rest; they are split into write_note / write_primary_content and
note_format / file_type_extension, and the note extension comes from
TextFormat::extension instead of a copy of it. The public materialize()
signature is unchanged (the daemon calls it).

Also fixes B2 here: materialize_primary_content_child's doc comment had
been spliced onto skip_reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 10af4224f4 rust: two byte-count queries instead of four
artifact_bytes_for_documents / blob_bytes_for_documents and the matching
_for_subtrees pair differed only in the SUM expression, and every caller
added the two halves back together. bytes_for_documents and
bytes_for_subtrees now sum length(value) + blob_size_bytes per row in one
statement each (blob_hash and blob_size_bytes are written together, so the
blob_hash IS NOT NULL filter was implied), and total_bytes_for_rows runs two
queries rather than four. The subtree test now checks the recursion against
per-document totals rather than blob sizes alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 568c416cb3 rust: one seal loop and one commit step in the blob store
store_reporting (slice) and store_file (file) each carried their own copy
of the chunked seal/hash/write/progress loop and of the "rename into place
unless already present" step. A &[u8] is a Read, so both now go through
one seal(reader, len, ...) that ends in commit(); store_ciphertext commits
through the same TempBlob path instead of hand-rolling a shard-dir temp
file (which also stops two concurrent receivers of one blob sharing a temp
name). hash_file becomes blake3's update_reader, and the three copies of
the not-found check become present_blob_path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 ab8a5b37d8 rust: BlobStore resolves vault keys through the Store's own handles
Fixes B10: on every vault-key cache miss, BlobStore::vault_key built a
fresh VaultStore and SettingsStore — running their CREATE TABLEs, and
SettingsStore::new spawned a thread to derive the node keypair while
load_keypair() derived it again synchronously on the new, empty cache.
BlobStore now holds clones of the Store's VaultStore and SettingsStore, so
a miss is one query plus the keypair the settings handle already cached.

The key cache's lock().unwrap() calls (B6) recover a poisoned lock instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 f78ff8addd rust: announcing stores share one AnnouncingDb, and Store::batch stops listing them
peer_nodes, peer_health, revocation, epoch, linkage and settings each
repeated the same ChangeSignal plumbing: a throwaway ledger in new(), a
batch that publishes, subscribe, adopt_ledger (re-spelling the channel) and
publish_pending. They now hold an AnnouncingDb (a Db plus its signal, by
composition, no Deref) and take the ledger in new(); JobStore takes it too.

Every ChangeBus/ChangeSignal registers itself (weakly) with the ledger it
is built on, so Store::batch publishes through ChangeLedger::publish_pending
instead of naming seven stores, and Store::assemble no longer has a second
list of adopt_ledger calls to keep in step. Adding an announcing store can
no longer silently skip Store::batch's announcement.

SettingsStore keeps its own IMMEDIATE-transaction batch and publishes
through the handle; DocumentStore/ArtifactStore keep their ChangeBus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 dcb673d65a rust: sub-stores hold a Db handle and create their tables from one SCHEMA
Every store carried db_path plus a new() that opened a connection and ran
one conn.execute per CREATE TABLE/INDEX, and a ten-line batch() that
forwarded to batch_on. Now stores/mod.rs has a Db { path } whose open()
runs a store's whole schema through execute_batch (S8) and whose batch()
is the shared transaction entry; each store holds one, declares its tables
in a const SCHEMA (explanatory comments kept as SQL comments), and its
public batch() delegates in one line (S3a). Public signatures are
unchanged, so frontends need no edits.

ArtifactStore's retired-kind fixup now runs inside one transaction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 6ee8deaf19 rust: settings' three single-row tables share load/save/has helpers
settings, secrets and ensemble are the same table shape; one load_row,
save_row and has_row (through stores::sql::Json and Timestamp) replace the
six hand-written SELECT/INSERT OR REPLACE/COUNT blocks and three identical
CREATE TABLEs. The now-unconstructed Json and Io error variants go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 a87648d840 rust: read peer_health rows typed, and stop swallowing database errors
A strum-derived PeerHealthKind (explicit column strings, pinned by a test)
replaces kind() and the bare "clock_skew"/"schema_ahead" literals, so
clear() and existing() take the enum. existing() and for_node() query their
one node (and kind) instead of reading every row through all().

Fixes B7: all() matched `let Ok(..) = row else continue`, which also
swallowed real SQLite errors while stepping the query and returned a short
roster. Now only a row this build cannot decode is skipped, as documented;
a database error fails the read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 d7ed7c1b6e rust: read the small stores' rows through the stores::sql codecs
content_release, epoch, revocation, document_sync_override and vault bind
Timestamp, [u8; N], DocumentID, VaultId and u32 directly and read them back
typed, dropping their private parse_timestamp copies, the try_into round
trips, and the error variants only those parsers constructed
(InvalidTimestamp, UnknownOverride, Uuid, InvalidNonceLength,
InvalidCiphertextLength).

RevocationAuthority derives its stored text with strum (pinned by a test);
DocumentSyncOverride is stored through sql_strum_text!. epoch history and
the revocation roster keep skipping a row they cannot parse, now by reading
the fallible columns without `?`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:40:53 -07:00
Greg ShuflinandClaude Opus 5.5 539ef000ab rust: Humans reads and writes a human in one transaction, not one per field
- get_human opened ~9 connections (one per field); it now reads the
  human's artifacts once and matches them. list_humans read three fields
  per human (3N connections); it now bulk-reads names, nicknames, and
  circles for every human at once. list_all_circles likewise (audit H-6).
- update_human's eight writes, create_human's three, and each fact /
  contact-method add or remove plus its touch are one transaction each,
  through one set_or_clear and one touching helper; require_human is
  called instead of inlined three times (audit H-7).
- read_interaction_summary takes the Document its callers already hold,
  instead of re-reading it and inventing Utc::now() when it is missing
  (audit H-8).

Bug fix: update_human could half-apply (e.g. the name written, the
nickname not) if a later write failed; it is atomic now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:38:30 -07:00
Greg ShuflinandClaude Opus 5.5 da3a7cf423 rust: a notebook's tree reads note formats in its own transaction
get_tree opened one transaction for the whole subtree but read each note's
format through get_note_format, which opened another per note — the
comment saying the artifact store couldn't take a Transaction was stale.
It reads note_format(tx, ..) now, and get_note_format is gone (audit H-5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:30:35 -07:00
Greg ShuflinandClaude Opus 5.5 4e48482b1f rust: agents share add_titled and ensure_document
add_titled (a new document plus its Title) replaces the hand-written pair in
Notes' create_notebook/create_collection/create_note, clippings' capture,
and pictures' create_album (audit H-4). ensure_document (add unless the
derived id already exists, answering whether it did) replaces the
get-then-add in music's derived artist/album documents, anchors,
agent-settings documents, and podcast episodes (audit X-8). Both live in
agents/ rather than on DocumentStore, since stores/ is another batch's.

Bug fix, same shape as the importers': create_note and capture wrote the
document and its body in two transactions, so a failure between them left
a note or clipping with no body. Each is one transaction now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:27:54 -07:00
Greg ShuflinandClaude Opus 5.5 aac70554ea rust: Notes' synced settings go through one typed get/set pair
The five get/set pairs on NotebookManager each spelled out the
agent_settings call, the AgentId, and the parse. agent_settings gains
get_parsed<T: FromStr>, set_setting takes impl ToString, and each accessor
is one line over private setting/set_setting helpers (audit H-3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:22:50 -07:00
Greg ShuflinandClaude Opus 5.5 591230d730 rust: AgentId's slug and Display come from strum, and the registry is a table
AgentId::as_str was a 20-line hand match and Display a hand impl; both are
now strum's kebab-case (IntoStaticStr/Display), the same spelling serde
already used. The serde round-trip test iterates AgentId::VARIANTS, so it
can no longer miss a new variant. The registry's sixteen 7-line struct
literals are one agent(..) call each (audit A-1). agent_type stays a field:
deriving it from the group is a decision (queued in handoff notes).

AgentGroup::all() is kept: gui-app iterates it by value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:18:58 -07:00
Greg ShuflinandClaude Opus 5.5 ce5668fd65 rust: music's open_track_stream asks content_fetch for its peer candidates
It re-derived content_fetch::peer_candidates line for line (audit A-5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:13:13 -07:00
Greg ShuflinandClaude Opus 5.5 c132008c6a rust: music places a track in the library in one transaction
incorporate_track_cached used to open about ten transactions per track
(blob ref, stamp check, tag write, artist, album, year, two edges, unlink,
two thumbnail checks), each its own connection and writer-lock grab — the
module had already measured per-track connection opens as half the build
time. Now: one read transaction to decide whether to scan, the blob read
and tag parse outside any transaction, then one transaction for
everything the placement writes, then artwork. ensure_artist, ensure_album,
ensure_library_edge and unlink_from_other_albums take the caller's
transaction instead of opening their own (audit A-6).

stored_grouping_tags was cached_grouping_tags with an empty cache; the
freshly-scanned path now passes one (grouping_tags), and it is gone (A-4).

A failure part-way through a track now rolls back that track's tag write
too, so the next build rescans it rather than leaving it half-placed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:12:40 -07:00
Greg ShuflinandClaude Opus 5.5 9cb2d6fc4b rust: comics reads a .cbz in one pass and imports it through one path
- import_cbz_file reads the file and calls import_cbz_bytes instead of
  repeating it.
- ComicInfo::from_xml replaces four copies of the parse_comic_info +
  parse_page_info pair, and import_comic_from_pages takes it whole.
- extract_cbz reads pages and the ComicInfo.xml sidecar in one pass over
  the archive, replacing page_names + extract_pages + find_comic_info_xml
  (which opened the ZIP three times and read it twice).
- chunk_page_name is slice::chunk_by; format_chapter_number was f64's own
  Display.
- import_archive_as_chapter records a missing comic importer as that
  chapter's error instead of .expect()ing it (audit A-2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 12:03:21 -07:00
Greg ShuflinandClaude Opus 5.5 13fb3e5c1d rust: PdfError and ComicError delegate ContentFetchError instead of flattening it
Both copied ContentFetchError's Stream/Io/NotAvailableRemotely/Canceled
variants and hand-mapped them, on the claim that a #[from] wrapper would
lose ADR 0023's Offline-vs-Canceled distinction. PictureError already
wraps it and ffi/error.rs delegates to ContentFetchError's own SyncError
mapping, which keeps exactly that distinction (audit X-6). gui-app matches
only the BlobStore(NotFound) variant, which stays.

The unreachable-peer message is now content_fetch's ("couldn't reach a
node that has this content") rather than the per-type "...this PDF" /
"...this page".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:58:10 -07:00
Greg ShuflinandClaude Opus 5.5 468dfd4415 rust: one blob-backed import skeleton for pictures, PDF, video, music and comic pages
agents::blob_document::import_blob_document stores the blob, creates the
document, lets the agent write its properties, and points PrimaryContent at
the blob. ImportImageError and ImportPdfError were variant-for-variant the
same and are now one ImportError. primary_blob_ref/load_blob replace the
get_blob_ref+load triplets each agent spelled out (audit X-2, X-7).

Bug fix: the document+properties and its PrimaryContent artifact used to be
two transactions, so a failure between them left a document with no
content. They are now one (both stores share store.db, and a Store's
artifact store announces on the document store's bus, so subscribers still
see one event).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:56:37 -07:00
Greg ShuflinandClaude Opus 5.5 2e5c9aeb49 Android: ktfmt over this batch's Kotlin edits
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:29:37 -07:00
Greg ShuflinandClaude Opus 5.5 c87941b254 ffi: clippy fixes for this batch
Document/DocumentType are only used by node.rs's tests since the
single-file import went, and Job's timestamps are already Timestamps, so
JobItem takes them as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:24:46 -07:00
Greg ShuflinandClaude Opus 5.5 a0ca4d3858 ffi: drop the pre-shortened id fields Kotlin's HashChip recomputes (F20)
JobItem.peer_id_short/document_id_short and
DocumentNodeStatusItem.node_id_short carried copy::short_id of an id sent
alongside in full, and HashChip already computes shortId(full) when given
no short form — the same function. The fields, and IdRef's idShort
parameter that only forwarded them, are gone; the chips render the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:17:25 -07:00
Greg ShuflinandClaude Opus 5.5 eb5ed7b901 ffi: SyncError::recourse is a method on the exception, not a free function (F19)
The free recourse(error) existed because uniffi was thought to generate
error classes without methods; uniffi 0.32 renders exported methods on
errors (checked against the generated Kotlin), so the impl block itself
is exported and Kotlin's userRecourse reads recourse().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:15:57 -07:00
Greg ShuflinandClaude Opus 5.5 a783c93a5d Android: say a document is gone instead of spinning forever on its detail screen (BUG5)
DocumentDetailScreen treated "documents().get returned null" and "still
loading" alike, so a document deleted or purged (here, or by a purge
from another node) left the screen on a spinner, and a failed read did the
same after only logging. It is now tri-state: loading, gone — which says
copy::documents::GONE, exported on DocumentCopy — or loaded; a failed read
shows the error like the detail rows' failure already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:11:10 -07:00
Greg ShuflinandClaude Opus 5.5 bb8fa8ca5f copy: the library no-match sentence and the Follow-policy option come from Rust
Two sentences Android retyped:
- "No X match “q”" was built in six Kotlin screens (Comics, Music, PDF,
  Podcasts, Pictures, Video); it is copy::library_empty::no_match,
  exported directly as library_no_match. gui-app's pdf_viewer copy is
  queued for the GUI batch.
- The override picker's "Follow policy" choice and its description were
  Kotlin literals beside Rust's Pin/Exclude; get_document_sync_override_options
  now leads with a value: None option carrying copy::sync_override's
  words, and OverrideControl renders the list as given. gui-app's
  detail_view literal is queued.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:09:57 -07:00
Greg ShuflinandClaude Opus 5.5 20e801adb7 ffi: a job widget's activity line and a history row's times come from copy
- JobBinding.jobActivityText was a line-for-line copy of
  copy::job_activity; it now calls the exported job_activity_text.
- JobsScreen's "Started … · Finished …" line (a copy of gui-app's
  render_history_timestamps) is copy::job_history_times, exported as
  job_history_times. gui-app switching to it is queued for the GUI batch.

Same words either way; the history line now formats through
Timestamp::format_display directly rather than a string round trip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:08:22 -07:00
Greg ShuflinandClaude Opus 5.5 dfdd9af8ff ffi: export the humans field-length cap, and document cancel_job
- HUMAN_FIELD_MAX_LEN in Kotlin was a retyped 255; it now reads
  human_field_max_len(), which is agents::humans::MAX_FIELD_LEN.
- JobsFfi::cancel_job regains the doc comment its deleted Kotlin wrapper
  carried, rewritten for the current runner (every runner-backed job has a
  token; what varies is how promptly the work notices).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:06:12 -07:00
Greg ShuflinandClaude Opus 5.5 2b7f9ae76a ffi: document-type filters as DocumentType with Rust's display names, and date filters from copy (F17)
Bug fix: get_all_document_types returned snake_case names and the
Documents screen title-cased them itself, so its type filter and chips
read "Podcast_feed" and "Music_track". It now returns
DocumentTypeOption { doc_type, display_name } (DocumentType::display_name,
what the desktop shows), and search/search_page take Vec<DocumentType>
instead of strings they silently dropped when unknown.

The date-range options (key + label, and "Any Date") move from a
Kotlin literal list into copy::date_filter, exported as
date_filter_options / date_filter_any_label. gui-app's identical
DATE_FILTERS table is queued for the GUI batch.

Gender and ContactProtocol (the rest of F17) are a decision and are left
as strings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 11:04:51 -07:00
Greg ShuflinandClaude Opus 5.5 636877b630 ffi: hand Kotlin the note tree as a tree (F12)
get_tree flattened agents::notebook::NoteTreeNode into NoteTreeEntry rows
with a stringly "note"/"collection" kind, and NotebookRepository
regrouped them by parent id. NoteTreeNode now derives uniffi::Enum (uniffi
supports recursive enums) and crosses as itself; Kotlin maps it with one
recursive toItems(). Deletes flatten_note_tree_nodes, NoteTreeEntry and
buildTree/buildChildren.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:59:26 -07:00
Greg ShuflinandClaude Opus 5.5 851276e3bc ffi: cross the FFI as the lib's own types instead of four mirrors (F11)
- LogConfig: crate::log::LogConfig derives uniffi::Record; the identical
  ffi::types::LogConfig is gone.
- MusicLibraryLevel: music::LibraryLevel derives uniffi::Enum under that
  name, so list_library takes it directly instead of converting from a
  string-id copy.
- SchedulerRunSummary: run_scheduler_passes returns the scheduler's own
  SchedulerPassResult (catalog / catalog_fetch / content) rather than
  flattening it; SchedulerWorker and the Sync settings "Run now" status
  read summary.catalog.peersSynced etc.
- Kotlin's ContactRow was ContactMethodItem field for field; the human
  detail screen uses the generated record, and the note about staged rows
  having no uri moves onto ContactMethodItem::uri.

NotebookItem stays: list_notebooks' (id, title) tuple is also what
gui-app and the daemon consume, so naming it is queued for the GUI batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:57:22 -07:00
Greg ShuflinandClaude Opus 5.5 6bb3647a05 ffi: generate the constant-copy records, and export copy functions directly (F6)
- copy_record! emits each of the twelve constant-copy records
  (PlaceholderCopy, ActionLabels, … RevocationCopy's 27 fields) and the
  #[uniffi::export] function that fills it, so each field is written once
  instead of twice.
- The 22 one-line pass-throughs whose copy function already has a
  uniffi-compatible signature (&str/u32/bool/ServiceId in, String out) are
  gone: the copy.rs function itself carries
  #[uniffi::export(name = "<the old name>")], so Kotlin's names do not
  change. The rest stay wrappers because they take Option<&str> or usize
  or return &'static str, which uniffi cannot lift or lower.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:54:00 -07:00
Greg ShuflinandClaude Opus 5.5 1153e8d37a ffi: artifact summaries from copy::artifact_value, and untangle the partial-date helpers
- format_artifact_value was a verbatim copy of
  copy::artifact_value::summary (Gender words included); it now calls it
  (frontends batch F2, queued for FFI).
- validate_partial_date re-derived what parse_partial_date and
  parse_optional_partial_date already decide.
- Two doc blocks were glued onto parse_partial_date; the first belongs to
  parse_optional_partial_date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:51:01 -07:00
Greg ShuflinandClaude Opus 5.5 902ec899d1 rust: JobSubject::document()/peer() instead of two copies of the match (F20)
The FFI's job_to_item and list-jobs title lookup each spelled out which
subjects name a document and which a peer; the answer now lives on
JobSubject.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:51:01 -07:00
Greg ShuflinandClaude Opus 5.5 42035116ff copy: capitalize a busy clause into a sentence in one char-safe place (F20)
ffi/music.rs and ffi/import.rs each wrote
format!("{}{}.", clause[..1].to_uppercase(), &clause[1..]), which
byte-slices and so would panic on a multibyte first letter. They now call
copy::busy::sentence. The two gui-app copies are queued for the GUI batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:51:01 -07:00
Greg ShuflinandClaude Opus 5.5 b3e173a83a ffi: one local-then-peer body for a comic page's bytes (F20)
get_page_bytes and prefetch_page_bytes differed only in whether the
remote fetch gets a job row; both now call a private page_bytes with the
runner or None.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:50:59 -07:00
Greg ShuflinandClaude Opus 5.5 5db920e4d9 ffi: one P2P preamble and one DocumentSyncResult conversion (F15)
EnsembleFfi::p2p_parts was SyncNodeCore::require_p2p under another name,
and push_document inlined it a third time; all three now call
require_p2p. The DocumentSyncResult built identically by
sync_document_assets and sync_document_asset is a From<DocAssetSyncResult>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:43:57 -07:00
Greg ShuflinandClaude Opus 5.5 18eb63da78 ffi: read SettingsFfi's getters through SyncNodeCore::settings (F16)
Six getters each loaded the settings row and defaulted the one field they
wanted; Settings::default() carries the same per-field defaults, so each
is now one line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:42:24 -07:00
Greg ShuflinandClaude Opus 5.5 8e9859fe91 ffi: share documents.rs's repeated lookups, and show its timestamps in the user's timezone (F14)
- The primary-content blob-ref lookup (4 copies) is primary_blob /
  required_primary_blob.
- SearchParams is built by one search_params for search and search_page.
- The two DocumentNodeStatusItem builders (node statuses, blob-ref rows)
  share NodeLabels, which also carries the local pubkey and peer names
  they each looked up.
- list_children builds DocumentListItems like search_page does, so
  size_annotated_items takes those instead of a 6-tuple.
- SyncNodeCore::settings() reads settings-or-defaults once.

Bug fix: document-detail property, artifact and node-status times used a
bare "%b %d, %Y %H:%M" in UTC while the Placement table beside them
honored the user's timezone; all now go through
Timestamp::format_display(tz), so they read in the user's zone with its
suffix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:41:49 -07:00
Greg ShuflinandClaude Opus 5.5 2a9d21ae99 ffi: generate SyncNode's per-agent handle accessors with one macro (F13)
The 17 accessors were identical apart from their name and handle type;
ffi_handles! emits them as one #[uniffi::export] impl block, with the
shared explanation on the macro rather than repeated on each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:39:33 -07:00
Greg ShuflinandClaude Opus 5.5 5fa1965e50 ffi: take and return DocumentID/NodePubkey/Timestamp instead of strings (F2)
The custom types already cross as plain strings (Kotlin typealiases), so
about 60 methods that took `*_id: String` and parsed it on the first line
now take a DocumentID, peer-taking methods take a NodePubkey, and methods
and records that returned `id.to_string()` return the id. Deletes
parse_document_ids, the JobSubjectRef parse closures, and ~100 parse and
to_string lines. No Kotlin change: the generated types are still String.

NodePubkey's try_lift now fails with SyncError::InvalidInput, so a
malformed peer id still reaches Kotlin as a typed SyncException (test
added). DocumentID and Timestamp declare their custom_type in documents/,
outside this batch; until theirs do the same, a malformed document id
surfaces as SyncException.Internal rather than InvalidInput (only reachable
through a Kotlin bug, since every id Kotlin holds came from Rust).

DocumentItem keeps String fields: it is built from the store's
DocumentListItem, which still carries strings.

Also restores HumansFfi::delete_interaction's doc comment that the Kotlin
wrapper used to carry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:38:28 -07:00
Greg ShuflinandClaude Opus 5.5 41d5bace05 ffi: delete exports nothing calls any more
After Android's A1/A2 batches these had no Kotlin caller and no Rust caller
elsewhere: content_fetch_stall_hint_ms, compile_typst and
compile_typst_with_fonts (with FontData — so F18's parallel-array wrapper
goes with them), notebook_default_item_name, ComicsFfi::get_metadata and
get_reading_direction, SettingsFfi::get_document_sync_override, and the
four single-file imports (ComicsFfi::import_archive, PdfFfi::import,
ImportFfi::image/music_track) that ImportBatch::import_file replaced —
taking import_document_with_blob and run_one_file_import with them.
EnsembleFfi::get_gossip_neighbor_count is inlined into its one Rust caller.
Doc comments that named the deleted paths now name ImportBatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:21:41 -07:00
Greg ShuflinandClaude Opus 5.5 b98cc54651 ffi: drop SyncNodeCore::with_store for a plain store() binding (F9)
with_store(|store| body) only called f(&self.store()), so every one of its
~115 call sites paid a closure, an Ok(..) wrap and an extra indent for
nothing. Bind `let store = self.core.store();` once per method instead and
let `?` work directly. Mechanical; no behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:17:55 -07:00
Greg ShuflinandClaude Opus 5.5 b55b682c8e ffi: classify retire, retirement, ping and asset-sync errors instead of flattening them to Internal (F3)
ensemble.rs mapped every RetireError, RetirementError, PingError,
AssetSyncError and InitError to SyncError::Internal, so a wrong keyphrase,
"already in an ensemble", a ping timeout or an unreachable peer all
reached the user as ReportBug. Add From impls in error.rs beside their
neighbors (plus RevocationError and the revocation/epoch stores' Busy) and
let `?` convert; sync_document_asset's hand-written UnknownAsset special
case is now the AssetSyncError impl.

Bug fix: those failures now carry the right Recourse (AmendInput for a bad
keyphrase, RetryLater for an offline peer, ResolvePrecondition for setup).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:13:38 -07:00
Greg ShuflinandClaude Opus 5.5 3f99681089 tui: bring the help overlay and the Jobs screen's doc up to date (B10)
The `?` overlay left out the Documents screen's `d` (show/hide hidden
documents) and the whole Jobs screen; both are listed now. The Jobs
screen's module doc said the daemon had no JobRunner to cancel through; it
has had one since the scheduler driver — what is missing is a protocol
command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 8c150782ee cli: name commands in messages the way they are actually typed (B4)
`linkage pair` told the user to run `syn node daemon start`; the node
commands are top-level (`node` is only a help group), so it is `syn daemon
start`. And a handful of CLI messages, plus the extension popup, said
`syn-cli …` where everything else — the other hundred-odd messages across
lib, daemon, CLI and TUI, and the docs — says `syn …`; they now agree. (The
built binary is still named `syn-cli`; that naming question is in the
handoff notes.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 521b907d8e tui: the $EDITOR path alerts on an incoming body instead of writing over it (B3)
`E` wrote the whole buffer back unconditionally once $EDITOR exited — the
design principle's "stop writing over it" violation: a whole-buffer write
is applied as a diff against what the store holds now, so a body that
arrived from another node while the editor was open was deleted from the
merged text everywhere. It also wrote when nothing changed or the editor
failed (vim's `:cq`), and ran an EDITOR with arguments (`code -w`) as one
program name.

Now: the editor runs through `sh -c '$EDITOR "$1"'`, as git does; a failed
exit or an unchanged file writes nothing and says so; and before writing,
the note is re-read. If its body moved meanwhile, the edit is not written —
it opens in the TUI's own editor as an unsaved buffer over the original
base, with the arrived version held as `incoming`, which is exactly the
state `on_documents_changed` produces: "⟳ changed elsewhere", `:e` loads
theirs, `:w!` keeps yours, and nothing moves until the user picks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 bdb16e1dce daemon: put jobs_snapshot's doc comment back on jobs_snapshot (B9)
It sat on `MAX_AWAIT_CHANGE_MS`, run together with that constant's own doc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 e37fd770ca daemon: count documents with COUNT(*) for Status and NodeInfo (B2)
Both loaded every document — a `Document` built per row — only to take the
length, and the browser extension sends `status` to each node every time
its popup opens. `DocumentStore::count_documents` is the same count as one
`SELECT COUNT(*)`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 8c33a83767 daemon: stop a directory import walk when its job is canceled (B1)
The daemon's own copy of the tree walk never checked `is_canceled`, though
the comment above the per-path loop said it did, so `syn jobs cancel` on a
large directory import ran on to the end of the directory. It now checks
per entry, as lib's walk does. (F10 — sharing lib's walk instead — needs a
collection hook and a caller-owned progress in lib's API; left for the lib
batch.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 fa6efcc9db daemon: take the artifact-value summary from a new copy::artifact_value
The one-line artifact summary ("In progress: m:ss", "Bookmark: page N",
"(sealed)", …) was written three times — lib's FFI helpers, the desktop's
document detail, and the daemon's `docs show` — differing only in how much
body text each keeps; `Gender`'s display words likewise (FFI, daemon,
CLI). `copy::artifact_value::{summary(value, max_chars), gender}` is new
code in lib (nothing existing there is changed), and the daemon and the
CLI's `humans show` now use it; the daemon's blob-backed arm stops being an
`unreachable!`. Switching the FFI helper and the desktop's copy over is
queued for those batches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 19c9400195 rust: drop unused and duplicated frontend dependencies
cli-app named `iroh` and `log` but uses neither (`log` only appeared in a
doc comment; logging goes through `synchronicity::log`), and tui-app named
`serde_json` without using it. syn-daemon's dev-dependencies re-listed
`chrono`, `serde_json` and `uuid` from its normal dependencies under a
comment claiming integration tests link only against dev-dependencies —
they link against the package's normal dependencies too (B12). No version
changes; Cargo.lock only loses the three edges.

Left alone: the workspace's two argument parsers (clap in gui-app, bpaf
elsewhere) — a design choice with little LOC in it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 7abfba3ec9 extension: one api shim module, and create the context menu root once
`globalThis.browser ?? globalThis.chrome` was defined in linkage.js,
permissions.js and background.js; it is `src/api.js` now. And
`rebuildMenu` created the identical root item in two branches; it creates it
once and adds per-node children only when more than one node is linked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 2de21300b0 daemon: odds and ends in server.rs, and stop a restart from orphaning a live daemon
- `commanded_shutdown`'s changed()/borrow() loop is `watch::Receiver::wait_for`.
- The unused `/status` route and `handle_status` go: no Rust, JS or test
  caller; the extension sends the `status` command.
- `shutdown_signal` no longer `expect`s on installing its signal handlers;
  one that can't be installed is logged and never fires (and the
  not-unix branch of a Unix-socket daemon goes).
- `serve` takes the PID path instead of `socket_path.parent().unwrap()`.

B14: `kill_existing_daemon` shelled out to `kill` and ignored the result,
then after five seconds deleted the socket out from under what could still
be a running daemon — which kept the store lock and became unreachable. It
now sends SIGTERM with `libc::kill` (already a dependency), reports a
failure to signal, and refuses to proceed if the daemon has not exited
rather than removing its socket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 044edc6019 daemon: run the scheduler tick through a shared lib scheduler::tick
The daemon's and the desktop's timer loops each carried the same body:
load the scheduler settings, run_all_passes when enabled, log the identical
"tick complete" / "tick skipped" sentence, and sleep for the interval
floored at a MIN_INTERVAL both defined. That body is now
`scheduler::tick(store, job_runner, endpoint, local_node) -> Duration` (plus
`MIN_TICK_INTERVAL`), added to lib without touching its existing code, and
the daemon's driver is a loop around it. The desktop driver's switch is
queued for the GUI batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 361357eed3 cli: parse document ids and the timezone at the command line
About twenty positionals were `id: String` / `parent_id: String`, each
turned into a DocumentID by a `parse_id` call in main.rs; `settings timezone`
likewise took a string it validated itself. bpaf parses any `FromStr` type,
so these are `DocumentID` and `Option<chrono_tz::Tz>` now, and a bad value
fails at parse time with bpaf's usage error ("couldn't parse `x`: …")
instead of "invalid document id: x". `linkage revoke` keeps its string and
hand parse, whose error points at `syn linkage list`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 8ddb4eca8f daemon: typed ids and enums in protocol rows (wire unchanged)
Document ids in the protocol's rows and snapshots were `String`, so the
daemon stringified DocumentIDs it held and the TUI parsed them straight back
(`doc_item`, `parse_id`, `DocumentID::from_str`), keying its expanded-row
sets by `to_string()`. They are `DocumentID` now — a serde newtype over
Uuid, so the JSON is the same string — and the TUI's Documents screen keeps
the daemon's `DocumentItemRow`s rather than copying them into `DocItem`s.
`DeletedSnapshot` stays a string: credential-clear answers with a service
name in it.

`RetirementSnapshot.outcome` is `RetirementOutcome` (snake_case, as before)
rather than a string the CLI matched by spelling, and `ListDocuments.sort` is
`DocumentSort` (kebab-case, as before), parsed by bpaf for `--sort`.

B7: an unknown `--sort` value was silently treated as `name`; it is now a
usage error naming the three it accepts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 bf1122a653 tui: one background-worker type, one busy guard, one reload per view
Documents' pull and Ensemble's actions each hand-built the thread + mpsc +
try_recv + Disconnected dance; both now use `background::Pending<M, T>`
(spawn with the metadata the screen shows, `poll` for the outcome). A worker
that dies without reporting is now an error outcome like any other: on the
Ensemble screen that lands on the member's row instead of a popup.

Also: the Ensemble screen's "{participle} {label} already — wait for it"
guard (3 copies) is `busy()`, `reload` is `on_nodes_changed` plus the
default status rather than a copy of its body, and `start_action` takes the
command to send instead of an `unreachable!` arm for the prompted kinds.
Notes' "reload whichever view is showing" (4 copies) is `reload_view`, and
the ItemKind → delete/rename command mapping (2) is `ItemKind::{delete,
rename}`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 1629ebf766 cli: share the integration tests' helpers, and give each daemon test its own dir and seeds
The store-setup helper existed three times (setup_test_node, setup_node,
setup_source), the keyphrase parser twice and parse_ensemble_pubkey twice;
they are now `common::{node, parse_keyphrase, parse_ensemble_pubkey}`, and
common.rs loses the nine per-item `#[allow(dead_code)]`s its file-level one
already covered. The seeds and `setup_store` live in tests/support/seeds.rs,
which the dev example includes by path instead of carrying its own copy.

p2p_ping wrote its stores into the source tree (tests/stores/), which is why
`DaemonGuard` had to delete the socket a killed daemon leaves (Nix refuses a
tree containing one) — and, in this checkout, why the daemons failed to start
at all: the socket path exceeded SUN_LEN. It uses TempDirs now, and the guard
only kills. B8: its outsider test reused NODE_A/NODE_B's seeds while the
other test's daemons ran, so two live daemons could share an iroh node id;
it has seeds of its own. B10: the module doc named `syn p2p node-addr`,
which does not exist.

Also `AppState::new` replaces the four hand-built AppState literals in the
daemon and its tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 df6df8d9fd daemon: snapshot summaries the CLI and TUI both render
`EnsembleSyncSnapshot` → `PeerSyncCopy` was written identically in the CLI's
format.rs and the TUI's ensemble screen; the job-state words were hardcoded
in the CLI and taken from `copy::job_state` in the TUI; and the TUI's
Documents screen wrote its own asset-sync sentences, which disagreed with
the shared `copy::asset_sync` ones the CLI used ("was already on this node"
against "is already on this node", its own peer-count phrasings).

Now `EnsembleSyncSnapshot::summary`, `AssetSyncSnapshot::summary(label)` and
`JobSnapshot::state_text` live beside the snapshots; the frontends only pick
colors. The TUI's pull status line therefore changes to the shared wording —
the copy-rule fix, not a new sentence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 f56422a088 daemon: one start path for all three StartModes, and shared liveness helpers
`server::run`'s Foreground/Restart/EnsureRunning arms each repeated the
stale-socket removal, the store-lock check, the log-file setup and
Daemonize builder, proc_title plus logger re-init, and runtime → serve →
cleanup. They now share one sequence; only what differs (bail, kill, or
return when a daemon is already live; write a PID file, `start`, or
`execute` and wait) stays per mode.

Socket liveness (probed six ways), the PID-file read, and the
poll-until-deadline loop become `syn_daemon::{socket_is_live, read_pid,
poll_until}`, and the CLI's `DaemonStatus` and `wait_for_daemon_exit` move to
`syn_daemon::client` beside `ensure_daemon_running`, which uses the same
wait.

Needs a manual check: `syn daemon start`, `start --foreground`, a TUI
auto-start, and a restart over a running daemon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 4b98898cb6 cli: helpers for the confirm prompt, keyphrase prompt and repeated output pieces
Written once each instead of per call site: the `[y/N]` confirmation (4
copies), the keyphrase prompt (two near-identical functions, now one taking
its flag hint and empty-input message), reading stdin to a string (2),
SecretFormat from `--format-a` (2), the WRITE-DOWN-YOUR-KEYPHRASE block shared
by `ensemble init` and `reseed` (2), a DHT registry row (2), a hand-rolled
hex loop (4), the `%Y-%m-%d %H:%M UTC` format (5) and the 14-column dim label
(2). Output is unchanged: each phrase-row layout and every sentence stays
as it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 5cba9fde34 daemon: local helpers for the node pubkey, presence marks and row mapping
commands.rs spelled out `local_node_pubkey()?.ok_or_else("node not
initialized …")` twelve times, the best-effort mark_present-with-warning
block four times, NotebookManager-plus-local-node for each of Notebook, Note
and Collection, the same SearchParams twice in ListDocuments, and the
DocumentListItem-to-row mapping three times. Each is now written once:
`local_node`, `mark_present`, `notes`, and `From<DocumentListItem>` for
DocumentListRow/DocumentItemRow. The ensemble-members pubkey uses
`NodePubkey::to_hex` rather than a hand-rolled hex loop.

`syn docs search` now answers from `search_document_items` — one query
carrying each title — rather than `search_documents` plus a title read per
match (N+1). Same filters and ordering; the title match is SQLite's LIKE, as
the desktop and Android document search already use, so case-folding is
ASCII-only where it used to be Unicode lowercase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 c743ec3884 tui: shared widgets module and a Screen trait
Every screen carried its own copy of `centered_rect` (×5), the error popup
(×4), the focused-border style (×6), the wrap-around move_up/move_down (×4),
the list highlight, the tab span, the padded label/value line and the
by-id selection restore; `app.rs` then matched on AgentId in five places to
reach the same four screens.

`ui.rs` holds one of each — `pane`, `error_popup`, `highlighted`, `step`,
`restore_selection`, `tab_span`, `field` — with popups centered by ratatui
0.30's `Rect::centered` rather than a hand-built three-way Layout (a popup
can move by a cell on odd remainders). Each screen implements `ui::Screen`
(render, handle_key, status_line, is_typing, error), and `App::screen()` is
the one AgentId match left.

Terminal setup and teardown use `ratatui::try_init`/`try_restore`, which also
restore the terminal on a panic. `handle_key` no longer threads the terminal
through every screen for the one that needs it: Notes suspends itself around
`$EDITOR` and raises `needs_full_redraw`, which the loop answers with a
`terminal.clear()` before the next draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 0c00712a56 cli: one typed call per command instead of build_command + format_response
A leaf command's handling was split three ways: a pre-dispatch or
`build_command` (five `unreachable!`s for arms the pre-dispatch had already
taken) picked the DaemonCommand, `send_command` sent it, and
`format_response` matched on the command again to pick a body type and
renderer — about 25 of its arms raw or dead, because no CLI command sends
those commands. The dead EnsembleBumpEpoch arm had already drifted from the
live `renew_membership` output (B13).

Each leaf now names its command and its renderer in one
`client::run(store, start, cmd, render)` call; `format::*` are plain
`fn(Snapshot) -> String`. The exhaustive CLI-enum matches keep every command
deciding its rendering, and `handle_ensemble` loses its `unreachable!()` arm.
Commands that auto-started the daemon still do; ensemble addr/ping/sync still
require one the user started.

B5: a failed command now returns its error to `main` rather than printing
"error: …" and calling `process::exit(1)` itself, so it gets main's
"Error:" rendering like every other failure. A daemon body this build cannot
decode is now an error rather than a line printed as if it were an answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 b8c59c16dc daemon: answer every command through one async commands::run
`handle_command` carried eleven hand-written special cases, each repeating
the require_p2p / success / error ladder, and `dispatch` was synchronous, so
every async or P2P command was an `unreachable!` arm in it — reachable in
practice: the CLI's no-daemon fallback could hand it `ImportUrl` and panic.

`commands::run(cmd, &Ctx { store, job_runner, p2p })` is now the one
exhaustive match. A command that needs P2P asks `cx.p2p()?`, which answers
the same "P2P node is not running on this node" the server tests assert;
EnsembleStatus still degrades without P2P; AwaitChange still parks on
spawn_blocking; SetNodeName's best-effort gossip re-announce stays in the
server, the only process with a runtime to re-announce through. Shutdown and
pairing, which live in the serving process's memory, are answered by the
server and are an error (not a panic) anywhere else.

The CLI's daemon-or-direct branches (import, import-url, rename, timezone,
node_info/ensemble_members/document_detail wrappers) collapse into one
`client::query_store_as`, which runs `commands::run` in-process when no
daemon responds. The friendly IANA timezone error moves into the SetTimezone
arm so both paths give it (B15). Ping and retire timeouts use
`Duration::try_from_secs_f64` rather than the panicking constructor, and the
node-runtime mutex no longer unwraps on poison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 10:03:38 -07:00
Greg ShuflinandClaude Opus 5.5 be64dbf54c rust: read property and artifact values through get_value and try_as_*
The ~40 hand-written "match the value, Some on the one variant I want,
None otherwise" blocks around get_property and artifact reads become
get_value(..)?.and_then(PropertyValue::try_as_text) / .try_as_u32() and
a.value.try_as_reading_position() and friends. Deletes music's
u32_property and clippings' text_property (the one-off readers these
replaced) and shortens comics' order/reading-direction/page-count readers
to one line each. The five derived-id artifact writes in facts, contact
and podcast_queue use Artifact::with_id instead of spelling out the struct
with Timestamp::now().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 09:47:41 -07:00
Greg ShuflinandClaude Opus 5.5 585b24d091 rust: write properties through DocumentStore::set_property
Mechanical conversion of every write_property(tx, &Property::new(id.clone(),
kind, PropertyValue::X(v), node)) in the agents, documents, credentials,
ensemble and the desktop's detail view to set_property(tx, &id, kind, v,
node); rustfmt laid each old call out over nine lines. Music's local
write/write_or_clear closures now wrap set_property/set_or_clear. Tests get
a matching test_support::set_property. Literal .to_string() values drop
the conversion now that &str converts into PropertyValue. Also picks up a
clippy redundant-closure (Timestamp::now) the previous commit introduced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 09:39:13 -07:00
Greg ShuflinandClaude Opus 5.5 4afaf7dd32 rust: chunk node_content_status's bulk key lookups and read rows typed
keys_with_known_holder bound two parameters per key with no chunking, so
document_availability_bulk over a library of more than ~16k missing items
failed with "too many SQL variables" (audit B1); it and holders_of (which
chunked by hand, citing a stale 999 limit) now go through query_in_chunks
with a row-value list. ContentPresence derives strum instead of its
hand-written as_str/parse, and the readers take NodePubkey and Timestamp
straight from the row. NodeContentStatusError's InvalidTimestamp,
InvalidNodePubkey and UnknownPresence variants had no remaining
constructor and are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 09:10:39 -07:00
Greg ShuflinandClaude Opus 5.5 7fa2a5fd01 rust: read document-store rows with one mapper per record type
Document, Property, Edge, DocumentListItem, SetElement and the three
tombstone rows each had their own read-strings-then-parse copies; now
DOCUMENT_COLS + document_from_row, PROPERTY_COLS + property_from_row
(shared by properties and property_history), list_item_from_row (shared by
search_document_items and ancestors_of) and small per-row mappers,
through the stores::sql codecs. Writes bind typed values; property rows
bind through one property_params.

- load_documents_by_ids was an N+1 (one SELECT id, then one get_document
  per id) behind list_documents(_by_type), list_children(_page),
  list_root_by_type, find_documents_by_title and search_documents; each
  now selects the document columns directly in one query.
- get_property was a byte-for-byte copy of get_property_in_tx; it now
  calls it.
- list_properties_for_documents, descendants_of and ancestors_of go
  through query_in_chunks, so a list larger than SQLite's bound-parameter
  limit no longer fails (audit B1). ancestors_of now drops matches and
  cross-chunk duplicates in Rust rather than with a second bound id list.
- list_tombstones_since is one statement (?1 IS NULL OR deleted_at >= ?1).
- DocumentStoreError's Json, Uuid, InvalidTimestamp, InvalidNodePubkey,
  Unknown{DocumentType,PropertyKind,EdgeKind,Provenance} variants had no
  remaining constructor and are gone, with their ffi/error.rs arms that
  reported corrupt rows as SyncError::InvalidInput (audit B12).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 09:05:54 -07:00
Greg ShuflinandClaude Opus 5.5 a41f6604f2 rust: read artifact rows with one mapper per record type
The Artifact row was decoded five times (get_artifact, get_artifact_by_id,
list_artifacts_of_kind, get_artifacts_for_documents, list_artifacts) and
the ArtifactRef row three times, each reading strings into a tuple and
parsing them in a second pass; now ARTIFACT_COLS + artifact_from_row and
artifact_ref_from_row, through the stores::sql codecs. The three copies of
"deserialize the value, take its blob_ref or fail" are blob_ref_of, the
four byte-total queries share bytes_by_document, singleton_flag() == 1
becomes is_singleton(), and writes bind typed values (BlobHash gains a
text codec). Enables rusqlite's fallible_uint so u64 sizes bind and read
without as-casts.

Every bulk IN (...) query here now goes through query_in_chunks, so a list
larger than SQLite's bound-parameter limit (32766 in the bundled build)
no longer fails with "too many SQL variables" (audit B1).
unfulfilled_stub_ids_for_documents and list_blob_refs_for_documents are
generic over the id type, so availability passes its DocumentIDs straight
through instead of stringifying them to look results up by string.

ArtifactStoreError's InvalidTimestamp, InvalidNodePubkey, UnknownKind,
UnknownDocType and BlobHash variants had no remaining constructor and are
gone, and ffi/error.rs no longer maps artifact row-parse errors to
SyncError::InvalidInput: they come from the store's own rows, so they are
Internal (audit B12).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:56:10 -07:00
Greg ShuflinandClaude Opus 5.5 0209458d62 rust: read linkage rows with one mapper and one lookup
The SELECT column list was written three times and each read went through
a Columns tuple, row_to_columns and linkage_from_columns; now LINKAGE_COLS
and linkage_from_row, and authenticate reuses one() now that one() takes
its value as &dyn ToSql. LinkageStoreError's InvalidTimestamp and
InvalidUuid variants had no remaining constructor and are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:49:04 -07:00
Greg ShuflinandClaude Opus 5.5 9bf666e603 rust: read peer_nodes rows with one mapper
get_peer_nodes_for_ensemble read blobs and strings into an 8-tuple and
converted each by hand; peer_from_row now reads [u8; 32] and Timestamp
directly through rusqlite and the stores::sql codecs, and writes bind the
arrays and timestamps as themselves. A row that fails to read is still
skipped, as before (B7, errors swallowed by that skip, is left for a
separate change). PeerNodeStoreError::InvalidTimestamp had no remaining
constructor and is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:49:04 -07:00
Greg ShuflinandClaude Opus 5.5 f0f0f48bd8 rust: read job rows straight into Job
row_to_job read eleven columns as strings and handed them to an
11-argument build_job under #[allow(clippy::too_many_arguments)]; it now
reads each field through the stores::sql codecs (TextUuid, JobKind,
Timestamp, Json<JobProgress>) and only parses subject/origin/state by
hand. Writes bind the typed values too. JobStoreError's Json, Uuid, Parse,
UnknownKind and InvalidTimestamp variants had no remaining constructor and
are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:48:58 -07:00
Greg ShuflinandClaude Opus 5.5 3a2bceaa8e rust: read node_document_status rows with one mapper
The four readers each read columns as strings into a tuple and rebuilt a
NodeDocumentRecord by hand; they now select the same RECORD_COLS and map
with record_from_row through the stores::sql codecs. NodeDocumentPresence
derives strum instead of its hand-written as_str/FromStr, the three mark_*
functions share one private mark, and list_nodes_for_documents goes
through query_in_chunks, so a page larger than SQLite's bound-parameter
limit no longer fails. The error enum's parse variants (InvalidTimestamp,
InvalidNodePubkey, UnknownPresence, InvalidDocumentId) had no remaining
constructor and are gone; a corrupt row now reports as a database error
whose source names what failed to parse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:44:44 -07:00
Greg ShuflinandClaude Opus 5.5 7b407db1ac rust: rusqlite codecs for the store domain types (stores/sql.rs)
ToSql/FromSql for Timestamp (written exactly as to_rfc3339(), since the
SQL compares those strings; rusqlite's chrono feature is deliberately not
used), DocumentID, VaultId, NodePubkey (hex), and the strum enums stored by
name (DocumentType, PropertyKind, ArtifactKind, EdgeKind, Provenance,
JobKind) via sql_strum_text!; a Json<T> wrapper for JSON BLOB columns; and
TextUuid for plain Uuid TEXT columns (rusqlite's uuid feature would bind a
BLOB). A column that fails to parse reports a ColumnParseError naming the
type and the text found, inside rusqlite's FromSqlConversionFailure.

placeholders() moves here from document.rs, alongside query_in_chunks,
which splits an IN (...) list across statements under SQLite's
bound-parameter limit. Stores switch over in the following commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:31:22 -07:00
Greg ShuflinandClaude Opus 5.5 f1199cdb07 rust: stamp with Timestamp::now() instead of wrapping Utc::now()
Mechanical: every Timestamp(chrono::Utc::now()) and Utc::now().into()
that produced a Timestamp in the lib now reads Timestamp::now(); three
files lose their now-unused chrono::Utc import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:18:23 -07:00
Greg ShuflinandClaude Opus 5.5 bd3e7aea7e rust: property and artifact helpers for the common write and read shapes
Adds DocumentStore::set_property (write a fresh local value, taking
anything Into<PropertyValue>), set_or_clear (write when present, else
remove_property_if_present, generalizing music's local write_or_clear) and
get_value; From impls into PropertyValue for String/&str/Vec<String>/
Timestamp/PartialDate/f64/u32/bool; strum::EnumTryAs on PropertyValue and
ArtifactValue (the two numeric PropertyValue projections are hand-written
as try_as_u32/try_as_f64 because the derive would call them try_as_u_32);
Timestamp::now(); and Artifact::with_id for derived-id artifacts, which
Artifact::new now calls. Call sites convert in the following commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:16:35 -07:00
Greg ShuflinandClaude Opus 5.5 5395a6eaba rust: build the import table's adapters with one macro
The five hand-written adapter fns that forwarded seven arguments to each
agent's importer and flattened its error to a String are now one
import_fn! macro producing a non-capturing closure, which coerces to
ImportFn in the const table. The comic directory importer already had the
right signature and goes in directly; import_comic keeps its body for the
cbr feature branch. Also folds import_tree's child_parent/next_parent
two-step and matches_path's map(..).unwrap_or(false).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:14:13 -07:00
Greg ShuflinandClaude Opus 5.5 e748381ebf rust: delete dead store and import helpers
Nine pub fns with no caller anywhere in the workspace or behind uniffi:
ArtifactStore::{artifact_bytes_per_document, blob_bytes_per_document,
count_artifacts, documents_with_unfulfilled_stubs},
DocumentStore::count_properties, JobStore::set_running,
BlobStore::wipe_all_blobs, PeerNode::first_seen_date_str,
import::all_document_extensions, plus TextFormat's unused lenient FromStr.
The doc comments that linked the deleted functions (two of them intra-doc
links that would now be broken) are reworded to stand on their own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:10:51 -07:00
Greg ShuflinandClaude Opus 5.5 18508feff0 Android: one SettingsHeading for the settings screen's group headings
Five SectionHeadings on the System settings screen repeated the same
top/bottom padding; SettingsHeading carries it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 ef89ec92d5 Android: guard the ensemble roster's three sections once
The node heading, the member list and the empty state were each wrapped
in the same screenData?.let { if (!loading && error == null) … }; one
takeIf over the three says it once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 b4d43930d1 Android: share NodeControls' compact button and outcome line
PingControl and SyncControl each spelled out the same 32dp outlined
button and the same ok-in-success-color / error-in-error-color status
pair; CompactActionButton and OutcomeText say them once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 a0ddc41077 Android: stop threading the note editor's parameters through layers
NotesContentArea took 30 parameters and passed 22 straight on to
NoteEditorPane; it now takes an editor slot and hands it the modifier
carrying the swipe/offset handling, so NotesScreen calls NoteEditorPane
directly. SplitBody likewise takes the preview as a slot instead of
PreviewBody's ten inputs, and the left and right sidebars share one
SlidingSidebar for their enter/exit animation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 2c9560328a Android: one IncomingBodyBuffer under the note and clipping editors
The note editor ran the incoming-body rule inline in NotesScreen (load
theirs, keep mine, observe, the post-save baseline) over three session
fields, while the clipping session had the same logic as methods over
three fields of its own. IncomingBodyBuffer, beside IncomingBody.alertFor,
now holds text/stored/incoming and the transitions; each session owns
one and keeps its existing names (body, text, incoming) by delegation.

Ordering is unchanged: keepLocal still moves the baseline to their
version and clears the hold before the caller asks for the write, and
the note's save gate (and so autosave/flush) still refuses the body
while a version is held. The two identical activity-scoped
rememberXSession helpers become one activityViewModel<T>().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 0f5e2c9d0f Android: derive the type ramp from Material's defaults
Type.kt restated all fifteen Material 3 styles to change four weights
and one size. It now takes Material's Typography() re-pointed at
Typeface.UI (the existing withFontFamily) and overrides only
headline*/titleLarge (SemiBold) and labelSmall (12sp). Its comment no
longer claims only used styles are overridden.

Needs a visual check: Material's default styles carry its default
lineHeightStyle/platformStyle, which the hand-built TextStyles did not,
so line metrics may shift slightly; displayLarge (unused) picks up its
-0.25sp tracking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 e7d7fcf083 Android: import types instead of writing them fully qualified
CLAUDE.md's style rule: use an import rather than a fully qualified
type in code. Covers the remaining TextOverflow, ExperimentalLayoutApi,
java.time, java.io/java.net, android.util.Log and android.graphics.Color
references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 73aa9d30d5 Android: fold document detail's repeated cards, rows and load chain
- The five Card/Column(16dp, 8dp)/SectionHeading openings become one
  DetailCard(title, trailing).
- The ID row, which re-implemented MetadataRow around a HashChip, uses
  a slot overload of it; its unused valueStyle parameter goes.
- PropertyRow and ArtifactRow share KindAndSummary (kind, modified-at,
  three-line value).
- The load chain's four sequential getOrElse { fail; return } reads are
  one ffi block on Dispatchers.IO, as are the document and descendant
  count reads that were on the main thread.
- Fully qualified TextOverflow references become an import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 b16c807e15 Android: one FilterDropdown and RemovableFilterChip on the documents list
The type and date filters were two ~45-line ExposedDropdownMenuBox +
read-only anchor blocks, each with its own expanded flag hoisted to the
screen; FilterDropdown owns its expanded state and hands its menu a
close(). The two removable chips become RemovableFilterChip, and the
set toggle written out twice becomes Set.toggle. The type and MIME
tables are read once with remember instead of a LaunchedEffect wrapped
in a try/catch around two infallible FFI calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 0074e66760 Android: route every length-capped human field through HumanTextField
Five OutlinedTextFields on the human detail screen hand-copied
HumanTextField's HUMAN_FIELD_MAX_LEN guard. HumanTextField now takes an
optional label and a modifier, so the gender freeform, fact key and
value, and contact value and label fields use it; the length cap is
written once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 b783638908 Android: drop a redundant podcast back handler and refresh flag
PodcastSearchScreen registered its own BackHandler inside a
SubAppScreen, which already has one. PodcastInfoScreen set a
shouldRefresh flag after subscribing to trigger reloadPodcasts(), which
subscribeToPodcast (and unsubscribeFromPodcast) already call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 e7d55e33f2 Android: tick playback position inside AudioPlayerManager
The music and podcast screens each ran the same while(isPlaying)
{ startPositionUpdates(); delay(1000) } loop, and startPositionUpdates
was really a one-shot refresh. The transport now starts a ticker from
onIsPlayingChanged and stops it on pause (refreshing once, so a paused
bar shows where playback stopped rather than up to a second before).
The literal log tag repeated through the file becomes a TAG constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 c381b349e4 Android: typed nav routes for Documents and Ensemble
The last two string-route graphs move to @Serializable routes like the
rest of the app: Documents' sealed DocumentsDestination (with its fully
qualified navArgument/NavType, against the style rule) and Ensemble's
EnsembleRoute. The String overload of AnimatedNavHost then has no
caller and goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 655d9442dd Android: share the initialization steps' title and ground
The four initialization screens each spelled out the same headlineLarge
centered title and the same full-screen background-plus-32dp ground;
InitTitle and Modifier.initStep say it once. The two-column mnemonic
grid walks displayLines.chunked(2) instead of indexing by twos.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 89d264718d Android: one startNodeServices, one Settings branch in MainActivity
Booting into Main and finishing initialization both started the P2P
foreground service and then scheduled background sync; startNodeServices
does both. The ENSEMBLE and SETTINGS agent branches differed only in the
initial section, so they share one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 a2661a9ec6 Android: table-drive IncomingBodyTest
Seven near-identical alertFor tests become one table of named cases,
each keeping its reasoning as a comment; the case name is the assertion
message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 b25ce77652 Android: back the PDF page cache with android.util.LruCache
The cache was a hand-rolled access-ordered LinkedHashMap with its own
eviction loop and clear(). LruCache does both; entryRemoved recycles an
evicted page's bitmap as the loop did, and evictAll() replaces clear's
recycle-then-clear.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 586f42cf44 Android: drop JobUtils aliases and PushJobRefs from the Jobs screen
JobUtils.kt was two one-line aliases of the uniffi jobKindLabel and
formatTimestamp; call them directly. PushJobRefs/asPushRefs paired each
id with its short form before building the push label, but IdRef already
takes a nullable short id. JobStatusLine's three identical
onSurfaceVariant branches collapse into the else, and the running-row
spinner is an InlineSpinner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 2fe3571081 Android: fold FlatButtonWithIcon into FlatButton, rename ui.IconButton
FlatButtonWithIcon was FlatButton with a composable icon slot and no
enabled state; FlatButton takes an optional ImageVector instead. The
start-aligned nav-row button is renamed IconRowButton so it no longer
shadows Material's IconButton (a bare glyph) in files that import both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 c560d7ce42 Android: one import path for a picked file, one import button
PdfFilePicker and ComicFilePicker were the same button with a different
MIME type, and VideoScreen inlined a third; ImportFileButton replaces
all three. importPdf, importComic, importVideo and importDocument each
resolved a name, read the bytes on IO and called a per-type import;
NativeLib.importPickedFile does it once, through the generic batch
import (Rust's SUPPORTED_FILE_TYPES dispatch) as a one-file tracked job.

Behavior differences:
- Documents' single-file import now handles every type folder import
  does (video and comics too, not just PDF/image/mp3) and names a PDF by
  its full filename like the PDF library and folder import, not its stem.
- A failed video import is now reported through the snackbar; it was
  only logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 88d54ab241 Android: one rememberReloadKey for store-change reload counters
Seven screens each held a mutableIntStateOf(0), bumped it from
OnStoreChange(DOCUMENTS), keyed their load effect on it, and pasted the
same three-line comment above it. rememberReloadKey returns that counter
(still bumpable by the screen after its own writes) with the comment
written once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 7fb3d7b59b Android: one SectionTabs for screens' own sub-view tab rows
The same TabRow + forEach(Tab) loop was written out on Jobs, document
detail, human detail, the podcast library, the media library and
Settings. SectionTabs<T> takes the entries, a label and optional icon,
and a scrollEdgePadding for the two scrollable rows.

Also fixes human detail losing its tab on rotation: it kept the section
in remember, where every other detail screen uses rememberSaveable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 1bc8665ee2 Android: one segmented picker, labeled switch and explainer text
ui/Pickers.kt adds SegmentedChoice<T> (the SingleChoiceSegmentedButtonRow
+ forEachIndexed + itemShape block written out eleven times), LabeledSwitch
(label-left/switch-right rows) and ExplainerText (the receded explainer
tone). Built on them:
- SyncOverrideControl and RemoteOverrideControl become one OverrideControl
  taking an isSelected predicate, a pending flag and an optional
  description.
- SyncPolicyControl and RemoteSyncPolicyControl share a PolicyPicker
  (name, picker, description, held/missing lines).
- The note toolbar's FormatDropdown and ReadingSurfaceDropdown share one
  CompactDropdown<T>.

The remote override's "Keep here:" caption is now bodySmall like the
local one (was labelSmall).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 79db22b02d Android: share centered empty/loading states, spinner and error card
ui/States.kt gathers the shapes screens kept re-typing: CenteredMessage
(MediaLibrary's private CenteredNote, with an optional glyph) replaces
the empty/failed panes on Jobs, the podcast queue, the document list,
new-episodes, podcast search and document detail; CenteredLoading the
four centered first-load spinners; InlineSpinner the small in-row and
in-button spinners; ErrorCard the errorContainer cards on Ensemble,
Node key and Retirement. RemoteFetchOrSpinner folds the identical
remote-fetch-or-spinner branch of the picture viewer and comic reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 4345ab7aa1 Android: share one ConfirmDialog and one InputDialog
Five hand-built confirm AlertDialogs (notes delete, human delete, job
history clear, purge, retire/reset) become ConfirmDialog, which closes
itself before running the act. Notes' InputDialog moves to ui/ with
accept/isValid/keyboardOptions, and replaces the new-person and PDF
go-to-page dialogs.

Human delete's confirm word is now error-colored like every other
destructive confirmation (it was the one exception).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 d040f6d1c4 Android: fetch shared copy once, from one SharedCopy object
The eight ui/*Copy.kt wrappers were each a remember { x() } or a plain
alias, and actions() was called ~40 times directly inside composables,
so every recomposition paid an FFI hop and an allocation for a constant.
One object with lazy vals holds each record for the process lifetime,
with one consolidated KDoc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 9c8dd927e4 Android: call stateless uniffi functions directly, not through NativeLib
NativeLib carried a wrapper for each top-level uniffi function that
needs no node (listTimezones, buildInfo, parseMarkup, renderMath, ...).
Callers now import the uniffi function; the fallible ones
(generateEnsembleKey, validatePartialDate, generateQrCodePng,
renderMath) are wrapped in ffiCatching at the call site, so their
Result handling is unchanged. The UInt/ULong conversions the wrappers
did move to the one caller each.

compileTypst, compileTypstWithFonts and notebookDefaultItemName had no
callers and go. With the wrappers gone, NoteEditorPane, TypstPreview
and MathContext no longer need a NativeLib at all, and QrCodeScreen and
GenerateEnsembleKeyScreen lose their nativeLib parameter.

Audit F18 (ffi report).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 236d717a56 Android: call uniffi handles through NativeLib.ffi, drop the *Agent layer
The 18 *Agent.kt classes (about 1,500 lines) were ~175 methods of the
form ffiCatching { nativeLib.node().podcast().x(a) }, each with a KDoc
restating the Rust doc comment that uniffi already copies into the
generated bindings. They are replaced by one member,

    internal inline fun <T> ffi(block: SyncNode.() -> T): Result<T> =
        ffiCatching { node().block() }

so a call site reads nativeLib.ffi { podcast().queueAdd(id) }. The
Result totality guarantee is unchanged: every call still goes through
ffiCatching, including the NotInitialized case.

The few methods that did more than forward stay, as small pieces:
- NativeLib.timezone()/nodeName() (log and collapse to null, 9 callers)
  and NativeLib.setLogConfig (also updates the Android log filter)
- NativeLib.beginImportBatch + BatchImport, moved to BatchImport.kt
- the one-caller "absent -> null + log" readers (comic pages/covers,
  pictures, blobs, podcast cover art, documents.get) became a generic
  Result.getOrLog(tag, what) at the call site, keeping each message;
  isBlobLocal/fetchBlobToPath/pagesNeedingPrefetch are inlined likewise
- UInt/ULong conversions and Array->List moved into the call
Call sites that used named arguments keep them, under the uniffi names.
nodeInitialized/resetNode lose their NativeLib wrappers the same way.

Not carried over, having no callers: ComicsAgent.getMetadata and
getReadingDirection, EnsembleAgent.getGossipNeighborCount,
InteractionsAgent.setAttendees, SettingsAgent.getDocumentSyncOverride.

Two small behavior differences: a call's arguments are now evaluated
inside ffiCatching (an exception while computing one becomes a failed
Result instead of propagating), and the best-effort readers log under
their caller's tag rather than "ComicsAgent" etc.

Audit F1 (android and ffi reports); the shape is recorded in the audit
handoff notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 3b02980b1e Android: drop unused Gradle dependencies
Nothing imports retrofit, okhttp's logging-interceptor, the retrofit
kotlinx-serialization converter, fragment-ktx or media3-ui (no
PlayerView, no layouts). Removed after grepping main, test and res, and
assembleDebug still builds. Version pins are left alone.

Audit F5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 49e6fa0aa4 Android: delete dead ui, init, pomodoro and document helpers
Zero callers or zero effect:
- rememberActionLabels / rememberPlaceholders (the non-composable
  actions()/placeholders() are what every site calls)
- SyncException.isVanished
- PresenceLook.ARRIVING (of() never produces it) and rowLabel
- RemoteFetch's stallHintMs()
- SynShapes.Pill
- PendingMnemonic.continueToMain, always false, and its branch
- the Pomodoro sessionsSummary alias
- PomodoroViewModel.onCleared: the ticker runs in viewModelScope, which
  cancels it anyway
- iconForDocumentType's note/notebook/collection branch, identical to
  its else
- DocumentFolderPicker's default label, equal to its one caller's
- the template ExampleUnitTest (2 + 2 = 4)

Audit F4d. Not taken: DocumentDisplayModel.size / formatDocumentSize,
which the audit called unread — VideoScreen draws it as the subtitle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 3c1d4f45a9 Android: delete dead podcast components and player calls
Zero callers: the PodcastItem and EpisodeItem composables,
Podcast.episodes (only ever emptyList(), and the reason equality had to
skip it), PodcastEpisode.isDownloaded (never set true or read),
PodcastRepository's public episodes flow, getEpisodesForPodcast and
getPodcast, and AudioPlayerManager/AgentAudioPlayer seekBackward,
seekForward and getDuration with their MILLIS_PER_SECOND.

Audit F4c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 5588ca9763 Android: delete the notes model's dead tree helpers
NotesModels.kt carried helpers from before the tree came from the store:
newId, addToCollection, removeItem, the tree renameItem, updateNoteBody,
placeholderNotebooks, and NoteBodyState.isEditable, none called anywhere
(isEditable's rule moves into the class doc). NoteItem.body was always
"" and never read. itemId() and NoteSearch's title() restated what the
sealed base can hold, so id and title are abstract there.

Audit F4b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 78147b15fd Android: open PDFs by path only, carried in a typed nav route
PdfScreen's only caller selects a PDF by path; the open-by-Uri and
open-by-bytes paths were dead: PdfRepository (PdfSource, SelectedPdf,
the StateFlow, selectPdf*/clearSelection), two of the three
PdfViewerScreen overloads, the PdfViewer(Uri) overload, and
MuPdfDocument.openFromUri/openFromBytes/getPageSize with their temp-file
cleanup. The documentId is always present too, so the viewer's
null-document branches (and the drawer's bookmarksEnabled switch) go.

The selection now travels as a @Serializable PdfViewerRoute(path, name,
documentId) instead of in a remember'd repository, which also fixes
rotating while a PDF is open: the recreated NavHost restored the viewer
route with no selection and drew nothing.

Audit F4a; fixes BUG4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 8751ffafa9 Android: keep ImportAgent.supports inside ffiCatching
supports called nativeLib.node() outside ffiCatching, so a
NotInitialized SyncException escaped as a thrown exception instead of
landing in a Result — the one import-surface call that broke the
totality guarantee. It returns Result<Boolean> now, and the folder walk
treats a failure as unsupported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 80602c5859 Android: middle-truncate a revoked node's id
Naming a node that never announced a name used nodeIdHex.take(8), an
end cut, against the rule that truncation cuts from the middle. Use the
shared shortId (the one HashChip uses) and drop the local SHORT_ID_CHARS.

Fixes audit BUG7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 b63267b56f Android: take audio focus and pause when headphones unplug
The shared ExoPlayer was built with neither audio attributes nor
becoming-noisy handling, so podcasts and music kept playing over a phone
call and out of the speaker after the headphones came out. Two builder
calls: setAudioAttributes(DEFAULT, handleAudioFocus = true) and
setHandleAudioBecomingNoisy(true).

Fixes audit BUG6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 38206bae23 Android: keep notes collections closed across store changes
The notes tree is re-read outright on every OnStoreChange (which fires on
this node's own autosave too), on every save/rename/create/delete, and
NotebookRepository builds each CollectionItem with the default
isExpanded = true. So any sync or save reopened every collection the user
had closed — rows moving under the user's finger, against the first
design principle — even though NotesScreen's comment said the sidebar
kept its expansion.

Expansion now lives in NotesScreen as a rememberSaveable set of collapsed
collection ids, passed to visibleNoteRows and the sidebar, instead of on
the model. That deletes CollectionItem.isExpanded, toggleCollection and
the notebooks.map rewrite the toggle did.

Fixes audit BUG3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 b819bd5963 Android: stop saving podcast search results across recreation
rememberSaveable held a List<PodcastSearchResult>, a kotlinx
@Serializable class that is neither Parcelable nor java.io.Serializable,
so rotating or backgrounding with results on screen crashed. The loading
flag was saveable too and could come back stuck at true after process
death. Both are plain remember now; the query and error text stay saved.

Fixes audit BUG2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 27bac60fe3 Android: show failures without uniffi's msg= prefix
uniffi renders SyncException.message as "msg=<text>", and about fifty
sites showed it.message/e.message to the user, most with a per-site
fallback string that could never fire (a SyncException always has a
message). Add Throwable.userMessage beside SyncFailures.kt's detail
(detail for a SyncException, else message, else toString) and use it
everywhere a failure reaches the screen or a log line.

The folder import in DocumentsScreen now goes through
launchReportingFailure instead of a bare launch + catch-all + showError;
the snackbar text ("Couldn't import folder: ...") is unchanged, and it
gains the shared retry policy.

Fixes audit BUG1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 cb21cadfa3 Android: ktfmt build.gradle.kts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:07:13 -07:00
Greg ShuflinandClaude Opus 5.5 188a53e6e7 p2p: drop needless borrows left in doc-sync tests
Clippy fixup for 'one ingest path for doc-sync pulls': the tests that moved
onto TestStore bind the stores by reference already.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 08:00:52 -07:00
Greg ShuflinandClaude Opus 5.5 f1fdc160e9 p2p: drop the last panics on the sync path, and fix stale protocol docs
Panics (audit B12): SyncCursor::encode swallowed an encode failure into an
empty cursor with unwrap_or_default — it now returns the error through
wire::encode; Android's DNS-over-HTTPS setup expect()ed the TLS config and
unwrap()ed two parsed socket addresses — it now reports a P2PStartError and
builds the addresses with SocketAddr::from. (That block is
target_os = "android" only and was not compiled here.)

Docs (audit B11): GATED_ALPNS carried two doc comments run together;
MembershipBatch had DocumentTombstoneBatch's doc glued on top and the latter
had none; build_membership_batch was documented as building tombstones;
node_admin claimed no membership check exists, which admission now
contradicts; the doc-sync session diagram omitted the tombstone and release
batches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:54:44 -07:00
Greg ShuflinandClaude Opus 5.5 f5e23b7505 ensemble: build roster rows with one closure keyed by NodePubkey
build_ensemble_status wrote EnsembleMemberInfo out three times (this node,
gossip peers, registry-only members) with the same revoked/held/health
lookups, and keyed the revocation map by hex String — built with a
hand-rolled fold — so health_of/held_by parsed hex back into NodePubkey per
row. Everything is keyed by NodePubkey now and one row() closure builds all
three kinds. Adds a test pinning the row order, dedup, and revoked flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:50:26 -07:00
Greg ShuflinandClaude Opus 5.5 f057182219 ensemble: one encoding for signed records, and one registration path
EpochBump and RevocationRecord each carried to_bytes/to_blob/from_blob/
from_bytes, a many-argument signing_payload, and copy_from_slice parsing.
The SignedRecord trait provides the encoding once from payload(),
signature() and from_parts(); fields are read with a small Fields reader.
Records (and DelegationCert) are now built with a placeholder signature and
signed over their own payload(), so the free signing_payload fns and their
three identical call sites per type go away. Byte layouts are unchanged.

Also: the pkarr TXT-record decode loop is written once (registry_entries);
DelegationCert::create and revocation stamps use chrono instead of
SystemTime + expect; the cert payload doc now includes the epoch (audit
B11); and create_new_ensemble/join_local share register(), which also stops
setup_default_vault_key loading the node keypair a third time (so the
never-reachable InitError::KeypairMissing is gone).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:45:33 -07:00
Greg ShuflinandClaude Opus 5.5 4fa5baa2b5 p2p: one per-peer fetch walk for document pulls and the scheduler
sync_document_assets, sync_document_asset, and the scheduler's catalog-fetch
and content passes each walked peers fetching blobs under PEER_BLOB_TIMEOUT
and artifacts under PEER_ARTIFACT_TIMEOUT, recomputing what was missing
after each peer, with the two timeouts defined twice. asset_sync's
fetch_from_peers is the one walk: it takes what is missing now plus a
closure that recomputes it, and returns received counts, peers tried, and
whether the user canceled.

A canceled blob transfer counts what completed before the stop by
recomputing against the store, exactly as sync_document_assets did (and as
sync_document_asset's one-blob special case did); the content pass, which
used to count nothing on a cancel, now gets the same accounting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:38:21 -07:00
Greg ShuflinandClaude Opus 5.5 a7bc621919 content_fetch: one peer loop, one job finish, and the local path on load_to_file
fetch_blob_bytes and write_remote_blob_to_file were the same peer loop with a
Vec or a file for a sink; stream_from_peers is the one loop, taking a sink
factory it calls afresh for each peer that has the blob (so a failed peer's
partial copy is never appended to). The two *_as_job wrappers share
finish_stream_job.

write_local_blob_to_file re-implemented BlobStore::load_to_file chunk by
chunk, re-opening and re-seeking the blob for every 64 KiB read and
reporting a read failure as 'no vault key locally' (audit B8). load_to_file
now takes an on_chunk callback that can stop the copy, and the local path is
that plus the byte tracker; its errors surface as ContentFetchError::Local,
mapped to the readers' existing BlobStore variants and at the FFI to
BlobStoreError's own classification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:33:03 -07:00
Greg ShuflinandClaude Opus 5.5 9b4a4594e1 p2p: name peers by NodePubkey, not hex strings, in every client call
fetch_blobs_from_peer, query_blob_presence, fetch_artifacts_from_peer,
open_blob_stream, the node-admin calls, and deliver_revocations took a hex
&str (or an EndpointAddr) and re-parsed it, while the push fns already took a
NodePubkey. All take NodePubkey now, and wire::open converts it to an
EndpointId once; the per-protocol InvalidTarget variants fold into
WireError::InvalidPeer (still InvalidInput at the FFI).

The peer lists follow: scheduler::peer_order_by_presence,
content_fetch::peer_candidates, asset_sync's peers, the three
ensemble_peer_ids helpers (gui, daemon, ffi) and retirement::PeerLabel hold
NodePubkeys instead of converting to hex and back, which also retires the
two parse_peer copies whose failure silently dropped possession evidence.
The uniffi-exported remote_admin fns keep their String parameter and parse
it once at the boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:26:38 -07:00
Greg ShuflinandClaude Opus 5.5 bd28fdb64b ffi: route fetch_blob_to_path through content_fetch; drop the legacy whole-blob stream
Android's fetch_blob_to_path (music playback of a track held on another node)
walked get_peer_nodes_for_ensemble unordered and unfiltered — revoked peers
included — buffered the whole ciphertext in memory via
blob_sync::stream_blob_ciphertext_from_peer, and had no job and no cancel
(audit B6). It now calls content_fetch::write_blob_to_file_as_job, the path
the PDF reader already uses: presence-ordered, revoked peers filtered,
chunked to file, as a cancelable ContentStream job. The uniffi signature is
unchanged.

stream_blob_ciphertext_from_peer, its timeout, and
BlobStore::decrypt_ciphertext had no other callers and are deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:16:28 -07:00
Greg ShuflinandClaude Opus 5.5 2a1414987a p2p: one gossip join sequence for desktop and Android
NodeRuntime::start and Android's start_p2p_node each loaded the node name,
fetched the DHT registry into the UI cache, derived bootstrap ids, joined,
and spawned the bootstrap retry loop. P2PNode::join_ensemble does all of it
from the node's own store; both callers make one call, and
join_ensemble_gossip/seed_peer_addresses become its internals.

Bug fix (audit B5): Android's copy skipped seeding persisted peer addresses
and using persisted peers as bootstrap peers, so a phone only found peers
through the DHT registry. It now gets the same persisted-peer bootstrap as
the desktop. The per-peer bootstrap info dumps collapse to one count line,
dedup is by EndpointId rather than its string, and the registry cache lock
recovers from poisoning instead of panicking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:13:40 -07:00
Greg ShuflinandClaude Opus 5.5 aa216e5a23 p2p: one routine applies signed revocations and epoch bumps
doc-sync's membership batch, revocation delivery, and gossip's two handlers
each verified records against the ensemble key, bounded the stamp with
wire_timestamp-or-now, recorded revocations, then applied bumps oldest first.
revocation_delivery::apply_signed_membership is now the one copy; it returns
per-caller counts (verified for delivery's reply, new revocations and epochs
moved for doc-sync's log), and gossip calls it with a one-element slice. The
unbelievable-stamp warning gossip had now fires on every channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:11:04 -07:00
Greg ShuflinandClaude Opus 5.5 db1e4a9012 p2p: gossip takes the Store instead of five optional stores and setters
GossipDiscovery held Option<..> handles to the peer-node, peer-health,
document, revocation and epoch stores, filled in by five setters (one
through join_ensemble_gossip's peer_node_store parameter, which both callers
filled the same way), and every handler carried a 'no store attached'
branch. It now takes Arc<Store> at construction; the handlers take the store
they need directly, and join_ensemble_gossip loses the parameter.

The announcement watch channel holds a NodeAnnouncement rather than its
serialized bytes, so update_node_name no longer deserializes it back and
drops the wrong-variant NotJoined hack; messages are serialized at broadcast
through one broadcast() helper that the three broadcast_* fns share too.
PeerMap shrinks to the replay high-water mark it actually is, and its lock
and the neighbor set recover a poisoned lock instead of panicking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:06:17 -07:00
Greg ShuflinandClaude Opus 5.5 a09f587851 p2p: one ingest path for doc-sync pulls, and pass &Store instead of its fields
The client pull and the server's reverse pull ran the same sequence — header,
membership batch, tombstones, releases, staged chunks, schema-gap record,
promote — written out twice. Both now call ingest_pull (the reverse pull
passes no resume cursor, as before, so always opens a fresh session).

promote_session, apply_records, apply_document_tombstone_batch,
build_document_record, build_header and fetch_chunk took five to nine loose
fields of one Store under three #[allow(clippy::too_many_arguments)]; they
take &Store now, and serve_pull_response builds one SyncScope and varies only
its cursor. The peer-health store was optional only so tests could pass None,
so SkewedStamps::report takes it directly. SyncRequest::full()/scoped()
replace five literal constructions. The doc-sync tests use the shared
TestStore fixture instead of hand-building four stores each.

Also drops the next_cursor.unwrap() in the serving loop (audit B12).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 07:00:11 -07:00
Greg ShuflinandClaude Opus 5.5 a97423a6b8 p2p: make doc-sync's client a plain future with a progress callback
sync_from_peer ran the exchange in a detached tokio::spawn and handed back a
channel stream whose sends ignored a closed receiver, so dropping the stream
did not cancel anything despite the doc saying it did (audit B3). The
scheduler's PEER_CATALOG_TIMEOUT, its cancel break, and asset_sync's timeouts
all returned while the sync kept running, and the next tick could start a
second concurrent sync with the same peer.

It is now an ordinary async fn returning a SyncOutcome, reporting through an
FnMut(SyncProgress) -> ControlFlow callback. Dropping or timing out the future
abandons the exchange; the callback answering Break stops it at the next
chunk with DocSyncError::Canceled, which gives the scheduler's catalog pass
and refresh_document_catalog a per-chunk cancel instead of between-peers.
Without the spawn, sync_from_peer and its callers (scheduler passes,
asset_sync's refresh/recursive/push) take &Store instead of Arc<Store>.

Behavior change on cancel: a canceled catalog sync is now an error (recorded
as Canceled on the job) rather than Ok with zero counts, so it no longer
advances the peer's last_synced_at watermark over a partial pull, and
scheduler::sync_with_peer no longer goes on to trigger the remote and run
content passes after the user canceled.

Adds a test that an abandoned staging session leaves the next sync free to
complete without its records.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 06:47:43 -07:00
Greg ShuflinandClaude Opus 5.5 96f3e36f70 rust: move duplicated test fixtures into test_support
content_ledger, scheduler and eviction each carried verbatim copies of
missing_blob_ref/attach/add_doc, reseed its own attach_blob, and retire,
retirement and scheduler wrote out the eight-field PeerNode literal five
times with its upsert transaction around it. test_support now has
add_doc, missing_blob_ref, attach_blob_ref, attach_stored_blob, peer_node
and add_peer; tests override only the fields they care about.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 06:31:19 -07:00
Greg ShuflinandClaude Opus 5.5 1b5b128850 jobs: fold the run_as_job variants and drop the watch-channel flag
- run_as_job and run_as_job_async are now the _with_progress forms with
  an op that ignores the reporter, so open_job/close_job inline away.
- JobSubject::from_key builds its parse error in one closure instead of
  seven copies.
- The cancel flag was a tokio watch channel used only as a bool: it is
  now an Arc<AtomicBool> shared by the runner's entry and the handle, and
  JobHandle.finished needs no Arc (the handle is never cloned).
- node-admin's JobRunnerCell becomes Arc<OnceLock<..>> — every modality
  wires the same runner, so first-wins is the existing behavior — which
  drops two poisoned-lock expects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 06:11:26 -07:00
Greg ShuflinandClaude Opus 5.5 e4e779550c vault: one blob cipher for sealing and opening, one HKDF helper
decrypt_blob_chunk re-derived the HKDF content key and rebuilt the cipher
for every 64 KiB chunk — 16k expansions per GB — though BlobSealer's own
doc explained why the encrypt side avoids exactly that (audit B10).
BlobSealer becomes BlobCipher with seal and open; decrypt_blob,
BlobStore::load_to_file, BlobStreamSession (which now holds a cipher
instead of vault key + hash) and content_fetch build it once per blob.

The four HKDF-SHA256-to-32-bytes copies (vault x3, Secret::to_keypair)
share hkdf32, and ChaCha20Poly1305 keys are built with the infallible
KeyInit::new from a [u8; 32], removing five expects; hkdf32 keeps the one
genuinely-infallible expansion expect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 06:06:39 -07:00
Greg ShuflinandClaude Opus 5.5 b6f71dd96d rust: shared membership, keyphrase and hex helpers
- SettingsStore::membership() replaces the
  settings_store.batch(|tx| settings_store.load_ensemble_membership(tx))
  dance at 17 call sites across lib (p2p, ensemble, scheduler, node,
  node_status, ffi).
- retire.rs's three copies of from_keyphrase -> compare pubkey ->
  WrongKeyphrase become ensemble_keypair_for().
- Hand-rolled hex loops become hex::encode (already a direct dependency),
  including BlobHash::from_blake3_hex's decode, which also stops it
  panicking on a 64-byte string containing a multi-byte character.

Short-id truncation (NodePubkey::short_hex etc.) is untouched: that is
user-visible and left for a decision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 06:00:42 -07:00
Greg ShuflinandClaude Opus 5.5 4847ff8740 p2p: skip an undecodable artifact value on fetch instead of failing
fetch_artifacts_from_peer ?'d on one ArtifactValue it could not decode,
abandoning the rest of the response — so after a new ArtifactValue
variant, a single artifact from a newer peer blocked every artifact fetch
from it. serve_push already skips such an item with a warning; the fetch
side now does the same (audit B7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 05:55:39 -07:00
Greg ShuflinandClaude Opus 5.5 66b4072a8c p2p: delete dead gossip and blob-sync code
None of these had a caller anywhere in the workspace (gui-app, daemon,
cli, tui, ffi, Kotlin):
- blob_sync::fetch_missing_blobs_from_peer (and the module doc pointing
  at it);
- GossipDiscovery::with_peer_node_store, shutdown and the event_task
  handle only shutdown read (P2PNode::shutdown goes through the router),
  plus GossipError::Shutdown;
- P2PNode::discovered_peers and GossipDiscovery::peer_map, and with them
  PeerMap::peers and DiscoveredPeer's relay_url/created_at_secs, which
  nothing but tests read. len/is_empty stay as test-only helpers;
- the empty rust/lib/src/bin directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 05:55:03 -07:00
Greg ShuflinandClaude Opus 5.5 0f608567b0 p2p: one ping exchange instead of two
P2PNode::ping and ping_via_endpoint each carried the whole PING/PONG
exchange, differing only in how the target was parsed and in the CLI's
connect hint. A free p2p::ping(ep, addr, timeout) now does the exchange;
ping_node_id parses JSON-or-id and adds its hint, ping_via_endpoint parses
a hex id. Callers are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 05:49:41 -07:00
Greg ShuflinandClaude Opus 5.5 c49d2e2d51 p2p: share blob-sync's chunk send and receive loops
Three receive loops and two send loops in blob_sync were the same code
with and without a progress tracker. send_blob/recv_blob take a
FetchTracker (untracked where nobody watches), keeping the cancel-between-
chunks behavior of the tracked paths exactly.

Sending no longer collects the chunks into a Vec to find the last one or
copies each 4 MiB chunk: BlobChunk borrows its data as a Cow. The receive
buffer's preallocation is capped at one chunk rather than trusting the
peer's claimed size. blob-stream's send loop drops the same collect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 05:48:14 -07:00
Greg ShuflinandClaude Opus 5.5 ae10b2b6d9 p2p: trim protocol-handler boilerplate
EnsembleProtocol gains an associated Error type, so each handler's serve
is its former run body and Gated converts with AcceptError::from_err —
instead of six serve shims that flattened the error to a string and lost
its source chain. The Debug supertrait is dropped (Gated prints the
handler's type name), taking eight hand-written Debug impls and six new()
constructors with it; Retiring derives Debug and uses Default.

A small Gate struct replaces the local generic gate() fn, which shrinks
P2PNode::start's 60-line router block to one line per ALPN. ClientIntent,
generic but used by artifact-sync alone, becomes a plain enum there. The
admission lint's accepted spelling follows the rename.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 05:40:07 -07:00
Greg ShuflinandClaude Opus 5.5 5463d8a6dc p2p: bound dial and admission handshake together, once
EnsembleEndpoint::connect's DIAL_TIMEOUT covered only the QUIC dial, so a
peer that completed QUIC and never answered admission hung the caller
until its own outer budget (180 s for doc-sync) — audit B4. It now bounds
dial + handshake together, which is what artifact-sync, blob-sync,
blob-stream and node-admin each re-implemented with a second 15 s (10 s)
timeout around connect. Those wrappers, their constants and the two
timeout-only _inner fns in blob_sync are gone.

Effective bounds: unchanged (15 s) for artifact/blob/stream; node-admin's
connect bound goes from 10 s to 15 s; doc-sync, revocation delivery and
ping gain a handshake bound they never had.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 05:37:14 -07:00
Greg ShuflinandClaude Opus 5.5 14be1ae21d p2p: share one wire framing module across every protocol
Seven protocols each carried an identical write_msg/read_msg pair and the
same seven transport/codec error variants. They now share p2p/wire.rs:
framing, a WireError each protocol wraps as Wire(#[from] WireError), and
open/accept helpers for the single bidirectional stream.

Fixes two bugs from the p2p audit:
- B1: the length prefix was trusted, so any peer could make us allocate
  up to 4 GiB — on admission, before its cert was checked. Frames are now
  capped (MAX_FRAME for members, 64 KiB for the handshake), and the writer
  refuses an oversized frame instead of truncating its length to u32.
- B2: rmp-serde wrote every Vec<u8> as an integer array (~1.5x for
  ciphertext). wire::encode writes bin; a unit test proves the decoder
  reads both encodings for every wire shape, so no ALPN bump is needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 05:33:24 -07:00
Greg ShuflinandClaude Opus 5.5 82a4c5a9a4 Android: fetch rustls-platform-verifier's AAR from upstream's Maven archive
The cargo update moved rustls-platform-verifier-android to 0.2, which no
longer bundles a maven/ directory for Gradle to point at, so the build could
not resolve the verifier. Upstream now publishes the AAR under org.rustls in
a Maven archive on GitHub; that repository is scoped to that one group, and
the version is read from Cargo.lock so the JVM half always matches the crate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 01:31:06 -07:00
Greg ShuflinandClaude Opus 5.5 67e1d206e0 rust: as_chunks over chunks_exact with a constant size (clippy, Rust 1.98)
Same iteration, remainder dropped as before; the chunk is now a [u8; N], so
the PDF UTF-16 decoders destructure it rather than index it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 01:09:45 -07:00
Greg ShuflinandClaude Opus 5.5 249cf90d96 gui: move gpui-ce to 17d9c8e8 (HEAD as of 2026-09-27)
HEAD renames the packages to gpui-ce and gpui_ce_platform; their lib names
are unchanged, so the dependency keys stay gpui/gpui_platform and no import
moves. It needs Rust 1.95, which the flake now provides. The one API break is
Deferred::with_priority becoming priority, with the same meaning for an
explicit value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 00:55:42 -07:00
Greg ShuflinandClaude Opus 5.5 b5eb1ea68d TODO: pkarr 8 drops the compare-and-swap the membership registry relies on
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 00:40:28 -07:00
Greg ShuflinandClaude Opus 5.5 fb23a0c532 gui: bump tree-sitter and tree-sitter-highlight to 0.27
Highlighter::highlight gained an input-encoding argument; None keeps the
UTF-8 parse it always did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 00:25:15 -07:00
Greg ShuflinandClaude Opus 5.5 8c58985e08 rust: bump uniffi to 0.32
Its Kotlin-facing breaks are UDL [ByRef] bytes arguments and async primary
constructors; this crate has no UDL and no async constructors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 00:10:40 -07:00
Greg ShuflinandClaude Opus 5.5 6e85b6b0cd rust: bump iroh-mainline-address-lookup to 0.5
pkarr stays on 5: pkarr 8 drops the compare-and-swap argument from publish,
which publish_membership relies on so two nodes registering at once don't
evict each other's registry entries. Moving to it is a design change, not a
version bump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 00:07:03 -07:00
Greg ShuflinandClaude Opus 5.5 ec927b97cd rust: bump rusqlite to 0.40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 23:59:44 -07:00
Greg ShuflinandClaude Opus 5.5 fb904219ce rust: bump the RustCrypto set (sha2, hkdf, chacha20poly1305, argon2)
aead 0.6 renames AeadInPlace to AeadInOut and deprecates Nonce::from_slice,
so nonces are built from their [u8; 12] by value. SealedName::open splits the
wire with split_first_chunk rather than a slice it then re-checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 23:49:10 -07:00
Greg ShuflinandClaude Opus 5.5 036f798b2a rust: bump rstest, dirs, lofty, base64, zip, quick-xml; drop unused fontdb
quick-xml 0.42 hands names, attribute keys and text back as str rather than
bytes, so ComicInfo.xml parsing compares against string literals now. fontdb
was declared by lib but never used, and typst still pins 0.23.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 23:42:28 -07:00
Greg ShuflinandClaude Opus 5.5 548e86eabe TODO: introduce Quint, starting with a known incremental-sync bug left in as its proof
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 23:32:32 -07:00
Greg ShuflinandClaude Opus 5.5 d370691ec7 rust: pin gpui-ce to its locked rev, and cargo update to latest compatible
The gpui-ce git dependency had no rev, so any cargo update pulled its HEAD —
which has since renamed the package to gpui-ce, and fails to resolve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 23:30:15 -07:00
Greg ShuflinandClaude Opus 5.5 f0a5968efc flake: move the Nix toolchain to Rust 1.98.1, matching rustup stable
1.92 was holding back crate updates for no reason: the native toolchain is
already on the latest stable, and gpui-ce's HEAD needs 1.95.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 23:30:15 -07:00
Greg Shuflin fcb840fdb8 Add note about tabs 2026-09-22 01:24:20 -07:00
Greg ShuflinandClaude Fable 5.1 45a625f480 Android: the PDF library reads the agent's own list
PdfLibraryScreen takes PdfFfi::list instead of the generic document
search, so each row's subtitle (page count, or when it was added) and its
availability marker come from the same Rust list the desktop draws. The
byte-size subtitle it had before was a line the desktop never showed.

Closes the TODO item; ADR 0035's consequences updated to match.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012BgxTcsGx5z4m8ftm4U489
2026-09-21 20:43:41 -07:00
Greg ShuflinandClaude Fable 5.1 d5623d2604 Android: ktfmt catch-up on two files that landed unformatted
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012BgxTcsGx5z4m8ftm4U489
2026-09-21 20:43:41 -07:00
Greg ShuflinandClaude Fable 5.1 b4f08e5a6c Desktop: the PDF library row's subtitle comes from the lib
The "Added …" derivation and the recently-added window it keyed off move
to synchronicity-lib (copy::pdf_library, agents::pdf::RECENT_WINDOW_DAYS);
the row now shows the page count when one was read at import.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012BgxTcsGx5z4m8ftm4U489
2026-09-21 20:31:33 -07:00
Greg ShuflinandClaude Fable 5.1 6299bb4af3 lib: persist a PDF's page count at import and put it on the library row
A new PdfPageCount property (U32, LastWriteWins, absent rather than 0 when
the bytes didn't parse) is written by write_pdf_properties from the same
hayro parse that already reads the title, so every import path gets it.
PdfListItem carries the count and a ready-made subtitle — the count when
there is one, else the existing "Added …" line — decided in
copy::pdf_library so the desktop and Android cannot word the row
differently. The item is now a uniffi record and PdfFfi::list hands the
whole library across, availability included.

A new PropertyKind is a sync wire change, so SYNC_PROTOCOL_VERSION bumps.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012BgxTcsGx5z4m8ftm4U489
2026-09-21 20:31:33 -07:00
Greg ShuflinandClaude Fable 5.1 ffc7269a3d Desktop: a hard clip on user text cuts from the middle too
The middle-ellipsis pass covered every .truncate() call but left the
elements that clipped with overflow_hidden + whitespace_nowrap and no
ellipsis at all. Where the text is the user's — a document title in the
screen header, a note's title in its meta row, a node name, a sidebar
row, a media-library row or breadcrumb, the track fetch line — it now
gets truncate_middle() instead of a raw cut at the right edge.

screen_title and header_crumb were flex_none, so a long document title
pushed the search field and actions off the header rather than giving
way; both now shrink (never grow) with a middle ellipsis.

Fixed-vocabulary labels — the agent rail's names, the "Video" heading,
the reading-surface picker — keep their hard clip: nothing at their end
tells two of them apart, and the rail's clip-as-it-narrows is on purpose.
The table's Auto column is sized to its content and never overflows.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 20:00:37 -07:00
Greg ShuflinandClaude Fable 5.1 50e1db1510 Android: a one-line truncation cuts from the middle
Single-line Text uses TextOverflow.MiddleEllipsis. Multi-line clamps
keep the end ellipsis: Compose only supports the middle one on a single
line. HashChip's private copy of truncate_id is replaced by the FFI
export of the shared one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-20 23:35:22 -07:00
Greg ShuflinandClaude Fable 5.1 5889b6d985 AGENTS.md: a truncation cuts from the middle
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-20 23:35:22 -07:00
Greg ShuflinandClaude Fable 5.1 2c836ab4eb Extension: ids, clipping previews and node names cut from the middle
src/elide.js restates copy::elide_middle and copy::truncate_id, which
the extension cannot call. CSS has no middle ellipsis, so a node name
is measured and fitted instead.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-20 23:25:12 -07:00
Greg ShuflinandClaude Fable 5.1 ee2acd1742 Desktop: a one-line truncation cuts from the middle
gpui's .truncate() ellipsizes the end. components::truncate adds
truncate_middle() — the same composition over text_ellipsis_middle —
and every truncating element uses it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-20 23:19:25 -07:00
Greg ShuflinandClaude Fable 5.1 5cc95b86c5 Truncation by character count cuts from the middle
An end cut drops whatever distinguishes two long strings that share a
beginning — a draft/final suffix, an episode number, the last digits of
an id. copy::elide_middle keeps both ends, and truncate_id, the FFI's
value previews, the daemon's docs-show summaries, the desktop property
table and the TUI's note tree all go through it (the TUI by columns
rather than characters). The FFI previews were byte-sliced and would
have panicked on non-ASCII text.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-20 23:18:03 -07:00
Greg ShuflinandClaude Opus 5 8bd0d74a45 A pull or push stops when the user says stop
Every surface that starts one of these had a live cancellation token
already; nothing read it. asset_sync's functions took no signal, so the
work ran to the end and the row was only recorded as Canceled.

The signal is a ProgressReporter, threaded through every asset_sync entry
point and down into blob_sync's chunk loops. It is read in four places,
which between them are what a cancel feels like: between documents in a
recursive walk (a folder of two hundred episodes is two hundred short
transfers, and that is where it pays off most), before dialing each peer,
and once per chunk in both the fetch and the push. A Canceled from a
transfer ends the whole pass rather than falling through to the next peer,
which would have made it mean "skip this node".

A stopped pull reports what it got, as a `canceled` flag beside real
counts rather than an error in place of them. Blobs that completed inside
the interrupted session are read back off the store, since the error
carries no count and a verified blob is on disk either way. The sentences
live in copy::asset_sync so all four surfaces share them — the case that
matters is a canceled pull reporting itself "up to date" over partial
counts, which is a lie about the ensemble.

Two things scoped deliberately, both written down where the code decides:

- A canceled push names no artifact count. That number is the peer's tally
  and canceling abandons the session before it arrives, so the peer keeps
  what it got but this node cannot say how much.
- The recursive walk drops the byte counters it would otherwise emit. Its
  unit is a document, and per-file bytes restart the row's counters at
  each one, drawing a bar that fills and resets — which reads as stuck.
  Counting documents properly is follow-up work; ImportCounts has the
  shape.

The blob protocol's header already carried total_bytes and a per-item
size, so the counters cost no wire change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPmrChbfTsjXLr162v18hQ
2026-09-11 04:06:08 -07:00
Greg Shuflin dd5e063271 Spelling: American, in the podcast save/drop copy 2026-09-07 00:42:38 -07:00
Greg Shuflin e52652c3a2 Android can save an episode, drop it, and play the copy
The player screen grows the same three-state control the desktop's cards
have — Save for offline / Saving… / Remove download — and episode rows
and queue rows carry the `⬇ Saved` mark beside the listen label.

The control is on the player screen rather than on every row, which is
where the desktop puts it: a phone row is ~350dp and already ends in the
queue control, so a second button would leave the title two words. This is
the same width decision as the two-column/stacked split on detail screens,
not a difference of taste — the rows still say whether an episode is
saved.

Playback opens the saved copy through `local_audio_path`, which decrypts
to a file under the app cache named after the blob's own address: a second
play finds it already there, and an episode re-saved from a publisher who
changed the file lands under a different name rather than silently serving
the old audio. Decrypting streams a chunk at a time, so a 200 MB episode
does not have to fit in memory twice on its way to ExoPlayer — which
`getBlobBytes` would have required.

A failed decrypt falls back to streaming: the enclosure is still there,
and refusing to play something because a cache write went wrong would be
the worse answer.
2026-09-07 00:42:38 -07:00
Greg Shuflin c40d80606f The desktop can save an episode, drop it, and play the copy
Episode cards and the episode screen grow one control in three states —
Save for offline / Saving… / Remove download — and a `⬇ Saved` mark that
also appears on queue rows. The mark is per node and is only ever an
addition: its absence says "not here", not "nowhere".

Saving is a tracked `Import` job keyed on the episode document, so the
click returns at once and two presses are one download. A save refused by
that dedup says so where the control is.

`episode_audio_source` is what makes any of it worth doing: every place
that hands an episode to the player now prefers the saved copy and falls
back to the enclosure URL, rather than three screens each deciding. An
episode saved and then streamed anyway is a download that cost bandwidth
and bought nothing.

`EpisodeRow` loses its derived `PartialEq`. `saved_locally` and
`saving` are facts about this disk, not about the document, and no sync
can change either — leaving them in would put a "these episodes changed
elsewhere" marker over the user's own download finishing. They are kept
fresh through `current` instead, which is allowed because a mark
changing in place moves nothing.

The episode screen also stops retyping "+ Queue"/"✓ Queued", which have
lived in `copy::podcast_queue` since the queue landed.
2026-09-07 00:42:38 -07:00
Greg Shuflin ee2a29c49f An episode can be downloaded and kept, and dropped again
The TODO's "no offline copy of an episode": playback streamed the
enclosure and nothing ever put the audio in the blob store, so an episode
could not be taken onto a plane.

`podcast::save_episode_audio` downloads the enclosure to a staging file
and seals from there. Two new `BlobStore` methods make that possible
without holding the episode in memory — `store_file` seals from a path
and `load_to_file` decrypts to one, both a 64 KiB chunk at a time. A
200 MB episode was 200 MB resident through `store`'s `&[u8]`, and the
phone is the node most likely to be asked to hold one. `store_file` reads
twice, because convergent encryption derives the content key from
`BLAKE3(plaintext)` of the whole blob — that price is paid in disk reads
rather than in memory, and a test pins the two paths to the same address.

Downloading gives the episode a document, whether or not anyone has
started listening: saving a back catalogue for a flight is something the
user has said about those episodes.

`release_episode_audio` drops the local copy, deliberately not through
`eviction`. That machinery exists to stop a user deleting the ensemble's
last copy and pays live presence queries for it; a podcast enclosure has a
copy the ensemble never controlled, at the URL on the document itself.
The two records eviction *would* have written are still written, through
its `record_local_release` — extracted here, because owing peers a
release log is not eviction's alone.

The episode document survives, and must: `Provenance::Syndicated` is
never tombstoned, since a deterministic id that has been tombstoned can
never be used again.

`saved_locally` joins the two batched projections both frontends already
read, so a list gets the mark without a query per row.
2026-09-07 00:42:38 -07:00
Greg Shuflin 86007fdd31 The Queue tab survives a trip to the player and back
`rememberSaveable` for the podcast library's tab, and the words on the
two-answer strip stop claiming only two screens draw it — the queue is the
third, over a hand-ordered list rather than a buffer, and what each of its
answers costs is different enough to say.
2026-09-07 00:42:38 -07:00
Greg Shuflin 30f3c78d9c Progress writing follows the transport, not the screen showing it
Playback outlives the screen on both modalities — Android's transport is a
`MediaSessionService` that keeps going from the notification, and the
desktop's bar sits under every tab of the Podcasts agent — but the write
loop was owned by the player screen. Leaving it flushed once and then
recorded nothing, so an hour listened from the lock screen came back as
the two minutes before the user navigated away. On the desktop it was
worse than that: the subscription hung off the podcast *detail* screen, so
an episode played from the Queue tab was never recorded at all.

Android gets a `ListenProgressRecorder` that follows the Podcasts handle
on the transport for as long as the app is alive; the player screen keeps
only the resume *read*, which is still its own (a position arriving
mid-episode must never seek under the listener). `flushListenProgress`
and the scope it needed go with it — there is nothing left to outlive.

On the desktop the same subscription moves up to `PodcastsView`, which
owns the player and lives as long as the app. The feed's remembered rate
stays with the detail screen, which is the only thing that knows which
feed it belongs to.

What is written and when is unchanged; `docs/audio-player-ui-design-\
principles.md` now says which lifetime it belongs to, since "flushed when
leaving the screen" was the line that made this look correct.
2026-09-07 00:42:38 -07:00
Greg Shuflin ccd942aad0 Android episode rows say where the listener got to
The phone already wrote the position and resumed from it; the list said
nothing, so an episode started and abandoned looked exactly like one never
opened.

A row's second line grows a third fact after its type and date — the
`DocumentDisplayModel.status` slot, null for every other kind of document,
which is most of them. The episode's words are `copy::listen_state`'s, the
same ones the desktop's cards draw, and they arrive already written on the
batched `episode_states` read the queue control was already making.
2026-09-07 00:42:38 -07:00
Greg Shuflin 06ace12d09 Android gets the play queue, and the control that fills it
`podcast_queue` — the cross-series queue the desktop has a whole tab for —
was desktop-only, which also left the phone with no way to put an episode
anywhere but straight into the player.

A Queue tab joins Subscriptions and New episodes in the podcast library,
and each episode row grows the `+ Queue` / `✓ Queued` control the
desktop's cards have. Both read their words from `copy::podcast_queue`.

The queue is ordered by hand, which makes it the sharpest case of
"a sync must never disrupt what the user is doing" on a phone: an
arriving reorder moves the row under a thumb already reaching for it. So a
re-read that differs from what is on screen is held and announced — the
same two-answer strip and the same words the desktop shows — and while it
is held the reorder controls are inert. The user's own moves apply at
once, and a write that fails re-reads the store and says so, rather than
leaving the list claiming a move the ensemble never heard.

Rows come through `episode_states`, one batched read per page rather than
one per row.
2026-09-07 00:42:38 -07:00
Greg Shuflin 4c6ad8043c One episode-list join and one set of queue words, for every frontend
The phone is about to grow a queue screen and listen state on its episode
rows, and both were about to be assembled a second time in Kotlin.

- `podcast::episode_store_state` is the batched join the desktop's
  `with_store_state` was doing by hand: derived document id, listen state
  and queue membership for a whole page of a feed, in one pass. Asking per
  row is two store round trips per episode on a list of thirty, and a sync
  re-reads the list.
- `QueuedEpisodeRow` carries the episode whole (`StoredEpisode`) rather
  than the four fields the desktop happened to draw. The queue is the one
  place an episode is reached without its feed's list in hand, so opening
  one from there has nowhere else to get its description or publish date.
  The property-reading loop it had grown is now `podcast::stored_episode`,
  shared with `list_feed_episodes`.
- `copy::listen_state::label` and `copy::podcast_queue` move the words
  out of the desktop screen: "▶ 12m left", "✓ Finished", "+ Queue",
  "✓ Queued", "Remove", and the empty-queue sentence. Two modalities
  drawing the same rows from the same synced artifact must not each spell
  them.
- The FFI grows `episode_states`, the five `queue_*` calls, the queue's
  incoming-change banner, and `podcast_queue_labels`.
2026-09-07 00:42:38 -07:00
Greg Shuflin 18341719d0 Android saves where the listener got to, and resumes from it
Android played episodes and remembered nothing. The artifact
(`ArtifactKind::ListenProgress`), the store functions, and the desktop's use of
them all existed; the phone simply had no path to them, which is also why it
created no episode documents at all once browsing a feed stopped writing them.

`ListenState` now crosses the FFI as itself — it is a three-variant enum, and a
mirror record would be a second place for those variants to disagree — under
three new `PodcastFfi` methods: `listen_state`, `save_listen_progress`,
`save_listen_finished`. All three sit on the `agents::podcast` functions the
desktop already calls, so both modalities write the same row through the same
code.

The player screen then does, in order:

- derive the episode's document id from its feed and publisher id, which writes
  nothing and works before any document exists;
- read the stored position and start playback there — read *once*, before
  playing, because a position arriving from a peer mid-episode must never seek
  under the listener;
- create the document on the first transition to playing, which is what
  "starts listening" means and the moment an episode earns a row;
- write the position every 5 seconds, and once more the instant playing stops.

Two ways this goes quietly wrong, both handled. A pause that only cancels the
write loop loses up to the interval, and pausing is how people ordinarily stop
— so stopping flushes rather than just returning. And the end of an episode
stops playback too, so the stop-flush would race the `Finished` write and could
land a position two seconds short of the end on top of it; the flush stands
down when the track ended. Leaving the screen flushes as well, on a
repository-owned scope, because playback outlives the composition and the
composition's own scope is already cancelling by then.

The write policy — every 5s, floor at 3s in, `Finished` rather than a position
at the end — is now written down in `docs/audio-player-ui-design-principles.md`
rather than decided twice. Both players' constants cite it. Android's live with
the writer in `PodcastRepository`, so the floor holds for every path that
writes a position instead of each call site remembering it.

What this does not do: the episode *list* still shows no listen state on
Android, where the desktop's rows read "12m left". And on both modalities the
write loop belongs to the player screen, not the transport, so a phone playing
from the notification after the screen closed records nothing past its parting
flush. Both are in TODO.md.
2026-09-07 00:42:38 -07:00
Greg Shuflin a4775169d9 Podcast episodes get derived ids, and a document only when there's something to store
Two changes that turn out to be one.

**Derived ids.** Episodes took fresh v4 ids and `save_feed_episodes`
deduplicated by scanning the feed's existing children for a matching
`PodcastEpisodeApiId`. That only compares against what *this* node holds,
so two nodes refreshing one feed independently created two documents per
episode and sync delivered both — the failure `docs/rss-reader.md` §3.3
exists to reject. `episode_document_id(feed, api_id)` derives the id
through `documents::derived_id`, and the dedup scan is deleted along with
`existing_episode_api_ids`.

**A document is what an episode with state looks like.** Searching a
podcast and subscribing wrote the first 50 episodes as documents, every one
of which then synced to every node. Nothing was stored *about* them:
listen position, queue membership and (eventually) downloaded audio are the
only reasons an episode needs a row. So `save_feed_episodes` becomes
`ensure_episode_document`, singular and idempotent, called at the moment
the user plays or queues an episode — not when they browse one.

The two changes are the same change: a derived id is what makes browsing
without writing possible. A row the API just returned can be asked what its
document id *would* be, so a listing carries listen state and queue
membership for episodes no node has ever written a document for, and the
document that later appears lands at exactly that id.

The list on screen is now the publisher's, from the API, with the store
layered over it — plus any episode this node holds a document for that has
since dropped off the feed's first page, which would otherwise silently
vanish. A failed fetch falls back to what is held rather than erroring, so
an offline node still reaches what it has state on.

Android loses its offline episode list and gains no writer: it saves no
listen position and has no queue, so nothing there creates an episode
document yet. `PodcastAgent.ensureEpisode` is the seam; TODO.md carries it.
2026-09-07 00:42:38 -07:00
Greg Shuflin 013c885d60 One helper computes every derived id, instead of seven near-copies
Several kinds of row here have an id that is a function of what they are
rather than a fresh v4 — a music artist from its tag, an agent's settings
row, a fact under a key — which is what lets two nodes create "the same"
thing without coordinating and converge on one row after sync.

Every one of them derived its id for itself, and while they all agreed on
UUIDv5, the particulars drifted: a namespace constant per site, three
conventions for joining key parts (`\u{1f}` in facts, `:` in anchors,
`\u{0}` in credentials), and no shared answer to whether the parts arrive
already normalized. Agreement on those particulars *is* the point — two
derivations that differ in any of them produce two ids just as surely as
two different algorithms would, and each side is internally consistent, so
nothing notices.

`documents::derived_id` is now the only place `Uuid::new_v5` is called for
a row id. A caller names a `Domain` and the parts of its key; the namespace
and separator are the helper's. Canonicalization moves in with it, as
`folded` (trim + case-fold) and `collapsed` (adds NFKC and a whitespace
squeeze), both idempotent so a caller that normalizes for its own reasons
can pass the result straight through. The `Domain` enum is the registry of
every derived id in the codebase; adding one has nowhere else to go.

Ids move, once. The project has no backwards-compatibility constraint and
key-derivation salts are explicitly in scope for breaking changes; the two
"have not moved" tests that pinned the old per-site formulas are replaced
by one pinning this one.

Also adds `Provenance::Syndicated` — deterministic id, listed, never
tombstoned — which the podcast agent needs next and no existing variant
said. `Anchor` has the same three predicate answers but means "an agent's
well-known singleton"; there is one syndicated document per item a
publisher released.
2026-09-07 00:42:38 -07:00
Greg Shuflin a78af76391 Vault: bind vault_id as AAD when wrapping a vault key
Every wrapped key in vault_keys is sealed under the same node-local wrapping
key, and the wrap used empty associated data — so a row's ciphertext was
interchangeable between vaults, and the table's primary key was the only thing
saying which vault a key belonged to. Asking for one vault's key and being
handed another's would have succeeded quietly.

Binding the id makes that fail authentication instead. It matches what every
other AEAD call site here already does: a blob chunk binds its plaintext hash
and index so it cannot be spliced elsewhere, and a sealed node name binds its
pubkey so it cannot be lifted onto another member's announcement.

This changes the wrap format, so existing vault_keys rows no longer unwrap and
an existing store fails to start with a decryption error. Acceptable per the
project's status; a store is re-initialized rather than migrated.

Found while writing docs/vault-pddb-research.md (§4F).
2026-09-01 03:40:14 -07:00
Greg Shuflin d938010159 Docs: correct the vault sections of data-model and document-sync
Four claims found while writing docs/vault-pddb-research.md, none of which the
code has supported for a while:

- Blob content encryption is built (ADR 0028), so the data model's "remaining
  step" is only Property and Artifact values. The note now says which boundary
  that leaves standing: blob bytes, and nothing else.
- document-sync said a receiver without the vault key "cannot decrypt the
  content". It cannot open blob bytes; PropertyRecord.value is MessagePack
  plaintext on the wire and in SQLite at both ends.
- It also had the default vault's UUID being HKDF-derived from the ensemble
  public key. The id is the nil UUID constant; the *key* is what is derived,
  from the ensemble secret. Id and key had been conflated.
- Vault key versioning describes machinery that does not exist — vault_keys has
  no version column and default_vault() hard-codes version 1 — so it now says so
  and points at the revocation 3c item that wants rotation first.
2026-09-01 03:29:52 -07:00
Greg Shuflin 9c083f61cc Docs: mine Xous' PDDB for the Vault design
Vaults are specified but almost entirely unbuilt, so this is the cheap moment
to read the closest prior art. docs/vault-pddb-research.md is the comparison:
what transfers (the union view and its write-target rule, enumerate-vs-unlock,
key commitment, an offline store reader), what does not (a noise-filled fixed
container, make-before-break journaling, device-bound AAD, a per-device
pepper), and the pitfalls — most of which bite harder here than they did on a
single 100MiB device, because an ensemble manufactures the disk snapshots that
deniable storage cannot survive.

Its conclusion is that a locked vault and a hidden one are different products
and only the first is reachable, so TODO.md now carries the work that implies
and docs/long-term-todo.md carries the hidden vault, its trigger, and the three
storage rules it would have to be built under.
2026-09-01 03:23:03 -07:00
Greg ShuflinandClaude Sonnet 5 15b0db7a9d Spelling: British -> American across in-app copy, docs, and code
Rewrites every British spelling found in the codebase to American: neighbour,
colour, catalogue, behaviour, honour, flavour, grey, judgement,
acknowledgement, licence, defence, organise/optimise/initialise/recognise/
analyse, artefact, cancelled/cancelling, labelled/labelling, modelled/
modelling, and centre/centred/centring all become their American forms —
consistently in prose (docs, ADRs, comments) and in identifiers, including
the FFI-shared CatalogueSync/Cancelled enum variants and catalogue_* fields
that cross the Rust/Kotlin boundary.

Left untouched: external API names that only look like a spelling variant
(kotlinx.coroutines.CancellationException/NonCancellable, Compose Material3's
labelLarge) and the EFF diceware wordlist used for key derivation.

Adds a Code Style rule to AGENTS.md/CLAUDE.md requiring American spelling in
user-facing copy and documentation going forward, with that same carve-out.

Verified: cargo build --workspace, all 1410 Rust tests, Kotlin compile,
fmt-rust/fmt-kotlin, lint-kotlin-fast (detekt), and the lint-gui-layout/
lint-sql-params/lint-p2p-admission custom checks all pass clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017fHWzCF6oNiCV4ue1bBf1t
2026-09-01 03:01:16 -07:00
Greg ShuflinandClaude Opus 5 2104fc9e62 Docs: the alert-don't-apply flow now has three callers, not one
TODO.md's clippings item is closed. ADR 0039's `NoteEditor` prediction
gets its second correction: the guard was the hard part, not the editor,
and TextArea is what a card-sized buffer with no TextFormat wants.

ADR 0031 gains an amendment for what the third caller surfaced — that the
'identical to what the editor already holds' comparison cannot live in
SyncGuarded, because the type would then have to hold a text buffer and
stop being gpui-free. Both editable-buffer callers make it before feeding
the guard, and that is a decision worth recording rather than
rediscovering. It also stops claiming Android has no equivalent: it has
the rule (ui/IncomingBody) and the shared words, just not the type.

AGENTS.md's worked examples pointed at notes/NotesScreen.kt for a symbol
that now lives in ui/IncomingBody.kt.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TsACwkLMA9MUh5bvgAnZnK
2026-08-31 20:28:51 -07:00
Greg ShuflinandClaude Opus 5 ef83ff3fe5 Clippings become editable on Android, on the same guard
ClippingEditSession is Android's half of the desktop's SyncGuarded: it
holds the open buffer, the store baseline and a version arriving from
another node, and IncomingBody.alertFor decides which reads are news and
which are this node's own save coming back. A ViewModel rather than
remember, for the reason NotesEditorSession is one — a decision that
vanishes on a rotation is not one the user was given.

The alert-don't-apply rule and its strip were the note editor's alone and
are now shared, because two screens holding whole-buffer last-write-wins
text is exactly when a rule stops belonging to one of them: IncomingBody
moves to the ui package with its test, and NoteEditorPane's private
banner becomes ui/IncomingBodyStrip taking a subject's IncomingChangeCopy.

ClippingsFfi gains update(), which the module doc used to say it would
not export; the reason it would not was the missing guard, and the guard
now has a name to point at.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TsACwkLMA9MUh5bvgAnZnK
2026-08-31 20:24:48 -07:00
Greg ShuflinandClaude Opus 5 c887ba971b Clippings become editable on the desktop, behind the sync guard
A clipping's body is LastWriteWins, so an editable buffer over one is
exactly the case CLAUDE.md's first principle is about. The screen now
opens a TextArea over one clipping at a time and holds a SyncGuarded
<String> around it: while an editor is open it re-reads that clipping on
every store change, and a body this node did not write is announced in
the card and held rather than applied. Save is inert while a version is
unresolved — the banner's Load theirs / Keep mine are the only writes
that have an answer for what they overwrite, and copy::incoming_change
gains a ClippingBody subject so they say the same thing the Notes pane
does.

An editor is on screen whether or not its row is: adopting a held list
page can push the edited clipping off the loaded rows, and a decision
with nowhere to make it is not one the user was given.

NoteEditor was the component ADR 0039 expected to reuse; TextArea is
what shipped. NoteEditor owns a whole pane (monospace, Tab-indent,
markdown list continuation) and a clipping is edited in the card it is
read in, beside a composer using the same box for the same text.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TsACwkLMA9MUh5bvgAnZnK
2026-08-31 20:09:06 -07:00
Greg Shuflin 03a1e7471f Ensemble: stop claiming per-peer reachability the mesh cannot report
The reachability matrix was recorded as blocked on data — each node
gossiping its neighbour set, every node assembling the N×N picture. The
data was never the problem. The matrix arrived as the answer to "what goes
in the rectangle where the rejected node editor was", and DIRECTION.md
§8.5 argues for it as a picture: every pair appears twice and reads the
same, "which is what co-equality looks like drawn". True, and not a
question anyone was asking the screen. It is withdrawn, not deferred.

The same defect was already shipping at 1×N. The roster read the live
gossip neighbour set per peer and drew everything outside it as Degraded —
but iroh-gossip keeps a bounded partial mesh, holding a small neighbour
set on purpose and dropping edges it does not need, so a node we could
dial in one hop showed as degraded whenever the swarm had no edge to it.
That badge reported swarm topology in the voice of connectivity.

Remove it rather than repoint it at iroh Endpoint::remote_info. The
screen already probes on demand — Ping reports a real round-trip, Sync now
reports what happened — and an on-demand probe beats a dot that is stale
the moment it is drawn. Gone with it: MemberConnectionState, the
connection_state field, P2PNode::active_neighbor_ids_hex,
GossipDiscovery::active_neighbor_ids, and the dot/glyph on all four
modalities. active_neighbors stays for neighbor_count, with a doc comment
saying why it must not be exposed per peer.

The aggregate line had the same defect and is reworded, not deleted:
"{n}/{m} other nodes reachable now" becomes "N gossip neighbour(s)", a
bring-up diagnostic that claims nothing about reachability. On the desktop
it moves from the roster header into the Membership fact grid, where a
diagnostic belongs. All three phrasings now come from
copy::ensemble_roster — the TUI already disagreed with the other two —
reaching Android through an ensemble_roster_copy FFI record.

What the badge was groping toward is a real question, and it is now in
long-term-todo.md: when this node is continuously updating a document
meant to reach the ensemble live and that stops happening, the user should
be told. That is a claim about what they are doing, not about the network,
and it cannot be designed before some agent actually pushes a live
continuous update — podcast playback position being the first candidate.
2026-08-31 17:51:04 -07:00
Greg Shuflin d9efd613d2 TODO: three items move to the long-term list, which now says why things land there
The preamble claimed the distinction was not size or difficulty. It is,
sometimes: theming, self-hostable relays and parallel asset fetch are all
deferred because the cost is out of proportion to what they buy today, or
because acting now means guessing at a design decision. Name the three
reasons an item lands here, and admit that not every entry has a crisp
trigger.

Also drops the Security section from TODO.md, which had nothing open left
in it.
2026-08-31 16:59:11 -07:00
Greg Shuflin 8d9b6a65d0 linkages: a token carries capabilities, not the whole command surface
ADR 0017 decided against capability scoping in v1 — a paired client got what a
CLI session gets — and wrote down the price as "the same blast radius as a
compromised CLI session", worth revisiting. What made it worth revisiting was
not a use case; it was reading the list next to the fact that the holder is a
browser sandbox with no filesystem access of its own. ImportFiles reads any
path the daemon's user can read, into the store where the client reads it back.
MaterializeDocument writes any path it can write. PurgeDocument destroys data
ensemble-wide. Shutdown stops the node, and was reachable because it was
handled *above* the two hand-written guards rather than below them.
CredentialCmd::{Set,Clear} rewrites the node's API keys, and simply did not
exist when those guards were written — which is the whole argument for not
doing this with guards.

So: five capabilities in stores::linkage, one per command through
DaemonCommand::required_capability. The match is exhaustive, and that is the
part worth having — a command added without deciding what it costs stops the
build instead of inheriting the last variant's reach.

Transport becomes Caller, because the question is who is asking rather than
which socket they reached: Owner is answered unconditionally (reaching a socket
inside a 0700 store directory already means being the user who owns it), Linked
carries the linkage id. One gate, before anything is done, replacing both
guards. A holder may revoke its own linkage and no other — that is the
extension's Unlink, and it needs the caller's identity rather than the
command's cost, so it lives in Caller::permits.

Credentials are NodeAdmin in full, including the read. Status carries no secret
value, so Read would be defensible, but no linkage has a use for any of it and
relaxing this later is easier than clawing it back. Linkage listing likewise:
a client knows its own, so what a listing offers is everything else the owner
has paired.

Reused from the parked linkage-security branch: the Capability enum, the
required_capability shape, the Caller/permits split, and the revoke-your-own
carve-out. Dropped from it: LinkageScope::{Companion, Full}, `pair --full`, the
stored scope column and the narrowest-reading rule for an unknown scope. The
qualm recorded in TODO.md was right — nothing wants Full. The extension's whole
vocabulary is four commands, so a two-member scope model has one real member
and one guess about linkages that do not exist yet. Policy over capabilities is
cheap to add against a second client and expensive to un-guess once it is on
every row.

The loopback tests move with the model: a paired client can no longer enumerate
linkages, and the escalation test reads the count from the store rather than
over a wire that now refuses. New tests draw one command per refused capability
rather than re-asserting the two cases that used to be special-cased.

ADR 0017 gets the amendment; TODO.md's Security section is now empty and says
so.
2026-08-31 03:32:29 -07:00
Greg Shuflin ddcc8ee021 docs: ADR 0052 — what each of the two local listeners may trust
A node answers local callers on a Unix socket and a loopback TCP port, and
"local" has been doing damage: it suggests one trust boundary where there are
three, with different populations on each side, and more than one bug here has
come from reasoning about the wrong one.

Mostly a consolidating record — permissions, Origin refusal, CORS, the pairing
challenge, hashed tokens, pairing refused over loopback all already exist, and
their reasoning was scattered across module docs and one commit message. Three
things it settles rather than restates:

- **Code running as the node's own user is not a boundary and will not be
  made one.** It can read store.db directly, and it can drive the socket's
  full surface including pairing. The loopback mitigations look like they
  should help here and do not: they defend against a caller who cannot read
  your files.
- **Offline copies are out of scope**, stated as the model rather than as an
  omission. The whole store directory is the secret; its mode is the whole of
  the at-rest story.
- **A token is not a CLI session**, which reverses ADR 0017's v1 grant
  decision. That one is a real decision and the implementation follows.

The deferred half — optional start-time password protection — moves to a new
docs/long-term-todo.md, for work where the decision to not build it has
already been taken and an entry in TODO.md would keep reading as unfinished
business. Each entry there carries what would make it worth doing; this one's
is the threat model gaining offline copies, and its note says to reach for a
keychain or TPM before a prompt, since only the headless node has no
alternative.

TODO.md loses the encrypt-at-rest item and gains a line saying where that kind
of thing goes now. The Argon2id entry stays but records that its one concrete
caller has moved.
2026-08-31 03:13:30 -07:00
Greg Shuflin ff95b9b6a3 The presence grid stops reading authorship as possession
`node_status::artifact_presence_for_node` was rewritten during revocation
phase 3a so that a remote node reads `Present` only on that node's own word
from `NodeContentStore` — an artifact's `origin_node` is the sender's
unsigned claim about a third node, and a relayed record carries a claim its
relayer never checked either. The helper grew four paragraphs saying so.

The desktop did not call it for every row. A node named as an artifact's
origin that has no `NodeDocumentRecord` gets an extra row on the grid, and
that row was assembled by hand twenty lines below the import: `Present` if
the local store held the artifact value, `Ref` otherwise. So the inference
the phase removed was still live on the one modality with a presence grid, and
still on the screen a user reads before deciding what is safe to delete
locally. Any ensemble member could put a `Present` on any node's row by
naming it as an author.

The fix is a third function beside the other two rather than a second
correction, because the failure mode here is a caller that assembles a row
itself: `artifact_presence_without_record` takes the same evidence its
siblings do and floors at `Unknown`, not `Ref` — a node with no record has
not claimed to hold the document either, so even the weak rung is unearned.
Two tests pin it, next to the ones that pin the same rule for the helper it
was supposed to mirror.

Nothing else derives a decision from `origin_node`: the daemon and the
Android FFI both go through the helper, and the TUI and CLI only print it.

With that closed, per-record signatures for provenance are settled as not
worth building, and TODO.md's item goes. The arithmetic is in
NODE_REVOCATION.md's Open Questions — briefly, 64 bytes on eight record types,
a signature column on seven tables because a signature has to survive relay,
a verification per row, and a cert to carry for an origin never met, in
exchange for three read-only surfaces and against an adversary holding one of
the user's own delegation certs. §3a records what would reopen it: any point
at which attribution stops being decoration and starts being load-bearing.
2026-08-31 00:54:26 -07:00
Greg Shuflin b3c3e440eb An ALPN's version number lives in its constant and nowhere else
Every P2P protocol's ALPN carries a version suffix, and it moves whenever the
wire shape does — this project has no backwards-compatibility constraint, so
bumps are routine. A number copied into prose is wrong from the next bump
onward and nothing fails when it rots, so seven of the eleven versioned
references in docs/ were already stale, and so were twelve of the nineteen in
doc comments.

Everything outside the constants now reads `/syn/doc-sync/…` and names the
constant for the live value. Where a bump is itself the point — a change to
what a message *means*, which is what the convention exists for — the docs
still say a bump happened, just not which number it landed on.

Three things this turned up that were not merely stale:

- `p2p/revocation_delivery.rs`'s module header called the protocol
  `/syn/revocation`. There is no such ALPN; the constant eight lines below it
  is `/syn/membership`. NODE_REVOCATION.md had copied the wrong name twice.
- `document-sync.md` carried a per-version changelog that stopped at 6 and
  skipped 4. Rewritten as what the bumps added, keeping every cross-reference
  and dropping the numbering that rots.
- ADR 0014's title named `/syn/node-admin/1` in the heading and in the index
  row, two bumps ago. The ADR number and filename are unchanged, so links
  still resolve.

AGENTS.md gets the rule, since this is the second time it has been cleaned up
and nothing was stopping it coming back.
2026-08-31 00:32:17 -07:00
Greg Shuflin f4afbbaa31 TODO: membership epochs are built, and two smaller items closed
An audit of TODO.md against the tree. Three entries described work that has
since landed:

- Revocation phase 3b. `ensemble::epoch`, `stores::epoch`, the admission
  check in both directions, gossip carriage and `retire::{bump_epoch,
  recertify}` are all in. What is actually left is the affordance — only the
  CLI and daemon can bump or rejoin, and no other modality even renders
  `current_epoch`/`this_node_epoch_is_stale` — plus 3c and 3d.
- The browser extension's store icons exist and `just extension build`
  packages a zip; Firefox signing is the remainder.
- PDF deep zoom no longer upscales a fit-resolution bitmap on either
  modality — both re-render at the active scale. What survives is the 4096px
  raster cap, past which it softens again, and only tiles lift that.

Everything else in the file was checked against the code and still stands,
including the ones that read as if they might not: the TUI's `i: import`
imports a revocation record rather than files, `JobOrigin::RemoteAdmin` is a
variant nothing constructs, and `linkage-security` is still a branch on
origin.

The same drift had reached the prose each of those entries sends you to, so
it is fixed here too:

- `NODE_REVOCATION.md` said phase 3 was design; its Status, its §3 preamble
  and its §3b heading move with 3b.
- `content-placement-redesign.md`'s header said steps 3-7 were unbuilt while
  §4 of the same file marked all seven done.
- `sync-management.md`'s summary table still described `SyncPolicy` as
  consumed by nothing, `SyncDisposition` as a store awaiting a caller (it is
  deleted), and Delete Locally, the imports surface and blob streaming as
  placeholders. Rewritten against the code, and pointed at the phasing
  section at the end, which had stayed current and is the better authority.
- `scheduler::mod` and `gui-app`'s `scheduler_driver` both said Android had
  no driver and no Wi-Fi/charging constraint, and sent the reader to a
  TODO.md entry that no longer exists. Android has `SchedulerWorker`, a
  `WorkManager` job that lets the platform enforce exactly those, and
  `syn-daemon` has a third driver neither comment knew about. The scope note
  now says what it was always getting at: the constraint belongs to the
  driver, not to `lib`. `SchedulerWorker`'s own dangling pointer to that
  TODO entry goes with it.
2026-08-31 00:09:53 -07:00
Greg Shuflin 58de31334a peer_health kind two: the peer is on a newer build than this node
decode_records_tolerantly drops any record whose bytes this build cannot
deserialize — an enum variant from a peer on a newer SYNC_PROTOCOL_VERSION —
and until now said so only in a WARN plus a transient clause on the Ensemble
row's Sync button. The scheduler's unattended passes, which is where most
syncs happen, reported it nowhere at all: a phone one build ahead of a laptop
loses documents on every tick and the roster stays silent. That is the same
argument that justified peer_health for clock skew.

PeerHealthDetail::SchemaAhead { peer_version, records_skipped }, written by
record_schema_gap from both ingest sites — the client pull and the server's
reverse pull — so a gap does not depend on which node started the sync.

Unlike clock skew this needs one writer, not two. The header carrying the
peer's version opens every exchange whether or not the batch behind it turns
out to cost anything, so it is the announcement's counterpart: it decides
whether there is a row, and parity clears it. The skip count only enriches it,
and is carried forward across a clean incremental batch so the message does not
flip back to "nothing has been lost yet" while the gap is still open. A skip
from a peer on the *same* revision is corrupt bytes rather than a version gap,
raises no row, and keeps the WARN.

The copy's job is direction. Every other message in copy::peer_health sits on
a row naming another node and is about that node; this is the one where the
device to go and fix is the one being read, so it says so twice — "Running a
newer version than this node", and UPDATE_THIS_NODE spelling out that nothing
needs to change on the other device. It also quotes both revisions and, when
records were actually dropped, asks for a manual sync as well: the automatic
one only carries what changed since it last ran, so updating alone will not
bring back records it has already walked past. The old WARN promised otherwise.

No UI on any of the four modalities, as the store's docs claimed: every
frontend renders through copy::peer_health rather than matching the enum.
2026-08-30 23:13:08 -07:00
Greg Shuflin dc3fc2edaf Clock-skew reconciliation is closed: dropped writes stay the sender's problem
The two open questions on the wire-time bound are both decided as "no".

A record the bound refuses is dropped and not queued. Retransmission belongs
to the sender — the node with the wrong clock is the only one that can make
its own records believable — and a queue here would hold data this node has
already said it does not believe, re-adjudicated against a bound that moves
with the wall clock. The reasoning moves into wire_time's module docs, beside
the drop-vs-clamp decision it sits next to.

Persisting announcement recency across restarts is dropped outright; its
reasoning was already written out at PeerMap::upsert, so the TODO entry was
only a second copy.

Both TODO sections go, rather than becoming Done write-ups.
2026-08-30 23:13:08 -07:00
Greg Shuflin d1c42774e4 Settings' tab row scrolls instead of squeezing
A fixed TabRow divides the width evenly among its tabs, so the fourth section
turned "Sync policy" into two lines — and every section added after this one
would have made it worse. SecondaryScrollableTabRow sizes each tab to its own
content and scrolls the row, which is the case Material 3 names as the reason
to pick it over a fixed row.

edgePadding = 0 so the first tab lines up with the rest of the screen; the
default inset reads as an indent rather than as a row that scrolls. maxLines =
1 on the label so a tab that somehow still runs long elides rather than
silently reintroducing the wrap this removes.

No arrow affordances: on a touch surface the indication is the next tab
showing past the edge and a swipe. Arrows are a pointer-device pattern, and
buttons at both ends would spend the width this exists to reclaim.
2026-08-30 21:39:00 -07:00
Greg Shuflin 4b473c3bf5 Clippings page as they are scrolled, on both modalities
ADR 0039 left two open items — an unpaginated `list_children`, and a "Load
more" that both screens capped around instead of implementing. They were one
problem: the cap was what kept a plain row loop inside ADR 0037's rule, and
removing it is what makes the collection genuinely unbounded on screen.

The read: DocumentStore::list_children_page takes the DocumentCursor the
document listing already uses and the same (created_at DESC, id DESC) ordering,
so paging documents and paging one document's children mean the same thing. The
type filter is in SQL, so `limit` counts rows *returned* rather than rows read
— a page of two clippings, not two children some of which are clippings. A new
(parent_id, created_at, id) index serves it; the existing parent_id index finds
a parent's rows and then sorts all of them, which for the Clippings root is the
whole cost this removes. Newest first, unlike list_children, because paging a
growing collection from the oldest end puts every arrival on a page nobody has
loaded.

The desktop: gpui::list rather than uniform_list, because these rows are
variable by design — a clipping is clamped until it is clicked, then as tall as
its text — and uniform_list gives every row row 0's height. That costs three
obligations, all of them in the code: expanding a row calls remeasure_items
rather than reset, which would send the user to the top for having clicked
something; an appended page is a splice at the end, so nothing above it moves;
a delete is a reset, because the row measured at index n is no longer the row
there. The error line, composer and changed-elsewhere marker moved outside the
list, since a virtualized list addresses items by index and three
sometimes-present things at the front would make every row's index depend on
how many are showing.

Both screens fetch ahead of the edge on scroll rather than behind a button: a
list of clippings is scanned, and stopping to click every hundred rows is worse
than the wait it avoids. settled() now reads the list's own scroll top, so a
user who has paged down cannot have rows replaced under them.

Android's held-page strip now carries the whole page rather than its rows:
showing it re-anchors on the first page, and the cursor that follows the *held*
page is the one paging has to resume from — keeping only the rows left the
cursor pointing past a page no longer loaded.

ADR 0037 gains a `gpui — list` section: it presented uniform_list as the gpui
answer, and that is no longer true. It also gains the consequence this taught —
a cap is not virtualization, only a deferral of it, and the day the cap lifts is
the day the real idiom is owed.
2026-08-30 21:34:46 -07:00
Greg Shuflin 0cf915f0a7 The Podcast Index key leaves the source entirely
It survived ADR 0051 as two #[cfg(test)] constants, on the reasoning that the
live-API test needed something to authenticate with. That reasoning is wrong
twice: a key in a public repository is published the moment it is committed
however it is gated, and a test path that quietly supplies one hides that the
production path is unconfigured.

What replaces it is one mechanism with one set of names.
credentials::env_var_for derives SYN_CREDENTIAL_<SERVICE>_<FIELD> from the
service and field, so a new ServiceId variant or a new field needs no second
table; import_from_env seals whatever the environment supplies, skipping a
blank or unset variable rather than storing an empty secret — half an
environment fills in half a credential instead of wiping the other half.

"syn settings credential-import <SERVICE>" provisions a store from those
variables in one non-interactive command, with nothing in shell history. It
reads the environment CLI-side and sends one Set per field rather than adding
an Import the daemon resolves: the daemon is a different process with a
different environment, so a daemon-side Import would consult the wrong one —
silently, and differently depending on whether a daemon happened to be up.

The live-API test calls import_from_env and returns early with the variable
names printed when nothing is set, so a checkout that cannot be expected to
carry a key does not fail over one. Verified both branches: it skips with an
empty environment, and passes against the real API with the key supplied.

import_from_env delegates to a private import_from taking the lookup as an
argument, so the four rules in that loop are tested without mutating a
process-global that the developer's own shell also writes to.

The key still needs rotating at the provider; TODO.md and ADR 0051 say so, and
now also say where a test gets one from.
2026-08-30 21:13:24 -07:00
Greg Shuflin 7411358675 docs: ADR 0051 is Accepted, and 0039 gets the name its agent already has
0051: the store shipped, and so did the surfaces the design deliberately left
open. Adds "What the surfaces settled" rather than editing the deferral out of
the Consequences, because the placement was a decision and not a detail of
drawing: its own Settings tab rather than a block under System (it is the one
place in Settings where the input is a secret, and it grows per service), a
section per service rather than one listing them all, and both screens building
their inputs from ServiceId::fields so no frontend knows what a credential is
made of. The two copy constants that followed are recorded with the reason each
exists.

0039: 5a97bd2b renamed the Snippets agent to Clippings — the AgentId, the
DocumentType, the settings pointer, the daemon command, both screens — and left
the ADR describing all of them by the old name, along with the four other ADRs
that reference it. Renamed throughout, file included, with a dated note at the
top saying what it was called and that the rename changed no decision in it. A
design record nobody can grep for is a design record nobody reads.

Its last consequence was stale on substance too: it expected NoteEditor to be
reused unchanged, and what shipped is read-only on both modalities because an
editable buffer a sync can land on needs SyncGuarded built around it first.
Recorded as what was expected and what happened, since the reason is the
useful part.

0050 is deliberately untouched: it is the ADR that *proposed* the rename, so
its `Snippet` is the pre-rename name on purpose.
2026-08-30 21:13:24 -07:00
Greg Shuflin bc51f10b9f Credentials section sits in the same shell as its sibling tabs
It rendered a bare Column while Sync policy and Ensemble each wrap in
SubAppScreen, so it was the one section in the tab row with no title and no way
back. Same shell, titled with copy::credentials::TAB.

Its save loop was a firstNotNullOfOrNull over the filled fields, which reads as
a search and is really a write with a short-circuit; spelled out as a loop that
stops at the first failure, so the message on screen is the one that happened.
2026-08-30 20:46:53 -07:00
Greg Shuflin b5d3a0490b Credentials becomes its own Settings tab, on both modalities
The service-credential store already codifies what a credential is: ServiceId
is a closed enum with Podcast Index as its variant, and ServiceId::fields says
what parts it is made of. What was missing was a place to type one in that
isn't a block near the bottom of System, and any way at all to do it from a
phone.

Desktop: Tab::Credentials, one section per service rather than one section
holding them all — a service is what the user came here for, and its own
heading is what tells them which service the two fields below belong to.

Android: CredentialsFfi (services/set_field/clear) and a Credentials section in
the settings tab row. The form is built from ServiceId::fields, so nothing in
Kotlin knows Podcast Index takes a key and a secret; the next service is a Rust
variant and no frontend work. Nothing reads a stored secret back, here as on
the desktop — the status line answers the only question a settings screen has.

copy::credentials gains TAB (the strip wants the short word) and WHERE, so the
sentence a feature shows when a key is missing names one path rather than each
surface inventing one; unavailable() now sends people to "Settings ▸
Credentials" instead of to a heading that is no longer where they'd look.
2026-08-30 20:42:01 -07:00
Greg Shuflin 4b8a74ed5d Clippings on Android
TODO.md's "Nothing on Android": clippings have synced to the phone since ADR
0039 and there was no screen to see them on, only a placeholder saying so.

Adds ClippingsFfi (list/get/capture/delete) over the existing ClippingsManager,
a ClippingItem record, and the Compose screen. Deliberately the same screen as
the desktop's rather than a phone-shaped reinterpretation: same order, same row
(the clipping itself, not a title of it — the title *is* its first line), and
the same read-only stance on existing clippings, whose bodies are
last-write-wins and would need the alert-don't-apply flow before an editor is
honest. No update crosses the FFI for that reason.

Arrivals follow the same rule as the desktop: applied when the user is plainly
idle (nothing expanded, no composer open, list at the top), held behind a
ChangedElsewhereStrip otherwise. That strip's button now reads action::SHOW
rather than a Kotlin literal, so it says what the desktop's says.

AgentPlaceholderScreen goes with it — it existed for this one agent, its doc
comment says so, and every agent Android lists now routes to a real screen.

(PodcastAgent.kt is ktfmt reflowing a comment the previous commit left long.)
2026-08-30 20:31:20 -07:00
Greg Shuflin bc7d17323d copy::clippings, before a second modality retypes it
The Clippings screen's words lived in the gpui screen: its heading, its empty
state, the source line, the held-back-arrivals marker, and both of its error
sentences. Android is about to render the same list, which is the moment
CLAUDE.md's rule bites — a paraphrase between two screens is two answers to one
question, invisible until someone opens both.

Moves them to copy::clippings, with source_line's test, and adds derivations
for the two lines that depend on state: pending(n) for the marker's count and
body_elsewhere for a clipping whose text is still on another node.

action::SHOW joins them: the button on every changed-elsewhere marker, which
the desktop and Android's ChangedElsewhereStrip had each typed for themselves.
2026-08-30 20:20:52 -07:00
Greg Shuflin 3b194a1a6a Cap Settings' explanatory prose at a reading measure
The Settings tabs already cap their body at CONTENT_MAX_WIDTH (1040px), which
keeps a label/value row's two ends associated. That is the wrong cap for a
sentence: at font::BODY a 1040px line runs about 150 characters, twice the
45-75 typography settled on, and the eye loses the line on the return sweep.

Adds sizing::layout::PROSE_MAX_WIDTH (560px) and applies it inside
section_description, so every tab's explainer gets it without each one
remembering to. section_description now takes any string rather than a
&'static str, which lets the credential-removal confirmation — a sentence built
at runtime, previously a hand-rolled div — be styled by the same helper instead
of drifting from it.
2026-08-30 20:10:14 -07:00
Greg Shuflin 5e7374edda new test ensemble key 2026-08-30 19:53:28 -07:00
Greg Shuflin a00ad94a30 Copy strings carried their own source indentation into the sentence
Five strings in copy.rs were written across source lines without the \
continuation, so the leading whitespace of the next source line landed in the
string. The Service credentials explainer was the visible one: it rendered as
"...They are stored          encrypted and sync..." with a gap mid-paragraph
on the Settings screen.

Adds a test that scans copy.rs's own text for a run of spaces inside any string
literal — it covers the ones inside a format! that no test calls, and the slip
is otherwise invisible to rustfmt, clippy and review.
2026-08-30 19:51:22 -07:00
Greg Shuflin 3dcbb1375c Service credentials: a sealed store, with Podcast Index as its first tenant
Implements ADR 0051. A `ServiceCredential` document per service, id derived
from the service, `Provenance::Machinery` so it is hidden from every listing and
never purgeable. Each field of a credential is an `ArtifactKind::SealedSecret`
whose row id derives from `(service, field)`, so re-entering a key overwrites
that field and two nodes given the same key converge on one row.

Values are sealed with the ensemble's vault key via `vault::encrypt_blob`, which
takes arbitrary bytes and is not tied to the blob store. This is the first
inline artifact that is not readable in the database — every display path
(`ffi::helpers`, the daemon's artifact listing, the GUI's document detail) shows
"(sealed)" rather than a value or a length, and a test asserts the plaintext is
not in the stored bytes.

Podcast Index moves onto it. The two constants are gone from the non-test path;
`search_podcasts` and `get_podcast_episodes` take a store and resolve the key
through it, which turned them into methods on `PodcastFfi` since a free FFI
function has no store to reach. The published key survives under `#[cfg(test)]`
solely so the network tests can provision a store with it — deliberately not a
fallback, so a node with no credential is told so rather than silently borrowing
a key the app shipped. It is in this repository's public history and needs
rotating at the provider.

UI: a System-tab section (enter a field, Save, Remove behind a confirmation with
a Cancel), and `syn settings credentials` / `credential-set` / `credential-clear`
— the latter reading the value from stdin when omitted, so a key need not land
in shell history. A credential is never readable over the daemon protocol, only
its status: a linked extension reaches the whole command surface (ADR 0017), so
a Get would hand every paired client every key the user holds.

Wire version 19: three new closed-enum variants.

Not verified here: the Kotlin changes (PodcastAgent gains search/fetchEpisodes,
mirroring the Rust move). This machine has no Android toolchain, so
`just lint-kotlin-fast` could not run.
2026-08-30 19:22:14 -07:00
Greg Shuflin b416121b58 docs: ADR 0051 — service credentials as sealed documents on the catalogue plane
Design for the store ADR 0050 depends on. A credential is a document
(ServiceCredential, Provenance::Machinery, id derived from the service) because
the document plane is the only thing that syncs, and syncing is a hard
requirement: an outbound effect runs on whichever node is awake, so a key
reachable only where it was typed works by luck. Machinery already means hidden,
non-purgeable and deterministically identified — four wanted properties, none
unwanted.

Keyed by service rather than by agent: the near-miss is an AgentSettings
document, but a credential is not agent state, and keying by agent gives one key
per (agent, service) pair silently duplicated.

Sealed inline with the vault key rather than blob-backed, even though the blob
store is already encrypted: blob content is the content plane, legitimately
absent on a node that has not fetched it, and a credential missing on the node
that happens to be awake is the exact failure this prevents.

States two things rather than leaving them to be found: convergent encryption
means equal values have equal ciphertext, and the existing hardcoded Podcast
Index key is in a public repository's history, so removing it from source does
not un-publish it — it needs rotating at the provider.
2026-08-30 19:22:14 -07:00
Greg Shuflin 5a97bd2b6b Rename the Snippets agent to Clippings, and its document type to Clipping
`agents/snippets.rs`'s own module documentation already said "clippings"
throughout while the type said `Snippet` — the codebase reporting that it picked
the wrong name the first time. "Snippet" reads as text-only, and ADR 0050 widens
the charter to posts and images, so the word has to cover more than text.

`AgentId::Snippets` -> `Clippings`, `DocumentType::Snippet` -> `Clipping`,
`PropertyKind::SnippetsDefaultRoot` -> `ClippingsDefaultRoot`, and the manager,
error, daemon command, CLI subcommand, GUI screen, browser-extension wire keys
and Android agent mapping with them. Both enums cross the sync wire, so
SYNC_PROTOCOL_VERSION goes to 18 and the fingerprint test's expected lists are
re-sorted — that test caught the omission rather than review doing it.

Done now rather than with the feature: this is cheapest while the agent owns one
type and one screen, and every modality added makes it dearer.

Uses of "snippet" that are not about this agent — a markdown snippet in the
markup golden tests, a rendered math snippet, a keyword-bearing code snippet in
the syntax-highlight fixtures — are left alone.
2026-08-30 19:22:14 -07:00
Greg Shuflin 7b36f8fd57 docs: ADR 0049 is Accepted — parentage stays a field, and its merge rule shipped
The decision has been in force since it was written and the work it named as
outstanding landed the same day, so Proposed no longer describes it. The ADR
README says this flips in place. Also corrects one stale line: the topological
pass is still necessary, but it lives in stores now rather than doc_sync.
2026-08-30 19:22:14 -07:00
Greg Shuflin d228f08297 docs: the identity helper is a consolidation, and credentials do not live with the node secret
Two notes from reviewing what already exists.

The podcast agent is the counter-example to the shared identity function, not a
partial solution: it derives nothing, and save_feed_episodes dedups by scanning
a feed's existing children for a matching PodcastEpisodeApiId — which only
compares against what the local node holds, so two nodes refreshing one feed
produce two documents per episode and sync delivers both. Six UUIDv5-from-a-key
derivations already exist independently across music, agent settings, anchors,
facts, edges and the podcast queue; the helper ADR 0050 needs is a consolidation
of those, with podcast episodes moved onto it.

And the credential store does not belong in or beside the `secrets` table: a
node secret is one row, never leaves the device, and losing it means the node is
gone, while a service credential is the user's, travels to every node, and costs
a re-paste. The `CHECK (id = 1)` that is right for one is exactly wrong for the
other.
2026-08-30 19:22:14 -07:00
Greg Shuflin fb93cff4ad docs: ADR 0050 — captured posts, and a note for the credential store they need
A saved microblog post gets its own DocumentType rather than being a Snippet
with a URL, on ADR 0039's own test: two timestamps (posted vs captured),
identity that has to converge when two nodes save the same post, blob-backed
media that only a type can carry a sync policy for, and an author that
documents::contact can already canonicalize.

The agent's charter widens to cover text, posts and images, and it is renamed
Clippings — agents/snippets.rs's module docs already said 'clippings' throughout
while the type said Snippet, which is the codebase reporting it picked the wrong
name first time. Cheapest to fix now, while it owns one type and one screen.

Also decides: the post id function is shared with the future Feeds agent from
the start, canonicalization included, so a saved post and a timeline item are
one document rather than two with independent state; media are Attachment
artifacts, not child Image documents (the comics precedent rejected on purpose);
threading is facts holding uris; an image captured on its own is an Image
document with a SourceUrl, closing a gap ADR 0039 named.

TODO gains the credential store ADR 0050 depends on and does not design — with
the constraints it inherits, and the hardcoded Podcast Index key as its
acceptance test.
2026-08-30 19:22:14 -07:00
Greg Shuflin 20765adcf4 stores: the parents-before-children ordering rule moves to the schema that requires it
topological_sort_records existed in p2p::doc_sync because a batch of incoming
records has to be ordered before insert — but the reason it has to be is the
documents.parent_id foreign key, which is the store's fact, not the protocol's.
A caller that rediscovers it does so from an FK violation.

stores::document::parents_before_children now owns the ordering. It is generic
over the item and its key, so the store never learns what a DocumentRecord is;
doc_sync keeps a three-line topological_sort_records that says only how a wire
record answers 'what is your id, and your parent's'. It takes no transaction
and reads nothing: the schema's rule, not a query.

Unorderable rows — a cycle, or a parent that is nowhere — are still kept and
appended last rather than dropped, now stated as a decision: ordering a batch
is this function's job, and declining to insert a row is the caller's. The
existing doc-sync sort tests pass unchanged; three more cover the tail case
they never reached.
2026-08-30 19:22:14 -07:00
Greg Shuflin 26c6766b22 stores: own the schema outright — no in-place patches, no SQL outside stores/
Three related moves, all in the same direction: the store layer is the only
thing that knows what the database looks like.

Removes every in-place schema patch. Until there is an explicit migration
system, the schema is created once on a fresh store and never touched again:
gone are add_provenance_column, add_parent_modified_at_column,
backfill_set_elements, rebuild_stale_edges_table (which sniffed sqlite_master
for a substring before dropping a table), peer_nodes' error-swallowing
'let _ = ALTER TABLE', and node_content_status' node_blob_status fold-and-drop.
cert_fingerprint moves into peer_nodes' CREATE TABLE, and the DEFAULTs on
provenance and parent_modified_at go with the ALTERs that needed them — a
NOT NULL with no default is the honest declaration when every insert supplies
the column.

Moves reseed's GRAPH_TABLE_COLUMNS and its bulk copy into stores::graph_copy as
Store::copy_graph_tables_from, with the schema-coverage test. reseed.rs now
holds no SQL at all and no longer imports rusqlite.

Parameterizes title_kind_case_sql. The type and kind names are this crate's own
&'static strs on closed enums, so the previous sql-literal-ok waiver was sound
in the narrow sense — but a CASE arm does take a ?, and the waiver was the only
place a value reached SQL as text. The three callers now thread its binds in at
the fragment's own position.
2026-08-30 19:22:14 -07:00
Greg ShuflinandClaude Opus 5 2f3526ce56 syn-daemon: the envelope test asserts key sets, not key order
the_raw_value_envelope_is_the_same_json_in_a_different_key_order passed under
just unit-tests-rust and cargo test -p syn-daemon but failed under cargo test
--workspace. It asserted that routing a body through serde_json::to_value
alphabetizes the object's keys, which holds only while serde_json's
preserve_order feature is off.

That feature is not ours to set. gpui enables it, so cargo's feature
unification decides it per build graph rather than per crate: off for the
recipe, whose default-members excludes gui-app, and on for --workspace, which
pulls gui-app in. A per-crate opt-out is not available, and dropping the
dependency would mean patching gpui.

Nothing on this wire depends on the ordering either way. Both readers -- the
browser extension and humans running curl -- look fields up by name, artifacts
serialize typed enums in declaration order, and every signature in the project
is taken over a hand-built byte payload rather than over serialized JSON. So
the test now compares the parsed trees and the key sets at both levels, which
is what the byte comparison was really protecting, and names the body's three
keys so a field that goes missing or arrives renamed is still caught. Under
preserve_order the two encodings are in fact byte-identical, so the old
assertion could not have been rewritten to hold in both directions.

Keeping the feature off leaves --workspace as a canary for order-dependence
creeping in elsewhere -- worth more than pinning an order here for a difference
that is not a contract. The reasoning moves from TODO.md into the test's doc
comment, where whoever is debugging the failure will actually meet it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CMAMMoRBw7j1tLfCHH1HUv
2026-08-30 19:21:47 -07:00
Greg Shuflin 5513b66cc7 TODO.md vault note 2026-08-30 05:38:58 -07:00
Greg Shuflin 7475e52aa4 docs: record the parentage merge landing in ADR 0049, and what is left in TODO 2026-08-30 03:41:32 -07:00
Greg Shuflin 66f47504c4 documents: parentage merges last-write-wins, and a move can no longer make a cycle
A document's structural fields were write-once: doc_sync inserts a row only
when it is absent and never updates one, so DocumentStore::set_parent wrote
locally and the ensemble never learned. NotebookManager::move_item moved a note
on the node the user was sitting at and nowhere else.

Adds documents.parent_modified_at — the one merge stamp on the document row —
and sync_receive_parent, which reconciles a peer's move last-write-wins. It
declines three ways, none an error: our stamp is newer, the destination has not
synced to us yet (applying would break the parent_id FK; our older stamp means
the move is re-offered later), or the move would close a cycle.

set_parent now refuses a move into the document's own descendant outright,
which is the case a single node can decide. Two nodes making moves that are
only a cycle together cannot be decided locally, so the merge path refuses to
store it and says so in the log; converging that properly wants a move log with
undo/redo by timestamp, which this deliberately does not build.

Also fixes a bug this surfaced: reseed's GRAPH_TABLE_COLUMNS never listed
provenance, so every reseed silently downgraded anchor, derived and machinery
documents to user. A new test compares the list against the live schema so the
next missing column fails rather than defaulting.
2026-08-30 03:41:32 -07:00
Greg Shuflin 47532ce30b docs: ADR 0049 — parentage stays a field on the document; edges are for facts
Records the decision not to replace documents.parent_id with an
EdgeKind::ParentChild, and the test meant to outlive the question: if the link
were lost, would you have lost a fact or would you have a broken document?
Facts are edges, structure is a field. Every existing EdgeKind passes it —
the two that are structural (ArtistAlbum, AlbumTrack) have Derived endpoints,
so their loss is bounded by a rebuild.

Notes honestly what the rejected option would have supplied for free: parent_id
has no merge rule at all. doc_sync inserts a document row only when absent, so
a document's structural fields are write-once and set_parent never propagates —
NotebookManager::move_item moves a note locally and the ensemble never learns.
Also names that nothing enforces acyclicity on set_parent. Both are now the
outstanding work this decision inherits.
2026-08-30 03:41:32 -07:00
Greg Shuflin c43982c1a7 docs: ADRs 0047 and 0048 — constituent documents, and blobs shared by several documents
0047 proposes a fifth Provenance variant, Part, for a document that is a
constituent of another rather than a thing in its own right (a comic page,
media attached to a captured post). Hidden from search and general listings by
default, revealed by an include_parts flag of its own — not by the type-naming
override, since Image is a mixed type. Rejects agent ownership (an opinion, not
a fact; fails the many-to-many case ADR 0025 treats as normal) and a parent-type
test (is_container() is {Collection, Notebook}, so it would hide every podcast
episode).

0048 states the rule for content two documents reference: liveness is a
reference count over live artifacts, bytes are deletable only when nothing
local still wants them, and every figure that promises space is deduplicated by
hash. Adds the missing primitive — nothing today writes an existing BlobRef
onto a second document — and requires that sharing be disclosed wherever it
reduces what an operation will free.

Both Proposed; nothing implemented yet.
2026-08-30 03:41:32 -07:00
Greg Shuflin 9bd407f815 gui: the roster toolbar follows the table's width, not the window's
The container stretched to the window while the header and the member rows
sized themselves to their columns — both `self_start`, for the border reason
noted on `render_member`. So "Refresh" tracked the window's right edge and sat
an arbitrary distance from the table it acts on, moving whenever the window
resized.

Making the container shrink-to-fit puts one thing in charge of the width: the
widest member row sets it, and the toolbar stretches to match, which is the
flexbox default once the container stops filling the window.
2026-08-30 03:22:40 -07:00
Greg Shuflin 3ede837fc7 TODO: cargo test --workspace fails a syn-daemon test the just recipe passes
Feature unification: --workspace pulls in gui-app, whose tree turns on
serde_json/preserve_order, and the key-order assertion in
`the_raw_value_envelope_is_the_same_json_in_a_different_key_order` only holds
with that feature off.

Worth an entry rather than just a memory because the failure looks like a flaky
or freshly-broken test, and the test's own doc comment says the feature "is not
on here" — true for every supported invocation, false for the one someone
reaches for when they want to check everything at once.
2026-08-30 03:22:40 -07:00
Greg Shuflin 2f679a2028 gossip: an unbelievable announcement time must not set the recency mark
`PeerMap`'s high-water mark exists to stop a *replayed* announcement — old,
still validly signed — pushing a peer's cached relay URL and name backwards.
It compares two sender-supplied times, so it needs the same bound every other
incoming timestamp already gets through `wire_time`.

Without it the guard becomes a denial. An announcement from the future sets a
mark that peer's own honest announcements cannot beat until this node's clock
catches up with the wrong one — so a device a few days out spends those days
unable to correct its relay URL, its name, or, now that this screen reports it,
to say that its clock has been fixed. The message that resolves the problem is
exactly the message being discarded.

An unbelievable stamp therefore contributes "now" to the ordering — not a clamp
to the edge of the believable range, which would still lock the peer out for a
whole day. The value itself is untouched: it is what the skew report is derived
from, and only the ordering is held to what this node can believe.

Found while running the skewed-node scenario end to end.
2026-08-30 03:22:40 -07:00
Greg Shuflin 071b7384a9 justfile: fix the daemon flag order, and libfaketime's offset syntax
Both found by actually running the skewed-node scenario end to end.

`daemon-cli` passed `daemon --foreground --store DIR`, but `--store` is a
global flag and `--foreground` belongs to `daemon start` — bpaf refuses it with
"flag `--foreground` is not valid in this context". That took
`test-env-daemon-a` and `test-env-daemon-b` down with it; both work now.

The `faketime` wrapper hands its offset straight to `date`, so it wants
"+3 days" rather than libfaketime's terse "+3d" — that spelling only works in
the FAKETIME environment variable, and the wrapper answers it with "Timestamp
to fake not recognized".
2026-08-30 03:22:40 -07:00
Greg Shuflin 4ff0dd6849 TODO: the clock-skew rejection is no longer silent 2026-08-30 03:22:40 -07:00
Greg Shuflin 66641cd311 tui, cli: a peer's clock problem where a headless node can see it
The TUI splits the same way the data does: one word per problem in the member
list, coloured by severity, and the sentences in the detail pane opposite. The
list is too narrow for prose, and without a mark on the row there would be
nothing to tell the reader which cursor position to move to.

`syn ensemble members` prints the headline and detail indented under the peer,
the shape the function already uses for this node's own revocation and
stale-epoch notices. This matters more here than anywhere: on a VPS there is no
roster to look at, so this listing is the whole diagnostic surface, and the
alternative to printing it is reading the daemon's log.

That needed `health` on `EnsembleMemberPeer` too — `ensemble members` builds a
leaner snapshot than `EnsembleStatus`. `#[serde(default)]`, like `revoked`
beside it, so an older daemon's answer still parses.
2026-08-30 03:22:40 -07:00
Greg Shuflin 0f3e20ab07 android: a peer's sync problems on its card and its node screen
Additive, because the card already stacks: a word beside the name — the same
place the revoked mark goes, and for the same reason, since this is something
the row *is* — and a tinted notice under the two controls carrying the headline
and what to do about it.

Under the controls rather than above them. A notice that pushed Ping and Sync
down every time a peer's clock drifted would move a button out from under a
thumb already reaching for it.

Every word and the amber/red choice come from `copy::peer_health` over the FFI,
in one crossing per issue and only when the issue list changes — these rows are
written by gossip and sync ingest, never by anything happening on screen. The
derivation in particular is not re-implemented here: which of three sentences a
clock problem gets depends on the bound in `p2p::wire_time` and on what the
last sync cost, and a Kotlin paraphrase would be a second answer to "has this
node stopped syncing?".
2026-08-30 03:22:40 -07:00
Greg Shuflin ced789ae1b gui: the roster row gains a line to speak on, and stops painting over itself
Two things, and the second is why the first has anywhere to go.

The action block was `w(COL_ACTIONS)` — a fixed width holding a status slot
and four `flex_none` buttons. Once the buttons' natural widths outgrew it
nothing could shrink, and `justify_end` pushed the overflow off the block's
*start* edge: the leftmost child, the ping/sync status slot, painted its green
text across the "Last synced" column. Adding "Revoke…" was enough to cross
that line, and the previous fix — widening the constant from 370 to 470 — only
moved where the next control would cross it again. It is a `min_w` now, which
cannot be outgrown.

A member row is a column of one or two lines. The identity line is unchanged
and unchanged in height, so a quiet roster is still one line per node. Under
it, only when there is something to say, a message line carrying the transient
ping/sync result and any unresolved sync problem — with the row's whole width
instead of 110px, which is the room a sentence like "Clock is 3 days fast —
its edits are not being accepted" needs to be read rather than hovered.

The border and `self_start` move out to the enclosing column so a two-line row
keeps one divider under the pair rather than growing one through its middle.
`status_priority` and its three regression tests are untouched: that policy
was right, it just renders somewhere else now.
2026-08-30 03:22:40 -07:00
Greg Shuflin 1a4ee93786 ensemble status carries each peer's sync health to every frontend
One field on `EnsembleMemberInfo`, and that field is the whole distribution
story: the desktop consumes `EnsembleStatus` directly, `ffi/ensemble.rs`
re-exports it over uniffi, and syn-daemon's `EnsembleStatusSnapshot` wraps it
verbatim — so the TUI gets it without a line of protocol work.

Read as one query for the whole roster rather than one per row, and degrading
to "nothing wrong" rather than failing the status — the same trade the
deny-list and coverage reads already make. Not being able to say what is wrong
with a peer is not a reason to be unable to say who is in the ensemble.

Always empty for this node: every issue here is something this node observed
about a peer, and a node cannot be out of step with its own clock.

`copy::peer_health::copy` bundles the four derived pieces into one record so
Android crosses the FFI once per issue instead of four times per repaint. The
daemon's JSON round-trip guard now carries a populated issue: `PeerHealthDetail`
is an internally-tagged enum nested two records deep, and that test is the only
thing that would notice if it stopped surviving serde on the way to the TUI.
2026-08-30 03:22:40 -07:00
Greg Shuflin e92d5f5b5b p2p: measure a peer's clock, and record what its skew cost
Two writers, and the distinction between them is the design.

Gossip announcements carry a signed `announced_at_secs`, so the time in one
is attributable, and they repeat on a timer whether or not anything syncs.
That makes the announcement the authoritative measurement — the only one that
can say a clock has been *fixed* — so it is the one allowed to clear a
standing warning. It is taken after the staleness check: a replayed
announcement is validly signed and, measured against now, looks exactly like
a clock that is behind.

`SkewedStamps::report` knows the other half — how many fields the bound
actually refused, which is the difference between "this clock is wrong" and
"this clock has thrown away twelve of your edits". It only ever adds. A sync
that refused nothing may simply have carried nothing, and reading that as
"resolved" is how the roster would have flapped between the two messages for
as long as the clock stayed wrong.

The two therefore compose rather than overwrite: an announcement carries a
sync's drop count forward, and a sync's skew — a lower bound, since it only
saw what its batch happened to carry — never revises a better announcement
measurement downwards. Both regressions have tests.

`peer_health` is threaded to the four ingest paths as an `Option`, which the
doc-sync unit tests pass `None` for; they build sub-stores rather than a whole
Store, and a `None` costs only the persistence, not the log line.
2026-08-30 03:22:40 -07:00
Greg Shuflin c58ca5fd7e peer health: a store and the words for what is wrong with syncing to one peer
`p2p/wire_time` has bounded incoming timestamps for a while: a stamp more
than 24h ahead of this node's clock is dropped along with the record field
carrying it. That closed the corruption case and did it silently — a peer
whose clock is wrong simply stops merging, and the only sign is a WARN line.

`stores::peer_health` is where that stops being invisible. One row per
(peer, kind), holding a serde-encoded `PeerHealthDetail`; a row exists only
while its condition holds, so resolving one is a DELETE rather than a status
flip and no screen has to decide whether a stored "ok" is stale. The JSON
detail column is what makes this the place a peer's sync problems are
recorded rather than a clock-skew column — a second kind is a variant and a
writer, not a migration.

`copy::peer_health` owns the derivation as well as the strings, per the
`content_fetch` rule: which of three sentences a clock problem gets, and
whether it draws amber or red, is a function of the stored numbers against
the live bound in `wire_time` — not something four frontends should each
work out and then disagree about.

`format_duration_rough` alongside it. Its two-of-a-unit rule is load-bearing
rather than taste: it keeps a 47-hour skew from reading as "1 day" in a
sentence whose other half says the limit is 1 day.
2026-08-30 03:22:40 -07:00
Greg Shuflin 2888741fa1 test env: a node with a deliberately wrong clock, via the flake
Exercising the timestamp bound in `p2p::wire_time` needs a peer whose clock
is actually wrong, and the honest way to get one is to move the whole
process's wall clock — so the peer's signed gossip `announced_at_secs` and
every `modified_at` it writes are wrong together, which is the real failure
rather than a simulation of one.

libfaketime comes from the flake's devShell rather than a system package, so
the scenario reproduces on any machine with the flake and is pinned to the
same nixpkgs as everything else.

The recipe builds first and fakes only the built binary: running cargo itself
under a future clock would corrupt its mtime-based freshness check. `-m`
selects libfaketime's thread-safe build, since the daemon is thoroughly
multi-threaded, and FAKETIME_DONT_FAKE_MONOTONIC keeps QUIC's own timers on
the real monotonic clock — without it iroh's timeouts move too and the nodes
fail to connect for reasons unrelated to the test.
2026-08-30 03:22:40 -07:00
Greg Shuflin 9e8b79ecbc Add TODO.md note 2026-08-30 02:14:06 -07:00
Greg Shuflin 0bcb270a2d Remove old TODO item 2026-08-28 04:20:30 -07:00
Greg Shuflin ab4edae5a2 android: the two endings get their borders back
Both Retire and Reset are now FlatButton's footprint in danger colours — a
full-width bordered rectangle, 56dp tall, tinted with the error colour — as
the old Reset button was. A bare TextButton next to a paragraph of body text
had no edge to read as a control at all, which matters more here than
elsewhere: these two are the destructive pair.

Stacked rather than in a row, unlike the desktop's, because "Retire this
node…" beside "Reset this node…" is ~170dp each on a phone and both wrap.
Same width-driven split the label/value lists already make.

The spinner keeps the Reset button's place while a wipe runs and both
buttons fade, so nothing moves.
2026-08-28 04:18:13 -07:00
Greg Shuflin 0717e62f86 Retire and Reset sit together under "This node" on the Ensemble screen
Reset was in System's danger zone and retire on the Ensemble tab, which put
RETIRE_VS_RESET — the one sentence that distinguishes them — above only one
of the two buttons it describes. The choice between them is the decision, so
a user who found reset on its own screen would never learn that retiring was
the option they wanted.

Both now sit in the same section in the same weight, retire first. On
Android that also means the two are the same control: reset had been a
full-width bordered Surface and retire a TextButton, which read as unrelated
acts of different severity rather than as alternatives. The progress spinner
takes the reset button's place while the wipe runs.

RESET_SEE_RETIRE goes with it — it existed only to point at the screen the
other button was on.
2026-08-28 03:54:11 -07:00
Greg Shuflin 6e2364fd5e android: retire moves to the Ensemble screen, behind a confirmation
Retire was a bare TextButton in Settings that navigated straight into the
retirement screen — a screen that clears the back stack, swallows the system
back button, and cannot be cancelled. One stray tap was the whole
confirmation. It now asks first, with the same modal shape and the same
words the desktop uses (retireConfirmTitle/Effect/OneWay were already
exported; only the button label was missing).

It also moves to the foot of the Ensemble screen, matching the desktop and
for the same reason: signing your own revocation and handing it to a peer is
the same act a row's Revoke performs on someone else. Reset stays in
Settings, and its dialog now reads its sentences from copy::revocation
instead of a Kotlin string literal.
2026-08-28 03:00:47 -07:00
Greg Shuflin a4b96fa51b gui: retire moves to the Ensemble screen, and Reset joins System
Retiring is an ensemble act — it signs a revocation for this node's own
credential and hands it to a peer, which is exactly what a roster row's
Revoke does to someone else, only self-signed. So it belongs with the roster
it affects, under a "This node" heading at the foot of the Ensemble tab,
rather than buried in System's danger zone.

Reset is the one that isn't: it deletes the same data and tells nobody, so
it stays under System, and the sentence beside it now says what it does not
do and points at the retire control. The desktop had no reset at all before,
which made "clear this and start over" a matter of finding the store
directory.

retirement.rs becomes teardown.rs, because both endings share everything
from the wipe onwards — cancel the jobs, drop the runtime, delete, sit on a
terminal screen with Quit — and only the half before it differs. An Ending
picks which; a reset skips straight to the wipe, and never offers "Wipe
now", whose sentence is about a record it does not have.
2026-08-28 03:00:39 -07:00
Greg Shuflin e6dc7bf783 Shared copy for resetting a node, beside retiring it
Android's reset dialog had its own hand-typed sentences and the desktop had
no reset at all, so adding one meant either retyping them or writing them
down once. They go in copy::revocation, next to RETIRE_VS_RESET: reset is
defined by that contrast, and now that the two controls sit on different
screens each has to say where the other one is.

reset_failed takes the manual path as an argument — clearing app storage on
Android, deleting the store directory anywhere else — the same shape
retired_store_empty uses for the same reason.
2026-08-28 03:00:30 -07:00
Greg Shuflin 4eb877550e Revoked nodes are off the roster and out of the node count
A freshly registered node draws a row reading "(unnamed) · revoked" for
every retired node in the ensemble's history: it learns the deny-list over
gossip and the retired node's stale pkarr address record from the registry,
and has no other trace of a node it has never met and will never reach.
Those rows were also counted in "N total nodes", which is the number people
read off the screen.

They used to be listed unconditionally, reasoning that a marked row beats a
node silently vanishing. That holds for a node the viewer knows; it does not
for one they don't. The count of revoked nodes stays visible either way, so
nothing vanishes silently — the rows are one control away.

ensemble::screen::roster and RosterCounts make both decisions once, so the
desktop, Android and the TUI cannot disagree about what "N total" counts:
total and other exclude revoked members regardless of whether the rows are
shown, since revealing one does not make it a member again. Desktop and
Android get a labelled toggle beside the Nodes heading, the TUI gets 'v'.
syn ensemble members still prints them — a one-shot dump has no control to
put them behind — but no longer counts them.
2026-08-28 02:23:16 -07:00
Greg Shuflin f544455c64 Retiring the GUI unlinks the store lock file on the way out
wipe_contents deliberately keeps .store.lock: unlinking a file another
process may hold open lets a third lock a fresh file of the same name.
That hazard belongs to a process that goes on using the store — a retired
node's last act before exit has no such window worth caring about, and
leaving one hidden file behind is not the empty directory the screen just
told the user about.

So the Quit button on the finished retirement screen removes it, via
Store::remove_lock_file. Best-effort and logged: the retirement is over
either way.
2026-08-28 02:23:05 -07:00
Greg Shuflin ede28e9491 gui: a retirement ends on a screen, not on the window vanishing
A peer that acknowledged promptly took the whole window with it a moment
later: Delivered -> wipe -> cx.quit(), with nothing on screen long enough to
read. Whether a peer confirmed is exactly the fact that becomes unknowable
once the node is gone, so the wipe now settles on a terminal Phase::Retired
that says which of the three ways it ended and offers Quit.

The signed record moves onto the struct and survives the wipe. It used to
live inside Phase::Waiting, so pressing 'Wipe now' — the one path where the
record is the only thing standing between the user and an ensemble that goes
on admitting a dead credential — took it off screen on the way out. It is
dropped only for a confirmed retirement, where there is nothing left to
repair by hand.

The three outcomes and the 'store directory is now empty' line go in
copy::revocation as RetirementDelivery::summary and retired_store_empty; the
CLI's wipe_after_retirement was saying the same things in its own words.
2026-08-28 01:35:32 -07:00
Greg Shuflin 83db04ee8a Bind Run now, both evictions, and the library build on both modalities
The last controls anywhere that showed the click rather than the job. Each
already started one with a nameable (kind, subject); each kept a boolean or a
Pending variant beside it that only its own screen could see.

Settings' "Run now" reads BackgroundSync/None; "Delete Locally" reads
Eviction/Document and "Reclaim…" Eviction/DocumentType — distinct subjects on
purpose, so a subtree eviction and a type-scoped reclaim neither dedup against
nor mask each other. Music's "Build library" reads LibraryBuild/DocumentType.
Both keep Evaluating, which is genuinely the screen's: gathering the evidence
for the confirmation dialog is not work another node can see.

FFI: JobSubjectRef gains None, since "no per-thing widget speaks for whole-node
work" stopped being true the moment Run now bound to it, and its DocumentType
variant now carries the enum rather than a snake_case name — a frontend that
had to produce that name would be a mirror of DocumentType::type_name, which
is what job_match_key exists to avoid. Both are covered by the drift guard in
free_fns' tests.

Also fixes rust/tui-app's EnsembleStatus test fixture, which had not been
updated for the three epoch fields and was failing the workspace build; the
values are the zeros every other field in that fixture already uses.
2026-08-28 00:03:49 -07:00
Greg Shuflin f90be1c5b6 gui: bind Run now, the two evictions, and the library build
The last four desktop controls that showed the click rather than the job.
Each already started one with a nameable (kind, subject); each kept a boolean
or a Pending variant beside it that only this screen could see.

- Settings' "Run now" reads the BackgroundSync/None job, so a pass the
  periodic tick or a peer's TriggerSync started shows as running, live, rather
  than being re-derived at two moments (construction and tab-switch) and stale
  in between. run_now_from_job_state is gone.
- "Delete Locally" reads Eviction/Document and "Reclaim…" Eviction/DocumentType
  — distinct subjects on purpose, so a subtree eviction and a type-scoped
  reclaim neither dedup against nor mask each other. Both keep Evaluating,
  which is genuinely this screen's: gathering the evidence for the dialog is
  not work another node can see.
- Music's "Build library" reads LibraryBuild/DocumentType.

Each screen's remaining state is the outcome sentence, hidden while the job
runs so a finished run's numbers can't be read as this one's.

ActiveJobs::watch packages hold-an-index-and-keep-it-fresh, mirroring
RemoteFetch::watch's pick-closure shape — a subscription rather than that
one's timer, since existence and progress both arrive as events and there is
no stall clock here that only a poll could read.
2026-08-28 00:03:49 -07:00
Greg Shuflin c696b431ce gui: the running-imports strip on every screen that can start one
Lifts the Documents screen's per-import lines into
`components::imports_in_progress`, a small view that owns its index and its
watcher, and puts it on Comics, PDF, Pictures, Music and Video too — five
screens whose "Import…" trigger previously showed nothing at all while a
folder walk ran for minutes.

A view rather than a render function because keeping the lines current is the
whole job: as a function each host screen would have to wire its own
ActiveJobs, job-stream watcher and notify. As a view it is a field and a
`.child()`. It watches only while its screen is on display, refreshes on
navigation to it, and renders `display: none` when nothing is importing, so a
host can place it unconditionally without a flex gap opening under the header.

Comics and PDF show it on the library view only — the reader is not showing
the list an import is about to land in.
2026-08-28 00:03:49 -07:00
Greg Shuflin adaea869f9 new test ensemble key 2026-08-27 18:35:05 -07:00
Greg Shuflin 82346dc8c7 gui: bind the last two desktop controls Android already binds
The per-artifact "Sync" on the document detail screen and the Documents
screen's imports were the two places Android read the live job row and the
desktop still read its own click.

The artifact row now takes its busy state from its own
ContentFetch/DocumentAsset job, so a pull the scheduler or another screen
started shows there; asset_sync keeps only the outcome sentence, which no job
carries. The Documents screen's `importing` boolean is gone: it disabled the
Import trigger for unrelated sources, missed imports started anywhere else,
and reported one anonymous "Importing…" for however many were running. In its
place ActiveJobs::of_kind lists each running import by name with its own
progress.

No link through to Jobs on the desktop lines, unlike Android's: the sidebar
entry is always on screen with a live "N running" badge.
2026-08-27 15:37:02 -07:00
Greg Shuflin ba31aa8d0a Fix stale provenance entry 2026-08-27 03:29:54 -07:00
Greg ShuflinandClaude Opus 5 ecb7e41c7a AGENTS.md: scope the build detail to the trees that need it
The root file loads into every session, and about a quarter of it was
build guidance that only applies inside one directory. The Android block
(the three `just doctor` toolchain cases) and the two-detekt-recipes
block now live in android/AGENTS.md; the gpui block (check-gui-nix,
build-gui-nix, and why rust-analyzer.json sets checkOnSave: false) lives
in rust/gui-app/AGENTS.md. Each is reached by a one-line pointer from the
root, and each opens by saying it is scoped and that the root file still
holds the project-wide rules. 21.5k chars down to 15.5k — roughly 1.5k
tokens back in every session, whatever the session is about.

Both new files get a CLAUDE.md symlink beside them, the same arrangement
the root already uses, so Claude Code picks them up when it works under
those directories while AGENTS.md stays the name on disk.

The split has one seam worth knowing about: the Kotlin lint entry warns
that a suddenly-slow `just lint-kotlin` means rust/lib/build.rs is
rebuilding, and that file sits outside android/, so the warning is not
loaded when you are the one editing build.rs. It stays in android/ anyway
because that is where someone hits the symptom.

Also dropped four lines the codebase already answers: the camelCase and
explicit-types conventions, the standard --tests invocation for a single
Gradle test, and an Architecture: line that still said JNI where the rest
of the file describes uniffi.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y7prPWuHReKauUzU34qyCh
2026-08-26 10:21:31 -07:00
Greg Shuflin 6db689fab0 epochs: syn ensemble renew-membership and rejoin
The CLI surface, and the shared state the other modalities will render.

renew-membership is the lost-or-stolen path, deliberately its own command
rather than a flag on revoke: the two are separate decisions and one is far
more expensive. Its confirmation's job is the blast radius, so it counts live
gossip neighbours rather than the roster total — reachable *right now* is
exactly what decides who gets renewed with this command and who is stranded
needing the keyphrase entered on them. It says that, and that losing the
keyphrase now strands those nodes permanently, before it asks.

rejoin is the way back. Needs the keyphrase and nothing else; no peer has to be
reachable, which is the property that makes it the fallback rather than the
optimisation.

EnsembleStatus grows current_epoch, this_node_epoch and
this_node_epoch_is_stale, so every modality can say 'your membership is out of
date' from one projection. The stale state is kept distinct from revoked
throughout: being revoked is something someone did on purpose, being left
behind is what happens to a device that was switched off at the wrong moment,
and only the second has a way back the user did not have to intend.

Both commands are refused over the loopback listener, same rule as retire and
revoke.

All the new copy went into copy::revocation as it was written rather than into
the screens — the rule from earlier today, applied on the way in for once.
2026-08-26 04:25:11 -07:00
Greg Shuflin 2bc9839a21 epochs: how a bump travels, and how a node left behind gets back
Three channels, mirroring how a revocation already moves.

Gossip carries EpochBump for promptness, verified against this node's own
ensemble key rather than against whoever relayed it — the property that makes
a revocation relayable, and needed here for the same reason: a node about to be
locked out must not be able to suppress the record by refusing to pass it on.

doc-sync's RevocationBatch becomes MembershipBatch and carries bumps beside the
deny-list. Same subject, same nodes want it at the same moment, and a bump is
109 bytes. Applied in ascending order so a node several epochs behind lands on
the newest rather than stopping at the first one it can apply.

The delivery protocol carries both too, and the ALPN becomes /syn/membership/1
because that is now what it is. Folding them together is the answer to the open
question the doc left: the two need the *same* exemption for the same reason —
a node refused everywhere, whether revoked or an epoch behind, has to be able
to reach something, and the only thing it may reach is a channel whose sole
effect is to hand over signed state it verifies itself. One exemption to reason
about beats two.

Minting: bump_epoch takes the keyphrase, moves the epoch, and re-certifies this
node in the same breath so the node holding the keyphrase does not lock itself
out by using it. recertify is the way back for a node that was offline through
a bump — with a verified record in hand it knows the epoch, and minting a cert
at it is purely local. Nothing is transported and no peer need be reachable,
which is what the doc predicted and what makes the fallback the part that
matters.

Not yet wired: nothing offers either of these to a user. Surfaces next.
2026-08-26 04:13:44 -07:00
Greg Shuflin 235b382074 epochs: the record, the store, and the gate it feeds
Phase 3b's mechanism, in the shape phase 2 established for revocations.

DelegationCert gains epoch: u32 inside its signed payload, so the number cannot
be edited after the fact and the fingerprint covers it. The payload version
goes to 2, which invalidates every cert issued before now — every node
re-registers, which is what an epoch bump does anyway, and the project takes
breaking changes to wire formats.

ensemble::epoch::EpochBump is a signed statement that the ensemble has moved,
and it is the *only* thing that advances an epoch. The tempting alternative —
treat a cert claiming a higher epoch as proof you are behind — has to be
refused, and that refusal shapes everything else: certs are minted locally by
whoever holds the keyphrase, so one bogus number fed to a legitimate user
re-registering would push the ensemble past every honestly-issued cert and lock
out every node at once.

stores::epoch::EpochStore holds the highest bump verified, and only ever moves
forwards. Replaying an older record is exactly what an attacker would try and
also what an honest peer does when it relays everything it holds, so a stale
bump is discarded rather than being an error. Whole records are kept, like the
deny-list keeps whole revocations and for the same reason: this node relays
bumps it did not mint, and a receiver verifies the signature itself.

admission checks the epoch before the deny-list — it is cheaper, and a stale
cert is what a *legitimate* node arrives with after being offline through a
bump, so naming that case is what lets the other end say 'your membership is
out of date' rather than refusing bare. A node whose own cert fell behind stops
serving and dialling, so it says that once instead of collecting refusals from
every peer.

Not yet wired: nothing propagates a bump and nothing mints one. Next.
2026-08-26 04:00:05 -07:00
Greg Shuflin 7735fd532b docs: say when an epoch bump happens, and what missing one feels like
3b described the mechanism and the trade-off but not the two things anyone
building it would have to decide first.

**When it moves.** Never automatically, and never as a side effect of an
ordinary revocation — phase 2 covers the common case, and bumping there charges
every other node a re-certification for a threat that is not present. The epoch
moves when the user says a device is out of their control, which is a claim
only they can make: a node that stops answering looks identical either way. The
natural place to ask is the revoke dialog, for a reason worth noticing —
revoking a peer already requires the keyphrase, which is exactly and only what
a bump needs. The dialog must say how many nodes will need the keyphrase
entered on them, and that the keyphrase is load-bearing again, before it
commits.

**What missing one feels like.** The case to design for is the phone in a
drawer, not the attacker. Refused everywhere, told why, handed the bump record
over a path that admits a stale caller — phase 2's exemption in the same shape
and safe for the same reason — and back in by entering the keyphrase locally.

Working that through changed two things.

A cert cannot establish the epoch. The mirror of "below the current epoch is
invalid" — that above it proves you are stale — has to be refused: certs are
minted locally by whoever holds the keyphrase, so a user tricked into
re-registering against a bogus epoch would push the ensemble past every
honestly-issued cert and lock out every node at once. The epoch advances only
on a signed EpochBump record, travelling exactly as a revocation does.

And it mostly closes the re-certification transport question. No cert needs
transporting: a node with a verified bump knows the epoch, and minting at it is
local. Pushing certs from the revoking node is an optimisation for reachable
nodes, and the fallback is the part that covers the offline ones.

Also corrected: the closing paragraph claimed the two mechanisms layer on the
same case. They do not. A bump evicts by itself; what the deny-list goes on
covering is revocations between bumps. And neither covers a device that took
the keyphrase too.

Repointed the audit's drifted line references by name, and marked its two
amplifier items with what §3a since did to them — one fixed outright, one no
longer decided with.
2026-08-26 03:12:18 -07:00
Greg Shuflin e6d7960177 TODO: point linkage scope at the branch where an attempt sits
The work is on linkage-security rather than here: parked deliberately, because
the capability model it needed to make scopes work may be more machinery than
the current browser extension warrants, and may not fit the linkages that
exist only as sketches.
2026-08-26 02:58:40 -07:00
Greg Shuflin a7e7c601be podcast: a search term reaches the API whole
search_podcasts built its URL with format!("…byterm?q={query}"), putting the
user's raw text where a URL has its own syntax. A search for "AT&T" arrived as
q=AT with a stray T parameter after it; anything past a # arrived truncated,
because a fragment is never sent at all. Spaces survived only because
Url::parse happens to percent-encode them.

RequestBuilder::query does the encoding, which meant turning on reqwest's
"query" feature — free, since its encoder is already in the tree via other
crates.

The sibling URL a few lines down interpolates a feed id and a max count, both
i64, and is left alone: a number has no characters to escape.

Five cases pinned against the built request rather than a sent one — this is
about how the URL is assembled, and the test should not touch the network.
2026-08-26 02:46:36 -07:00
Greg Shuflin 4ecf8aee1e copy: the podcast placeholder promised something the search cannot do
Android's search field said "Enter podcast name or URL". Both modalities call
the same agents::podcast::search_podcasts, which hits Podcast Index's
search/byterm — a term search. A pasted feed URL goes to it as a search term
and finds nothing. Subscribing by URL is not something this screen does
anywhere, so the shared placeholder is the desktop's wording.

Two things found while checking that, recorded in TODO.md rather than fixed
here:

The sync-configuration message difference is not an error. The desktop's
"see the status above" is accurate — render_remote_status shows
"Editing {node} — unreachable: {reason}" in the section above it. What the
difference exposes is that Android has no such status line at all: it never
names the node it is editing and never says the connection succeeded, only
that it failed. On the one screen whose edits leave the device, silence on
success is the wrong default. copy::settings::remote_config_unreachable takes
the reason as an Option so both modalities stay correct; closing that gap is
what would let Android pass None.

And search_podcasts interpolates the query straight into the URL, so a search
containing & or # is truncated or misparsed before it leaves the process —
"AT&T" searches for "AT". Same class as the lint-sql-params rule: a value
put into a string that has its own syntax.
2026-08-26 02:46:36 -07:00
Greg Shuflin 97d5abcff5 copy: the general audit — notes, documents, humans, linkages, settings
The rest of the sweep, found by comparing every user-visible string literal
across the four modalities and looking for near-matches. Grouped by subject,
since one subject reaches several screens on several modalities.

incoming_change — the alert-don't-apply banner. CLAUDE.md's first design
principle names three of these as worked examples and every one had written its
own sentence, including two spellings of the apostrophe. That is the wrong
thing to leave to a screen: the banner's job is to say what the user gives up
either way, which is a claim about the merge rules and not a matter of local
phrasing. The two subjects are named rather than passed as free text, and the
button words travel with them.

note_body_absent — the headline was identical on three modalities; the last
sentence of the detail was not, because the TUI cannot offer to start the note
over. That is a capability difference, so it is a parameter now rather than two
paragraphs that happen to end differently.

documents — the purge warning, the delete-locally title, the placement scope
line, the directory-import prompt. These say how far a destructive action
reaches, and three screens each spelling that out is three chances to make
three different promises. The descendant-count clause was written out four
times, identically, which is how it stayed identical: by luck.

humans — validation messages, which earn sharing for a reason most copy
doesn't: it is the app telling someone they did something wrong, and two
devices disagreeing about what is wrong is worse than either wording alone.

linkages, settings, pomodoro — the smaller ones. 'Nothing is linked to this
node yet.' had lost its 'yet' on the CLI; the node-key explainer was two
sentences on the desktop and a truncation of them on Android.

One divergence is kept and made deliberate: reading another node's sync
configuration fails with the reason on Android and without it on the desktop,
which carries it in a status line above. That is a real difference rather than
a disagreement, so it is an Option parameter and the stem is shared.

What the audit still reports is a tail of per-screen error banners — 'Failed to
load notebooks' against 'Failed to load pictures' — which are different
messages that merely rhyme.
2026-08-26 02:46:36 -07:00
Greg Shuflin 68a0f6c6ac copy: busy messages, empty states, and the asset-sync outcome
Three subjects where every modality had written its own version.

busy — six screens across four modalities had their own sentence for 'that is
already running', in two tenses and three capitalisations. The tense was
carrying meaning, so it is kept and made explicit rather than flattened:
busy::running is a refusal (the click did nothing) and busy::was_running is a
deferral (the click landed on work already under way, and its result is the one
you get). The FFI's two Busy errors go through it too, so Android's exception
text matches what the desktop shows.

empty — the jobs list and the roster. 'Nothing here' is exactly the message
someone compares across two devices when working out whether something synced,
so the two devices now say the same words. The TUI loses its parenthesised
abbreviations for these two, which read as a different answer rather than the
same one.

asset_sync — the four-way outcome of pulling a document's content. All three
modalities had independently reasoned their way to the same distinction —
'nothing was missing' is only a claim about the ensemble if a peer actually
answered the catalogue phase — and each had written that reasoning into a
comment beside its own phrasing. The derivation moves to copy.rs, which is
where it belonged: the interesting part is not the words but which of four
outcomes applies, and that is one judgement about the same snapshot fields
every time.

Android reaches the last two through empty_state_copy() and
asset_sync_summary() in ffi/free_fns.rs.
2026-08-26 02:46:36 -07:00
Greg Shuflin 59249196aa revocation 3a: authorship is not possession, and origin_node never was an amplifier
Phase 3a asked for two fixes. One was already done and the other was a
mis-diagnosis, so this closes it smaller than it was written.

The timestamp half is closed already, by p2p::wire_time: every peer-supplied
stamp decodes at one point, and one more than a day ahead of this node's clock
is rejected along with the field carrying it — rejected rather than clamped,
because clamping to now makes a bogus write the newest write, which is the
outcome the bound exists to prevent. That is the half that mattered, since
timestamps are what every merge rule compares.

origin_node is not a merge input at all. Properties and artifacts compare
modified_at, set elements compare their own add/remove stamps, tombstones
compare deleted_at. A lie about origin cannot win a comparison or suppress a
write. And the prescribed fix — derive it from the authenticated sender — would
have been a regression: doc-sync is transitive by design, so a record routinely
arrives from a peer that did not write it, and overwriting the claim with the
sender attributes every relayed edit to its relayer.

What was real is what consumed it. node_status::artifact_presence_for_node
inferred that an artifact's author still held its content, and put a Present on
the presence grid — which is what a user reads before deciding what is safe to
delete locally. That inference was unverifiable, and wrong about honest nodes
besides: a node that wrote an artifact and later reclaimed its content still
read as holding it.

So the inference goes, not the field. With no evidence an artifact now reads
exactly as the blob beside it always has, from the one row that came from the
node itself: it references the document, so Ref — 'it should have this' —
otherwise Unknown. Possession is asserted only from NodeContentStore, which is
written against the authenticated sender.

origin_node stays as provenance, documented once at Document::origin_node and
pointed at from the other seven fields and the eight wire records: safe to
show, unsafe to decide with.
2026-08-26 02:46:36 -07:00
Greg Shuflin e085ba683d copy: revocation says the same thing on every modality
I shipped four paraphrases of the same sentences. The desktop said a retired
node "prints" a record, Android and the TUI said it "shows" one; the revoke
dialog explained itself in three different ways; the self-revoked banner had
four wordings across GUI, Android, TUI and CLI.

copy::revocation is now the single definition, and every modality imports it —
the three Rust ones directly, Android through revocation_copy() in
ffi/free_fns.rs alongside placeholder_copy and action_labels. The sentences
that carry a node's name are their own exported functions, since a record of
constants cannot interpolate.

These are load-bearing rather than decorative: they are what tells someone that
revoking a node does *not* wipe it, that a retirement nobody heard can still be
repaired, and what "wipe now" costs. Four answers to that is four answers.

CLAUDE.md gains the rule, including the part I got wrong — paraphrase across
modalities is the same defect as duplication and harder to spot, and the
derivation belongs in copy.rs too, not just the strings.
2026-08-26 02:46:36 -07:00
Greg Shuflin 05db9b7530 tui: revoke a member, and import a record carried here by hand
x opens a keyphrase prompt for the selected member; i opens one for a
revocation record. Both go to the daemon on a worker thread like ping and sync
do, and both are followed by the quiet reload, so the row becomes revoked
without wiping the answer the user just asked for.

A prompt takes every key, q included. A keyphrase has letters in it, and the
one that used to quit the app is one of them.

The keyphrase names its node when the prompt opens rather than re-reading the
selection when it is sent. A peer announcing itself mid-keyphrase reorders the
roster under the cursor, and a revocation landing on whichever row the
selection had drifted to would be the worst possible version of a sync
disrupting what the user is doing.

Shown in the clear, matching how syn init and syn ensemble register read it: a
20-word bytewords phrase typed blind is a phrase typed wrong, and what this
defends against is a sibling node minting a revocation on its own, not someone
behind the terminal. Esc drops it rather than stashing it.

The minted record is kept per member and shown in full in the detail pane.
Nothing serves a record back once it is on the deny-list — the store holds its
bytes but no command returns them — so the moment it is minted is the only
chance to keep it. An imported one is not kept: it came from the user, and the
node it names may not be on this roster at all.

Ping and sync now refuse a revoked member rather than spending a dial to be
turned away at admission. Retiring *this* node stays out: it ends by deleting
the store this screen is reading, so it belongs to syn ensemble retire, which
can stop the daemon first. The refusal says so.
2026-08-26 02:46:36 -07:00
Greg Shuflin 35782c5290 podcasts: delete a dead downloader, and say what Play actually does
episode.rs claimed "no audio is streamed yet" while its Play has been handing
the enclosure URL to the transport bar as an AudioSource::Stream — the doc
predates the streaming work and read as if the screen were still a stub.

agents::podcast::fetch_episode_audio had no callers in any crate. It is also
the wrong shape for the offline-copy feature that would have wanted it: a
whole enclosure in a Vec<u8> is the memory profile TODO.md already flags for
BlobStore::store, so leaving it lying around invites building on it.
2026-08-26 02:01:19 -07:00
Greg Shuflin c7221f49a8 TODO: drop what's built, and fix what had gone stale
- The unified now-playing view across agents is ADR 0045, implemented on both
  modalities; its one unrelated nested bullet (configurable sidebar order)
  moves up to Agents rather than leaving with it.
- Pop-out windows exist (gui-app/src/popout.rs). The Android half of that
  bullet was a musing about a concept a phone doesn't have.
- Android's Notes screen has the incoming-body conflict UI the Android visual
  style item was still waiting on — IncomingBody.alertFor, which CLAUDE.md
  now cites as the Android worked example of alert-don't-apply.
- The Collection-card sync rollup has its mechanism (content_ledger::
  subtree_content, whose doc comment names this TODO); what is left is the
  media library screens adopting it, which the content-placement item already
  says more precisely. Deduped rather than deleted.
- Hierarchical documents display: both modalities expand a row's children in
  place.
- Podcast episode position tracking is a synced artifact; the half that is
  left is an offline copy, so the item says that and names the memory-hungry
  dead function nobody should build on. The feed-refresh item gains the trap
  that the desktop's Refresh button doesn't refetch the feed.
- Android's test inventory was three files ago; the Reliability item pointed
  at a heading that no longer exists under that name.
2026-08-26 01:54:49 -07:00
Greg Shuflin 8cdf08d304 docs: retire the change-signals TODO into the ADRs that own it
The work is done: every screen on every modality follows the store, and the
polls this started as are gone. What was left in TODO.md was either a fact
about the design or a deliberate exception, and both belong where someone
reading the design will meet them rather than in a list of things to do.

ADR 0041 gains "Where this ended up": the in-memory P2P state no store
channel can announce, the players that must never follow one, the record
screen in edit mode, the Sync tab's multi-second walk, and the timers that
were never polls. Its amendment now names SyncStagingStore as the one store
still to be held to the rule.

ADR 0031 gains the design that is actually owed — what a *form* needs that a
single-value guard doesn't cover: a per-field "keep mine" that doesn't revert
four fields nobody disagreed about, and an alert that can say which fields
moved. The two stopgap call sites point there now instead of at TODO.md.
2026-08-26 01:25:40 -07:00
Greg Shuflin 39c6f45b1c humans: the detail screen follows the store, and a local edit wins
A person can be edited on another node, and an interaction with them written
by anyone else who was there; neither reached an open detail screen on either
modality. The timeline now follows the store whatever the mode — an
interaction is its own document, shared with its attendees, and lives outside
this form — and the profile follows it while it is being read.

In edit mode the arrival is dropped and the staged edit stands. That is the
expedient answer and not the right one: the rule asks for the arrival to be
announced, for each choice's cost to be named, and for the save that would
overwrite the other node's version to wait. Both call sites say so, and TODO
records what the real design has to do — including that a form is not a text
buffer, so "keep mine" cannot mean overwriting four fields the user never
touched.
2026-08-26 01:12:48 -07:00
Greg Shuflin 54f4dbd373 stores: SettingsStore announces, and so should every store
A remote administrator can set this node's sync policy over p2p::node_admin,
and the tabs showing that policy had no way to hear it — not on a change, and
on the desktop not even on a tab switch, since the policies were read once
when the screen was built.

SettingsStore now carries a ChangeSignal on a new ChangeChannel::Settings,
marked from every write path rather than the ones judged interesting: what a
screen shows is not a store's business to predict, and predicting it wrong is
what this bug was. The desktop Settings screen and Android's Sync settings
follow it for their switches and menus. The desktop's text fields are left
alone on purpose — they hold what the user has typed and not saved.

ADR 0041 said to add a channel only when a screen asks for one. That rule is
amended there: announcing into an empty room costs a counter nobody reads,
while not announcing costs a screen quietly showing something that has stopped
being true.
2026-08-26 01:09:06 -07:00
Greg Shuflin 2a3930f10c docs: live player state is local to the node playing it
The progress artifact is what crosses nodes; playing/paused, the current
second, and the volume do not. Worth stating outright because the feature is
described as "pause on the phone, resume on the desktop", which is one letter
away from a phone that starts the desktop playing — and because a screen that
follows the store is a short step from a screen that seeks under whoever is
listening.

Written where the players are designed rather than in an ADR: it is a
standing rule about what these widgets may do, not a decision being taken
once.
2026-08-26 00:57:39 -07:00
Greg Shuflin 35a3d7872a TODO: the podcast detail screens are done on both modalities 2026-08-26 00:45:50 -07:00
Greg Shuflin a064c3fac6 gui: the podcast detail screen follows the store
The desktop mirror of the Android change: episodes persisted by another node
sync here as documents, and this screen showed whatever it had read when it
was opened. It now re-reads on the Documents channel — the episode list, the
listen positions and queue membership attached to it (a position from the
phone is the everyday case), and whether the feed is subscribed, which is what
makes its episodes persist at all.

Only what is persisted: load_episodes falls back to the Podcast Index API when
the store has nothing, and that is a thing to do when the user asks for a
list, not on every document a sync commits. Nothing stored is no news rather
than an empty list to apply, since that is what an unsubscribed feed browsed
from search looks like.

Android could apply most arrivals outright because its list is keyed by
episode and Compose re-finds the row under the user's finger. gpui draws this
one by index, so it takes the answer agents::snippets gives for the same
newest-first shape: SyncGuarded holds the re-read, the body's scroll offset
says whether the user is at the top with nothing over it, and otherwise a
"2 new episodes — Show" line at the head of the list waits for them.
2026-08-26 00:44:16 -07:00
Greg Shuflin 0266ac4c68 docs: record what the Jobs screen and popped-out windows now do
ADR 0041's Android paragraph named JobsView as the ungated exception; it is
still the exception, but for a number rather than a full reload, and "on
display" now includes a window of its own. Retires the TODO item, and replaces
it with the Settings screen — the last desktop screen reading only when shown,
and the one whose reason is a missing announcement rather than a costly read:
nothing bumps a channel when a settings row is written.
2026-08-26 00:38:56 -07:00
Greg Shuflin 6f983c195a gui: the Jobs screen pays a COUNT off screen, not a full reload
It publishes the rail's "N running", so it is the one screen that can't stop
when it goes off display — and it took that as licence to do everything on
every job event. A large import reports progress every few megabytes, and each
report cost both tabs, a peer-name lookup, a get_title per referenced
document, and a settings read, all to produce a number.

Off screen it now costs one COUNT(*) (JobStore::count_active, from the store
rather than the runner's in-memory map, since another process sharing the
store can move it). The full reload happens while the screen is in front of
the user — which now includes a window of its own — and on arrival, the way
the Documents screen already reloads on navigation. One `running` field
carries the number either way, so the badge and the Active tab cannot disagree
once the screen is up.
2026-08-26 00:38:24 -07:00
Greg Shuflin d7269d950b gui: a popped-out screen is on display, and follows the store
watch_on_screen asked the sidebar for its current view, which is the main
window's — so a screen the user had deliberately put in a window of its own
stopped re-reading the moment they navigated the window behind it. The screen
most likely to be watched while work happens elsewhere was the one that went
stale, and nothing reloaded it on the way back, because there is no way back
to a window that never left.

The sidebar already mirrors the popped-out set for the rail's own marks, so
is_on_display answers both halves in one place and the accessor that only
answered one is gone.
2026-08-26 00:38:17 -07:00
Greg Shuflin 7e9ee00527 android: the podcast detail screen follows the store
Episodes arriving from another node are the ordinary case for this screen —
a second device fetched the feed, and the child documents it persisted synced
here — and until now it showed whatever the API answered when it was opened.

It watches the Documents channel and re-reads three things: the feed record
behind the header, whether the feed is subscribed (which is what turns
episode persistence on, and can happen on another node), and the persisted
episodes themselves.

An episode list is the newest-first shape CLAUDE.md's rule is most pointed
about: an arrival belongs at the top, which is where it pushes what the user
is reading down. What absorbs most of that is DocumentList's keyed items — a
LazyColumn re-finds the row that was under their finger and holds it still
while the new ones land above it — so the settled-or-hold question narrows to
the rows themselves, and IncomingEpisodes.arrivalOf is that rule: an arrival
keeping every episode on screen in the order it has them goes on outright;
one that drops or reorders one is held behind ChangedElsewhereStrip. Nothing
persisted is no news at all, since that is what an unsubscribed feed browsed
from search looks like.

The detail and info routes now read their podcast out of the repository's
collected flow rather than a one-shot getPodcast(), so a title or cover art
arriving reaches the header too.
2026-08-26 00:17:16 -07:00
Greg Shuflin 07fe09670f just: a recipe for the Kotlin unit tests, which can take a filter
There was none — Kotlin tests were run as `just gradlew test`, the raw
incantation the justfile exists to codify, and CLAUDE.md documented
`--tests` against it. Under AGP 9 that combination cannot work: `test` is a
lifecycle task owning no test executor, so it rejects the option and leaves
no way to run a single test; it also runs both variants' suites, which is the
same tests twice. `unit-tests-kotlin` runs testDebugUnitTest and forwards
args, matching unit-tests-rust/-gui.
2026-08-26 00:11:45 -07:00
Greg Shuflin dd75cc8e0c android: the podcast library follows the store
Its subscriptions were the one Android list still waiting to be navigated
back to. The screen now takes a nativeLib and hands it OnStoreChange on the
Documents channel, and PodcastRepository grows reloadPodcasts() — the seam
every other screen already had as a reload counter.

A reload here rebuilds the whole subscription map, and the Documents channel
is coarse, so it runs on any commit a sync makes. Two things keep that cheap:
Podcast now compares by what it draws rather than by id alone, so a rebuild
that changed nothing publishes nothing through the StateFlow and recomposes
nothing; and a re-read carries the cover art bytes it already holds for a feed
whose art URL hasn't moved, rather than reading the blob again per row and
making every row decode its bitmap afresh. Art absent now is still asked for,
since it may arrive with a later sync.
2026-08-25 23:40:26 -07:00
Greg Shuflin 86c0601e25 cli: this node is not its own audience
peer_nodes records this node like any other announcement, so the roster the
retirement confirmation counts includes it. "Wait for one of its 1 known
peer(s)" on a one-node ensemble is false, and the wait it describes never
happens — the daemon's own audience() filters correctly and answers Alone. Only
the sentence was wrong; now it is not.
2026-08-25 23:31:59 -07:00
Greg Shuflin 1f2f6e0a1b docs: phase 2 is built, and three things the implementation settled
NODE_REVOCATION.md moves phase 2 to implemented and closes three open
questions with what was actually decided rather than what was proposed:

- Where the acknowledgement protocol lives: its own ALPN, with the deny-list
  exemption expressed as an associated const that defaults to Refuse — so a
  protocol added later is gated without its author knowing the exemption
  exists.
- A retirement screen on a headless node: the daemon delivers and the CLI
  wipes, because delivery needs the daemon's live endpoint and the wipe cannot
  run while the daemon holds the store open.
- Clock skew on revoked_at_secs: this is where revocations part company with
  tombstones. A tombstone's stamp decides whether it wins a merge, so an
  unbelievable one is refused; a revocation's decides nothing, so it costs the
  record its date and not its effect. Refusing it would let a peer with a
  broken clock keep a revoked node admitted.

The retirement section is rewritten where the design reached for the opposite
of what got built. It had a retirement apply its own record locally at signing
time, and be abandonable until the first acknowledgement. Both were wrong: the
store that would hold the row is the one the wipe destroys, and a row left
behind by a retirement that never reached a peer leaves a node refusing every
connection with no way back. So it writes nothing, and once confirmed it cannot
be abandoned.

TODO.md loses what is now done. 'Revoke a node from an ensemble' becomes phase
3 — the lost-or-stolen case — and the reset entry becomes what is actually left
about it: reset still tells nobody, and keeping two controls is a decision
worth revisiting.
2026-08-25 23:31:59 -07:00
Greg Shuflin 8d92c4b8f1 android: revoked nodes on the roster, the keyphrase dialog, and a retirement screen
The FFI grows four calls: revokePeer, importRevocation, beginRetirement, and
pushRetirementRound. The first two mint or accept a record and gossip it
best-effort; the last two are the retirement split into a start and one round
of delivery per call, so a screen can stay in front of the user and say what it
is trying rather than blocking inside a wait it cannot interrupt.

On the roster: a revoked member keeps its row and is marked, and its Ping and
Sync controls are replaced by the date — both would be refused at admission
anyway. A node that finds its own credential revoked says so above its own
identity. Under the roster is the paste target for a record carried here by
hand.

'Revoke this node…' is on the node screen rather than a roster row: the row
already carries a name, an id, a coverage meter and two controls, and this is
not something to put a thumb's width from Sync. The keyphrase is its
confirmation.

Retirement is a top-level route reached by clearing the back stack, and it
swallows the system back button. That is what 'cannot be abandoned' looks like
in navigation. It signs, gossips, pushes round after round, and ends at
NodeReset.perform — the wipe half was already written there. The record is on
screen from the moment it is signed, and 'Wipe now' is always offered with what
it costs beside it.

Settings gains it above Reset, with copy that finally names the difference:
reset deletes the same data but tells nobody, so the other nodes go on
admitting a credential that never expires.
2026-08-25 23:31:59 -07:00
Greg Shuflin d016ec0ffa cli: --now does not ask a second time
The first confirmation already said this would sign, shout it over gossip
without waiting, and delete. Asking "wipe anyway?" after that re-litigates a
decision the user has made, which is how a second prompt trains people to hit
y. The question is only worth asking when the user *did* wait and the wait ran
out.
2026-08-25 23:31:59 -07:00
Greg Shuflin ef8ab981ec sync: the peer walk skips a revoked credential
ensemble_peers_freshest_first is deliberately an ordering and not a filter — a
node that has been off for a week is still a member, and silently skipping it
turns "your laptop was asleep" into "your laptop no longer syncs".

A revoked credential is the one case where the guess is not a guess. The user
said that node is no longer a member, admission refuses it in both directions,
and dialling it every pass can only end in a refusal. The filter is by cert
fingerprint, so a node that registers again — which mints it a fresh cert — is
back in the walk with nothing to un-do.
2026-08-25 23:31:59 -07:00
Greg Shuflin 06340a30af desktop: a paste target under the roster for a revocation carried here by hand
The repair path for a node that was retired with nobody listening. A record is
~140 self-authenticating bytes, so any path is a delivery path — it does not
have to be the network and it does not have to be prompt. Verified exactly as
one off the wire is; nothing is trusted for having been typed.

Under the roster rather than behind a menu: a user arriving with a record off a
wiped phone is looking at the list of nodes it is about to name. Says when a
record was not news, which is the normal outcome of importing one gossip
already delivered.
2026-08-25 23:31:59 -07:00
Greg Shuflin 6db6d463f7 desktop: the retirement screen, and the danger-zone control that leads to it
Settings → System → Danger Zone gains 'Retire this node…'. It asks once —
nothing else supplies a confirmation here, unlike revoking a peer, where the
keyphrase is the confirmation — and then hands the request up to
SynchronicityView, which replaces the entire window with the retirement
screen. No rail, no content pane, no palette: the mode is the whole screen,
and this node is on its way out.

The screen signs, gossips, and then offers the record to each peer in turn,
round after round, saying which it tried and what each said. One peer
committing it is enough. It cannot be cancelled — by the time it is up the
user has confirmed and p2p::admission::Retiring is one-way — but 'Wipe now' is
always there, with what it costs stated next to it rather than in a footnote.

The record is on screen from the moment it is signed, not only on the
emergency path: after the wipe there is no getting it back, and any path is a
delivery path for 140 self-authenticating bytes.

It ends by quitting rather than returning anywhere. There is no screen worth
returning to, and the next launch finds an empty store directory and offers
onboarding, which is the truth. That also sidesteps having to swap a live
Arc<Store> out from under every open view and the embedded daemon socket.

Deliberately not a Job, and a deliberate exception to the instant-feedback
invariant: jobs persist into the store the wipe deletes, so a retirement Job
would record its terminal state in a database its own success destroys.

ensemble::retirement splits into begin() and push_round() so a surface that
stays in front of the user can drive the wait itself. retire_node() is now
those two in a loop, and remains what the daemon calls.
2026-08-25 23:31:59 -07:00
Greg Shuflin b1ab99cca2 desktop: revoked nodes on the roster, and the keyphrase dialog that puts them there
A revoked member keeps its row and is marked, rather than disappearing: a node
that vanishes from a list is indistinguishable from one that is merely
offline, and those two want opposite reactions. Its name dims, it carries an
explicit 'revoked', and its action block says when instead of offering Ping and
Sync — both of which this node's own admission check would refuse anyway.

'Revoke…' opens a dialog that asks for the ensemble keyphrase. The keyphrase is
the confirmation, which is why there is no second 'are you sure' in front of
it. Minting runs on the background executor and the gossip broadcast on the
tokio runtime; a broadcast that fails is logged and not surfaced, because the
record is already on this node's deny-list and doc-sync carries it.

A node that finds its own credential revoked now says so at the top of the
screen, above its own identity. Without that the only symptoms are a gossip
count stuck at zero and every action failing.

The roster comes out from under CONTENT_MAX_WIDTH while I am here. Its fixed
columns already summed past 1040 and painted over the edge; it is a table
whose columns are the information, which is the case CLAUDE.md exempts from
the reading-column cap. Membership, which is a label/value list, stays capped.
The action block widens to fit four buttons and its status slot.
2026-08-25 23:31:59 -07:00
Greg Shuflin a3e5c43bc5 cli: revoke, import-revocation, and a retirement that stops the daemon before it wipes
Three subcommands and the daemon commands under them.

  syn ensemble revoke <NODE_ID>   prompts for the keyphrase; store-only, so it
                                  works with or without a daemon
  syn ensemble import-revocation  the repair path, verified not trusted
  syn ensemble retire             the whole flow

Retirement is split across two processes because it has to be. Delivery needs
the daemon's live endpoint; the wipe cannot run while the daemon holds the
store open. So the daemon signs, gossips, and pushes until a peer commits —
and this process stops it, confirms the socket is gone, and deletes. Which
also puts the destructive half in front of the person who typed the command.

The record is printed before anything else and whatever the outcome: after the
wipe there is no getting it back, and it is what repairs a retirement nobody
heard. --now skips the wait, --timeout bounds it, and a wait that runs out
asks whether to wipe anyway rather than deciding.

Declining that leaves the node serving nothing but revocation delivery until
the daemon restarts, which abandons the retirement — the retiring state is in
memory and nothing was written down. The command says so.

Also: syn ensemble members marks revoked nodes rather than dropping them (a
node that vanishes is indistinguishable from one that is merely offline), and
says loudly when this node's own credential is the revoked one.

Retire and revoke are refused over the loopback listener, same rule as
pairing: a bearer token granted to read documents must not destroy the store
it reads from. The keyphrase crosses the socket in a newtype whose Debug
redacts, because the daemon logs every command it receives.
2026-08-25 23:31:59 -07:00
Greg Shuflin d455843aa6 retirement: a state held in memory, written down nowhere
A retirement signs a revocation for this node's own cert and hands it to a
peer. It no longer puts one on this node's own deny-list, which was what
'stop syncing' used to be made of.

There is nothing to gain from writing it: the store that would hold the row
is the one the wipe is about to destroy. And there is something to lose — a
retirement that never reached a peer would leave the row behind, and the node
would come back refusing every connection with no way back short of
re-registering.

So p2p::admission::Retiring replaces it: an in-memory flag, threaded to both
halves of the handshake, set once by P2PNode::begin_retirement and never
cleared. While it is set the node serves and dials nothing but revocation
delivery, which is the one thing it still has to do. It dies with the process,
so a killed retirement leaves a node that simply did not retire.

It is deliberately one-way. Once the user has confirmed, a retirement waiting
for an acknowledgement cannot be abandoned; the ways out are the wipe and
killing the process.

ensemble::retirement::retire_node is the run all four modalities will share:
begin, sign, gossip, push until a peer commits, report. It stops short of the
wipe, which differs per host and belongs to the caller.
2026-08-25 23:31:59 -07:00
Greg Shuflin e206fff9a9 revocation: put it on the roster every modality already renders
EnsembleMemberInfo gains is_revoked and a pre-formatted revoked_at_display, so
the desktop, Android, the daemon's JSON protocol, and through it the CLI and
TUI all show the same thing without any of them computing it. A revoked member
stays on the list rather than vanishing from it: a node that disappears is
indistinguishable from one that is merely offline, and 'this node was retired'
is the more useful of the two things a blank row could mean.

this_node_is_revoked is its own field on EnsembleStatus rather than something a
frontend digs out of members, because it is not a detail of a row -- it is the
state of the whole screen, and every modality has to say it plainly instead of
leaving the user to read an endless string of connection failures.

Keyed by node, not by cert, because that is the question a roster row asks; a
node revoked, re-registered and revoked again takes the newest. A failure to
read the deny-list degrades to 'nothing revoked' rather than failing the whole
status, the same trade document coverage beside it already makes.
2026-08-25 23:31:59 -07:00
Greg Shuflin 7b15ed1c3d revocation: the delivery protocol, and the three ways one is minted
/syn/revocation/1 exists because gossip's broadcast returns when iroh-gossip
takes the payload, not when anyone applied it -- so there is nothing there for
a retiring node to wait on. It commits before it replies: the other order lets
a node wipe itself on an acknowledgement for a record the peer then loses,
which is the failure the wait exists to prevent, while this order fails
harmlessly as a retry.

It is the one protocol whose REVOKED_PEERS is Admit, and it has to be. A peer
refuses the retiring node from the instant it applies the record, so a gated
delivery would make a lost acknowledgement unrecoverable. Admitting a revoked
caller is safe because a record is verified on its own signature and not on the
caller's standing -- what is relaxed is who may speak, not what is believed.

Minting, in ensemble::retire: retire_this_node signs for this node's own cert
with no keyphrase; revoke_peer signs for another's with the ensemble key, and
refuses a keyphrase that is not this ensemble's; import_revocation accepts a
record carried here by hand and verifies it exactly as one off the wire.

peer_nodes grows a cert_fingerprint, filled from each verified announcement,
because a revocation names a cert and the roster only knew the node. A peer
seen only in the pkarr registry has no cert to name, and says so.
2026-08-25 23:31:59 -07:00
Greg Shuflin 946902d395 revocation: two channels, gossip for now and doc-sync for durably
A GossipMessage::Revocation carries no delegation cert beside it, unlike its
neighbours there: a record verifies entirely from its own contents against the
ensemble key the receiver already holds, so a cert would add nothing and a
record has to stay relayable by nodes that were not party to it.

A RevocationBatch rides between SyncHeader and DocumentTombstoneBatch, and is
the channel that carries the guarantee. Gossip reaches whoever is listening
now; a node offline when a sibling retired learns here, from whichever peer it
next syncs with -- which need never have met the node that minted the record.
Unpaginated and unconditional: 170 bytes per device the user has ever retired,
and filtering by the request's cursor would be meaningless for a set that has
no relationship to one.

Revocations part company with tombstones on a bad clock. A tombstone with an
unbelievable stamp is refused outright, because the stamp is what decides
whether it wins. A revocation's is not -- the deny-list is keyed by cert
fingerprint -- so an unbelievable stamp costs the record its date and not its
effect. Refusing it would let a peer with a broken clock keep a revoked node
admitted, which is the one direction that must not fail.

Sync protocol version 17: the two builds disagree about what message follows
the header.
2026-08-25 23:31:59 -07:00
Greg Shuflin 954800600f admission: refuse a revoked cert, in both directions
The deny-list check, beside the three cryptographic ones, read from the store
per connection like the membership next to it -- so a revocation arriving over
gossip takes effect on the next connection rather than the next restart.

The handshake becomes mutual to make the client half possible at all. A
deny-list is keyed by cert fingerprint, and nothing on the wire named the
server's, so a client could only ever be refused, never refuse; checking by
node key instead would make revocation permanent for a key and destroy the
re-admission path this design deliberately keeps cheap. The server now returns
its own delegation cert with its verdict and the client runs the same four
checks against it. Every ALPN bumps for the wire change.

A node whose own cert is revoked stops taking part rather than discovering per
connection that everyone refuses it: checked before the dial, and before the
admission stream is accepted.

EnsembleProtocol::REVOKED_PEERS carries the one exemption -- revocation
delivery, which has to reach a revoked node in both directions or a lost
acknowledgement is unrecoverable. It defaults to Refuse, so a protocol added
later is gated without its author knowing the constant exists.

DelegationCert::create_at is crate-internal and exists for the tests: a second
distinct cert for one node cannot be made by editing created_at_secs, which is
inside the signature.
2026-08-25 23:31:59 -07:00
Greg Shuflin 4f85d2db68 revocation: the record, and the deny-list it feeds
The signed statement that a delegation cert is dead, in the two authorities
docs/NODE_REVOCATION.md 2 specifies. A self-signed record is signed by the
revoked node's own key and verifies under the node it names, which is what
confines it to its own signer -- a member cannot produce one about a sibling,
because there is no key it could sign it with. An ensemble-signed record
verifies under the ensemble key and may name anybody's cert. The authority tag
is inside the signed payload, so neither can be relabelled as the other, and
the ensemble pubkey is too, so a record cannot be replayed into another
ensemble the same node key belongs to.

What it names is a cert fingerprint -- blake3 over the bytes the cert is signed
across -- not a node key forever. Admission checks a cert, so that is what a
deny-list can enforce; and re-admission becomes a plain register, which mints a
fresh cert no standing record names.

The store keeps the signer's exact bytes rather than a verdict, because every
node relays revocations it did not mint and the next receiver verifies the same
signature this one did. Append-only: a record that can be dropped is one an
attacker can wait out.

to_blob/from_blob are the same encoding in base64, for carrying a revocation
off a device by hand. Decoding is structural; verify is the only gate.
2026-08-25 23:31:59 -07:00
Greg Shuflin 46d0d41c18 docs: retirement is a screen, not a job, and a one-node ensemble skips it
Backgrounding a retirement gets you the failure the flow exists to prevent: a
device handed over un-wiped by a user who believes otherwise. The invariant it
sets aside exists so a user can go do something else, and here there is nothing
else -- the operation's purpose is to make this node cease to exist. The
machinery would fight it besides: JobStore persists into the same store
wipe_contents deletes, so a retirement job would record its terminal state in a
database its own success destroys.

So the retirement screen is the mechanism. It signs, pushes, shows what it is
waiting for, runs the wipe, and carries the emergency wipe-now beside the wait.

Adds the state machine that follows from that. The first acknowledgement is the
point of no return: before it, leaving abandons the retirement and discards the
record, since signing is cheap and repeatable; after it, the ensemble knows and
the only coherent thing is to finish.

A one-node ensemble has no audience, so it does not open a wait that cannot
resolve, does not push, and does not sign a record nobody will ever apply --
retire and reset are the same act there. The roster is the signal.
2026-08-25 23:31:59 -07:00
Greg Shuflin cce4debd68 docs: retirement waits for delivery, or the user says not to
Whether a node's wipe blocks on a peer acknowledging its self-revocation is
the user's call: on a bad link, or a device being handed over in ten minutes,
wiping without delivery and repairing the ensemble's record later is the right
trade. The choice sits on the reset confirmation rather than in Settings,
because what decides it -- a reachable peer right now -- is known then and not
weeks earlier.

Waiting is a tracked Job per the instant-feedback invariant, abandonable into
the immediate path, and one acknowledging peer is the bar: the record is
self-authenticating and rides doc-sync transitively, so one honest holder
reaches everyone.

Two protocol constraints fall out. Gossip cannot be what the wipe waits on --
broadcast returns when iroh-gossip takes the payload, not when anyone applied
it -- so delivery needs a request/response that replies after committing.
And that path must not be gated by the deny-list, or it eats itself: the peer
refuses the retiring node from the instant it applies the record, so a lost
acknowledgement would be unrecoverable. Serving it to a revoked caller is safe,
since the record is verified on its own signature and the most such a caller
can do is prove itself revoked again.

Repair path for the no-wait case: the record is ~140 bytes and
self-authenticating, so it is shown before the wipe and can be imported into
any surviving node later, without the keyphrase and without the device.
2026-08-25 23:31:59 -07:00
Greg Shuflin 77a6e24bc4 docs: revocation is ensemble state, not a DHT record
Rewrites NODE_REVOCATION.md phase 2 around two findings.

pkarr cannot carry a revocation record. Writing the registry needs the
ensemble secret, which nothing persists, so a self-revocation cannot be
published there at all; and a revoked node can roll the registry back
without holding any key, because mainline rejects a stale sequence number
only when the receiving DHT node still holds a previous item, those items
live in a 1000-entry LRU on volunteers, and nothing here republishes. The
byte budget was the least of it.

Revocation records travel over gossip and doc-sync instead, the same
division of labour purge intents already use, and are stored locally as
the deny-list admission consults.

Adds the self-signed authority: a retiring node signs its own revocation
with its own key, needing no keyphrase. That is what makes decommissioning
work from the device being decommissioned, and it answers the objection
standing against 'A reset node is never removed from its ensemble' -- such
a record is not forgeable by a sibling, for the same reason NodeAnnouncement
and PurgeIntent carry node-key signatures beside their certs.

Both authorities revoke a cert hash rather than a node key forever, which
makes re-admission a plain re-register and needs no un-revocation record.
2026-08-25 23:31:59 -07:00
Greg Shuflin 873f7ee400 Android: one logcat tag for the Rust side, and say what it is
Forwarded records were tagged with the Rust module path they came from, so
`adb logcat -s <the app>` returned silence and a raised verbosity looked
broken. The per-module tags that cost us buy nothing back: logcat's filterspec
splits at the first colon, so `iroh_gossip::net:V` parses as tag
`iroh_gossip` with priority `:` and is rejected — a tag containing `::` is
unaddressable.

So: one fixed tag for everything crossing the FFI boundary, with the record's
target moved to the head of the message where grep still reaches it. The
backend is held privately rather than installed via `android_logger::init_once`,
which would take the `log` global and cut our runtime filtering out of the path.

The tag is exported over uniffi and shown under Log Verbosity in Settings —
which tag to filter on is not guessable from outside the process.
2026-08-25 16:26:09 -07:00
Greg Shuflin 9127726ddb SQL: a value goes in a ?, and a lint that says so
`SyncRequest.since` is an `Option<String>` the *requesting peer* chooses, and
it reached `format!(" AND modified_at >= '{s}'")` verbatim in three sync
queries. rusqlite compiles only the first statement, so this was not
`; DROP TABLE` — but closing the quote and appending `OR '1'='1` defeats the
document-scope filter, and a correlated subquery is a boolean oracle over every
table in store.db, `secrets` included. That is strictly more than syncing
already grants an admitted member.

Two layers. At the boundary, `wire_time::wire_since` parses the value as
RFC3339 and re-renders it, so what travels onward is this node's own string and
never the peer's bytes; a malformed `since` fails the request rather than
quietly widening it to the whole catalogue. In the store, `SyncScope` replaces
the four hand-written `WHERE` tails those queries each built for themselves —
it hands back a predicate and the values to bind together, so there is no way
to use it that puts a caller's string into SQL text. An empty id scope now
means "no documents" instead of `IN ()`, which was a syntax error.

The rest of the tree got the same treatment while it was open: the search
queries' doc-type and provenance filters, and the set-element backfill, all
emit `?`s now. `placeholders(n)` is the one way to build a list of them.

And `just lint-sql-params`, because the bug is invisible at the call site —
whether that `format!` is a security hole depends entirely on where `s` came
from, which the line does not say. It flags an interpolation wrapped in SQL
quotes, or sitting where only a value can go, in any file that mentions
rusqlite; it deliberately does not flag an interpolated identifier or fragment,
which would mean a marker on nearly every query and no one reading any of them.
Three sites are left, all splicing one CASE expression built from closed enums,
each carrying a `// sql-literal-ok:` with its reason.
2026-08-25 03:13:31 -07:00
Greg Shuflin 3b646e4104 Bound the timestamps a peer supplies, at one decode point
Every merge rule here is last-write-wins over a stamp the *sender* wrote, so a
value far enough in the future wins every subsequent comparison for that
property on every node it reaches, and no later honest edit can displace it.
One transient bad write became permanent corruption. Tombstones were worse:
only the strictly newer of two is kept, so a far-future one could never be
superseded at all, and a far-future document tombstone additionally blocked
its id from ever being recreated and cascaded to the document's children.

Incoming stamps now decode through one function, `p2p::wire_time::
wire_timestamp`, which refuses anything more than 24 hours ahead of this
node's clock. Whatever field carried it is dropped and the rest of the record
still lands — a peer with a wrong clock should cost its own edits, not the
ability of a document to sync at all. The exception is a record's own
`modified_at`, which is its sync cursor: there is nothing sane to apply the
rest under, so the record is skipped whole. A far-future set-element *removal*
reads as no removal, which is the recoverable direction.

That helper also replaces ten near-identical inline decodes across doc_sync,
artifact_sync and gossip — three of which already called a shared helper and
seven of which had drifted away from it. All ten fell back to `Utc::now()` for
a value `timestamp_opt` rejected, which quietly promoted a malformed stamp to
the newest write in the store; that is now a rejection too.

Rejections are counted and reported once per batch, naming the peer and the
furthest-ahead stamp. A node whose clock is a year out sends a bad stamp on
every property of every document, and a line per field would bury the single
fact worth knowing.

24 hours is deliberately wide. Real skew across a phone, a laptop and a VPS is
seconds; a day covers a flat battery or a whole-day timezone error while
staying far short of what a bug or a hostile peer produces. The two errors are
not symmetric — rejecting an honest write throws away data.
2026-08-25 03:13:31 -07:00
Greg Shuflin 9768b6c014 gui: a row's presence is its subtree's, not its own
A Collection has no blob-backed artifact of its own — a podcast feed's content
is entirely in its episodes, a comic's in its pages. rows_present_locally asked
only about the row, found no refs, and answered 'here', so every collection in
the library read as fully present whether or not a single child had downloaded.
TODO.md carried this as 'aggregate sync rollup on a Collection card'; it is the
same complaint as the one that started this redesign, one level up.

content_ledger::subtree_content rolls each listed row up over its own subtree.
One recursive CTE collects every subtree at once (DocumentStore::descendants_of,
the descendant counterpart of ancestors_of) rather than walking per row — a page
holding both a comic and its series would otherwise walk three hundred pages
twice — and the cost stays bounded by what is on screen rather than by the
library.

The boolean becomes four states. Partly-here is the one it could never express,
and it is where collections normally live; such a row says '3 of 10' rather
than a word, since the numbers are the whole content of 'partly here'. A row
with no content at all renders nothing: a notebook is not 'Not here', it simply
has nothing this column is about, and a word there would be noise on every note.

Also corrected on the way through: the old check counted Thumbnail refs, so a
document whose cover art had not arrived read as missing its content. The
rollup is content-plane only. availability.rs keeps counting thumbnails, and
should — it answers 'can this be opened at all', where a missing cover is a
missing artifact even though policy never governs it.
2026-08-25 03:03:25 -07:00
Greg Shuflin 0e83ac8336 copy: the user-facing word is artifact
Every rendered string in the content-placement work said file(s). An artifact
is not a file — it is versioned, content-addressed, attached to a document,
lives in the ensemble rather than on a machine, may be held by several nodes or
none, and merges rather than clobbers. Borrowing the file mental model imports
exactly the assumptions that break here, the file model being the one where you
resolve a conflict by picking a copy. Field names stay files_*; no user reads
those.

Two findings beyond the rename.

SyncPolicy's own descriptions said document. Mirror read 'every document of
this type is kept on this node' — describing something unconditionally true
already, and not the thing being chosen. That is the origin of 'it's unclear
whether this applies to documents or artifacts', the complaint that started
this redesign, sitting in the copy under the picker the whole time.

The eviction dialogs' three sentences existed in three copies — the desktop's
delete dialog, its reclaim dialog, and Android's — which had drifted. Rendered
once in copy::eviction and carried on EvictionPlanItem, so a screen reads a
field rather than retyping a sentence about destroying data.

Also: PeerSyncCopy now has two artifact counts, separated by verb rather than
by noun — content-plane artifacts are 'fetched' (bytes arrived), catalogue-plane
ones are 'synced' (a value reconciled). The test asserts both precisely, since
if the two lines were only distinguishable by careful reading that would be a
fact about the copy rather than about the test.
2026-08-25 03:03:25 -07:00
Greg Shuflin 4f92afcb2e Android: a node reset that leaves nothing running, and nothing plaintext
The native wipe is only half of a reset on Android. Left behind were the
foreground P2P service (START_STICKY, with a retry loop ready to bring a node
back up), the scheduler's WorkManager tick — which the platform persists
across process death, so it went on waking the app to sync a node that no
longer existed — playback running in its own MediaSessionService out of a
decrypted file, that file and every other decrypted PDF and audio temp in the
app cache, and process-wide UI state describing documents that were gone.

`NodeReset` is now the one place that does all of it, in an order that
matters: playback and the scheduler stop before the wipe so nothing is reading
a cache file or starting a sync mid-delete; the wipe runs next and is
authoritative; stopping the P2P service comes after, where its own
`stopP2PNode` finds nothing to do rather than blocking the main thread on a
network shutdown. It runs off the click handler's thread, which it never did
before, and under NonCancellable, because a reset that stops halfway is the
bug this is fixing.

Two supporting fixes. `start_p2p_node` re-reads the store's keypair before
publishing a node, so a service retry that read the identity just before a
reset cannot put it back on the network seconds after the wipe. And Kotlin's
`ChangeCursor.moved` compares for difference rather than greater-than, as ADR
0041 says it must and as the Rust side already did — a counter only ever falls
because the store was replaced, and under the old rule every open screen would
have waited deaf, still showing the destroyed node.

The confirmation dialog now says what is actually destroyed, and says that the
other nodes are not told.
2026-08-25 02:25:51 -07:00
Greg Shuflin 6cee174144 reset_node: stop the node, then wipe everything the store directory holds
`reset_node` wiped the blob store and deleted `store.db`, and left the rest
of a node behind: the P2P node ran on, announcing the identity the user had
just asked to destroy and answering every ALPN against an unlinked database;
`stream-cache/` kept its plaintext audio, being a sibling of the blob store
rather than inside it; `store.db-wal` kept whatever had not been checkpointed,
which SQLite will happily recover into a freshly created file of the same
name; and the JobRunner's dedup map carried `(kind, subject)` entries for
documents that no longer existed into the new store.

Reset now stops the network first, cancels the in-flight work second, and only
then deletes — and it deletes by enumerating the store directory rather than
naming the pieces it knows about, since a wipe with a list to keep up to date
is a wipe that misses whatever was added since. The advisory lock file is the
one deliberate exception.

Leaving the ensemble is still not part of this: the other nodes go on listing
this one. That is node revocation, and stays future work.
2026-08-25 02:25:51 -07:00
Greg Shuflin 2f76e588db docs: settle the per-node policy default and the sleeping-node directive
Two of the redesign's open decisions, closed.

Defaults: KeepOnOpen on desktop, Stream on mobile. A desktop that holds nothing
until told is exactly the configuration that produces 'syncing doesn't work';
a phone that quietly accumulates every PDF it opens is the one that produces a
full device. Needs a seam that does not exist — SyncPolicy::default() is one
value for every platform, and the default belongs to the node, decided once at
initialization from what kind of node it is.

Sleeping nodes: a decision to mirror must not be lost. trigger_sync is a live
round trip, so a peer asleep at that moment never hears it and converges on its
own clock instead — and a phone asleep when you press the button is the common
case. Queue the directive. What the right behaviour actually is against a real
sleeping phone (how long a directive stays valid, whether a later local policy
change supersedes it, whether a pending queue should be visible) is a question
for experiment, and the queue is what makes those experiments possible.

TODO.md carries both as work, with the questions the queue exists to answer
written down rather than left to be rediscovered.
2026-08-25 02:12:39 -07:00
Greg Shuflin 5d6d5936d4 gui: desktop widgets reflect their job, not the click that started it
TODO.md's "done on Android, and the desktop is now the one behind". A
per-widget AsyncActionState records *this screen's call*, so a content fetch
begun by the background scheduler, by another screen, or by a peer's
TriggerSync left the button idle and cheerfully offering to start a second
copy — and forgot on navigation, because the state lived in the view rather
than in the job store.

job_binding is the desktop counterpart of Android's jobs/JobBinding.kt: a
widget names its own (kind, subject) and gets back the live row, whoever
started it. Per-view rather than the process-wide singleton Android needs — a
gpui view already owns state and a subscription, and the JobRunner underneath
is shared, so two views holding one agree by construction.

The Placement table's buttons and the Ensemble screen's Sync are on it. The
two differ in one way worth keeping straight: the Placement actions start
their job synchronously, so they refresh the index and the row is real
immediately; sync_with_peer starts its job inside the spawned task, so that
row has a genuine gap and keeps a "starting" flag to cover it. A flag that
says "trust me" is the fallback, not the mechanism.

What a screen still owns is the *result* — "Pushed 3 document(s)", "Sync
failed: …". A job carries a state and a progress message, not the sentence a
particular screen wants afterwards. The activity line beside a busy control is
the job's own words via copy::job_activity, shared with Android so a widget and
the Jobs screen never give two accounts of one transfer.
2026-08-25 02:11:54 -07:00
Greg Shuflin 4243db67ea docs: the user-facing word is artifact, and why that is the interesting claim
An earlier draft of the redesign argued for 'files' in the policy surfaces,
since artifact is the codebase's word rather than a user's. Overruled, and the
reasoning is worth recording.

An artifact is not a file in the sense a computer user already has. A file is a
path on a disk one machine owns; you move it, you copy it, you lose track of
which copy is current. An artifact is versioned, content-addressed, attached to
a document, exists in the ensemble rather than on a machine, may be held by
several nodes or none, merges rather than clobbers, and can be present as a
value while its bytes are elsewhere. Borrowing the file model is wrong in each
of those respects, and wrong in the direction that produces the bugs this
system exists to avoid — the file model is the one where you resolve a conflict
by picking a copy.

Teaching an unfamiliar word costs once. Teaching a familiar word that quietly
means something else costs forever, in misunderstandings that present as the
software being broken.

Step 7 carries the rename; steps 1-6's copy says file(s) and is wrong pending
it.
2026-08-25 02:00:40 -07:00
Greg Shuflin 53239c6259 gui+android: one Placement table, and the FFI that feeds it
Android's document detail screen had the same split the desktop just lost: a
'Sync to this node' card with its own 'Keep here:' picker, sitting above a
'Sync to other node' list whose every row had another one. Now one table with
this node as row 0, matching the desktop.

The rows come from a single new FFI call rather than being assembled in Kotlin
from ensemble members, this node's override, and per-node document status.
Those three were being composed into one table anyway, and composing them
per-modality is how the two drift — which the stored/reclaimable lines had
already done once. The content and summary strings come from copy:: for the
same reason, and the desktop moves onto them here too.

The button says Download or Push now, never one word for both: they move bytes
in opposite directions, and 'Sync' there would be the ambiguity this table
exists to remove. Each is bound to the job for what it starts — ContentFetch
for this node, Push for a peer — so work begun by the scheduler or a remote
TriggerSync reads as what it is rather than as an idle button.

Kotlin verified: compileDebugKotlin and detektDebug with type resolution. Not
run on a device.
2026-08-25 01:50:16 -07:00
Greg Shuflin 406d4240cd gui: one Placement table on the document detail screen
The Sync tab asked the same question twice, in two controls that looked
unrelated: a 'Keep here:' picker floating above a 'Sync to other node' table
whose every row had its own 'Keep here:' picker. Which node a given control
configured was the screen's hardest question, and it did not need to be a
question at all.

Now one table with this node as row 0 — node, id, content held, version,
Pin/Exclude, and one button. The two action handlers collapse the same way:
run_row_action pulls on row 0 and pushes on a peer, set_row_override writes
locally on row 0 and through node_admin on a peer. The row offers exactly one
button and the user reads it as 'make this node's copy match'; which verb that
is follows from which row it is, and never needs stating twice. It is still
labelled Download or Push now rather than one word for both — they move bytes
in opposite directions, and 'Sync' there would be the ambiguity this table
exists to remove.

The Content column is the readout sync-management.md specified and never got.
Three answers, deliberately different sentences because they call for
different actions: a count, 'all N', or '—' for a peer no evidence has ever
been recorded about — which is not the same as holding nothing. Its tooltip
gives the oldest confirmation among the files counted, so it promises a floor
rather than implying the row was checked just now.

The version column reads '—' for this node: it exists to say whether a peer
has the version we have, and here those are the same thing.

reload_placement runs after anything that moves content — a pull, a push, a
local delete — and merges rather than replaces, since a row may have a push in
flight or a confirmed remote override, neither of which is in the store and
both of which the user is still reading.
2026-08-25 01:33:55 -07:00
Greg Shuflin 3e3e460ed0 content_ledger: where one document's content sits, across the ensemble
The backing computation for the Placement table (redesign step 4), which
merges the document detail screen's 'Keep here' and 'Sync to other node'
sections — the same question asked twice in two widgets — into one table with
this node as row 0.

Scoped to the subtree, because every action on that screen already recurses:
counting only the named document would report 'no files' for a podcast feed or
a comic, whose content lives entirely in children, which are exactly the
documents this screen is most often open on.

The local row and the peer rows are different kinds of claim and the types say
so. This node's is read from its blob store and needs no confirming. A peer's
is evidence from node_content_status, so it carries the *oldest* confirmation
among the files counted — newest would let one file checked a minute ago vouch
for a hundred last seen in June — and a peer with no evidence is absent rather
than zero, since 'never asked' and 'holds nothing' call for different actions.
This node is excluded from the peer rows, which would otherwise list it twice,
the second time as evidence about the one node that needs none.

One bulk possession query rather than one per file, using the holders_of added
earlier: a comic's pages would make the naive version a hundred round trips on
a screen that opens on a click.
2026-08-25 01:25:04 -07:00
Greg Shuflin 4247a57605 Create a new test ensemble key 2026-08-25 01:23:33 -07:00
Greg Shuflin 0135ebe4d4 log: our own lines survive Android's default verbosity
LogVerbosity::Normal — the default — maps to Warn, which silences every info!
this codebase writes. That cost a real debugging round: a logcat capture of a
minutes-long sync came back full of SELinux noise and quinn warnings with not
one line from the code under investigation, and no way to tell 'the fix isn't
built' from 'the fix is built and muted'.

Our targets now floor at Info regardless of verbosity; Verbose/Verbose2 still
raise them further. iroh keeps its old level, since iroh is the reason a low
default exists at all — this buys diagnosability without reopening the spam it
guards against, and Normal still admits a handful of lines per sync rather than
a stream.

Also updates the emulator TODO with what that capture did show: interface
enumeration refused by the app sandbox (netlink_route_socket, sysfs net), and
QUIC sends failing EIO to a global IPv6 destination from a deprecated
site-local source. Those fit together — blind to its interfaces, the node picks
an unusable local address — and would explain why Android-initiated syncs drag
while desktop-initiated ones finish in half a second. Worth noting the SELinux
domain is untrusted_app, which is every sideloaded app, not only emulators.
2026-08-25 01:15:36 -07:00
Greg Shuflin f7ebe46487 TODO: reset_node leaves a running node, and plaintext, behind
Reported from Android: after Reset node the app flashes state from the previous
store and the ensemble behaves oddly, enough that wiping the app's storage from
Android's own settings became the reliable way to start clean.

Reading reset_node, three things outlive it. The P2P node is never stopped and
captured its own Arc<Store> at start, so after a reset the process is still
joined to the old ensemble's gossip, still announcing the old node key, and
still answering every ALPN — against a SQLite handle whose file has been
unlinked. The stream cache survives, and it holds plaintext audio: it is a
sibling of the blob store, so wipe_all_blobs never sees it. And in-memory state
on both sides of the FFI survives, which is the likeliest reason the UI flashes
what it does.

Filed under Security rather than Reliability because the first and second are
security properties: an identity the user believes they destroyed is still on
the network, and decrypted content outlives the wipe meant to remove it.

Note only — no fix here.
2026-08-25 00:58:43 -07:00
Greg Shuflin 13af946653 ensemble: one pkarr client for the process, not one per lookup
Every registry lookup built a fresh pkarr::Client. That is not a handle to a
remote service — building one stands up a Mainline DHT node: its own UDP
socket, its own routing table, and a cold bootstrap through the well-known
routers before it can resolve anything. A node's log shows the cost plainly:
three 'Mainline DHT listening address' lines on three ports within six
seconds, each followed about three seconds later by the same two-member
answer. Almost all of that three seconds is bootstrap, not lookup.

It was not only a slow start. The gossip bootstrap retry loop repeats the
lookup for the life of the process, so a new DHT node was churned into the
network on every retry, forever, on every node.

Now one shared client, which is what a DHT wants anyway: a routing table gets
better the longer it lives, and the client's own cache can answer a repeat
lookup without touching the network. Four call sites move onto it — gossip
bootstrap, the bootstrap retry loop, ensemble join's membership publish, and
the CLI's two diagnostics.

A build failure is deliberately not cached: it is usually a socket the OS
would not hand over, which can pass, and caching it would leave discovery off
for the life of the process.

The fetch is now timed, because that is the number that says whether this
holds — a first lookup still pays bootstrap, later ones should not, and a
steady three seconds every time means something is building a client per call
again.
2026-08-25 00:49:51 -07:00
Greg Shuflin 8649c92029 sync: let a phone be told to reconcile at all
'Sync both ways' against an Android node exchanged catalogues and then failed
to make it fetch anything, reporting 'this node hasn't finished starting up yet
— try again shortly'. Nothing was starting up. The node-admin handler holds its
JobRunner in a cell filled after P2PNode::start, and only gui-app's scheduler
driver and the daemon's server ever filled it — Android never did, so every
TriggerSync, ListJobs and CancelJob aimed at a phone was refused, permanently,
with a message promising that waiting would help.

Wired in start_p2p_node, before the P2pRuntime is published, so there is no
window at all. The runner is cloned rather than newly constructed: JobRunner's
dedup map is Arc<Mutex<..>> inside, so a clone is the same runner, while a
fresh one would silently stop deduplicating across this seam.

This is what step 2's directive rested on, so on Android it did not rest on
anything. Caught by the timing instrumentation from the previous commits, in a
GUI-initiated sync that otherwise completed in half a second.

Also documents the failure mode where it can bite again: a modality that
forgets to wire its runner does not fail loudly, it refuses every remote
trigger with a string that reads as transient.
2026-08-25 00:40:48 -07:00
Greg Shuflin f16b0e8ecc sync: report a slow connection at a level a phone can see
The dial/handshake timing added in the previous commit was debug-level, which
on Android means invisible: its verbosity has no debug rung — Normal maps to
Warn, Verbose to Info, Verbose2 to Trace — so reading it would have meant
turning on everything iroh says as well.

Promoted past a one-second threshold instead of raised outright. Self-limiting:
a node mirroring a library opens a connection per document and a line each
would drown the log, but a connection that takes more than a second is no
longer a rounding error against the work it was opened to do, and is worth a
word.
2026-08-24 23:47:15 -07:00
Greg Shuflin cae8576663 sync: say where a pass spent its time
A sync of one podcast and twenty lightweight episode documents between two
nodes — a fresh ensemble, both members live — took minutes, and nothing
recorded is able to say which part. The summary counts documents and files; the
Jobs screen has start and finish times per job but not per phase; and the three
phases fail slowly in unrelated ways, so one elapsed number could not tell them
apart anyway.

sync_with_peer now logs its catalogue exchange, remote trigger, and content
passes separately, run_all_passes logs its three passes, and run_catalogue_pass
logs per peer including the failing case.

EnsembleEndpoint::connect logs dial and handshake apart, at debug, for every
protocol. That is the number I most expect to matter and the one nothing
exposed: this cost is paid per *protocol*, not per byte, and a single 'sync
both ways' opens doc-sync, then node-admin, then artifact-sync, then blob-sync.
Against a directly-reachable peer it is milliseconds; from an emulator behind
two NATs, reachable only by relay, it may be the entire wall clock.

Diagnostic only — no behaviour change.
2026-08-24 23:14:38 -07:00
Greg Shuflin 891c0e0632 p2p: bound every dial, and try the peers gossip heard from most recently first
Reported: subscribing to one podcast on a phone — one feed document, ~20
lightweight episode children, no content — and syncing to the desktop took
many minutes. The data is trivial; the time was going somewhere else.

Two causes, both about the peer walk rather than the transfer.

doc_sync was the only protocol dialling without a timeout. blob_sync bounds a
connect at 15s and node_admin at 10s; doc_sync had nothing, so a catalogue sync
against a peer listed in gossip but no longer answering ran until its caller's
budget expired — three minutes, per peer, in the scheduler's walk. The bound
goes on EnsembleEndpoint::connect, which every protocol dials through, rather
than on a third call site.

And the peer list is not what its name said. reachable_ensemble_peers performed
no reachability check: gossip rows are never pruned, so nodes retired long ago
are still in it, and callers walk it in series. Renamed to
ensemble_peers_freshest_first and ordered by last_seen_at, so the live peer is
reached before a dead one's dial budget is spent.

Ordering, not filtering, on purpose: a node that has been off for a week is
still a member and may well answer, and skipping it would turn 'your laptop was
asleep' into 'your laptop no longer syncs'. The worst case is still
peers × budget because the walk is serial — TODO.md carries what is left, with
the pruning question noted as really being node decommissioning.

Found while reproducing with the two-node test harness, which surfaced the
other half of the story: that ensemble had four members, not two.
2026-08-24 23:04:09 -07:00
Greg Shuflin b754adecf6 stores: bulk holder lookup for a set of content keys
Groundwork for the document detail Placement table (redesign step 4), which
needs 'which nodes hold this subtree's files' — one query rather than the
per-key nodes_holding loop, since a comic's pages or an album's tracks would
make that a hundred round trips on a screen that opens on a click.

Unused so far.
2026-08-24 22:49:10 -07:00
Greg Shuflin 6a5463f7f8 Update test ensemble key 2026-08-24 22:38:09 -07:00
Greg ShuflinandClaude Opus 5 0aa62e40c9 docs: record the open question about where the desktop transport sits
The bottom-left action row is what the design document draws, and it is what
shipped. The alternative — a vertically-centred left flank beside the artwork,
secondary mirrored right, a three-region stack between them, and a pane around
80px instead of 130px — is deferred rather than declined.

What decides it is the visualization slot, which is currently empty. With the
transport inside the stack, turning a visualization on pushes it down by the
slot's full height, which is the design document's own "landmarks don't shift"
invariant being broken by the layout written to protect it. On a flank it moves
by half that. Arguing about how much that costs against a region nothing draws
in is not worth doing, so it waits until there is something to look at.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUguiyAywfkRPDSFju4u5K
2026-08-24 22:28:26 -07:00
Greg Shuflin d3b539c6e9 sync: put the deficit on screen, for this node and for any peer
A policy row showed stored bytes and nothing else, which makes Mirror
unfalsifiable: a policy that is working and a policy that binds to no
documents at all render identically. That is the readout missing from the
reported failure — 'I set that node to mirror my music and no music arrived'.

Each row now carries its content ledger, and the three states it distinguishes
have three different fixes:

  0 of 1340 file(s) held  +  1340 file(s) missing   pending; wait, or Sync
  No files of this type                             the policy matches nothing
  0 of 1340 file(s) held  (no deficit line)         an Exclude up the tree

Telling the last two apart needs a denominator, so TypeLedger gains
files_total/bytes_total — one more accumulator in a walk that was already
visiting every row.

SyncConfig carries TypeLedger per type instead of a bare byte count (ALPN
/syn/node-admin/2), so a *remote* row shows the same numbers. That is the
premise of remote administration finally being met: choosing what another node
should hold is guesswork without seeing what it holds now.

Both modalities render from one copy::ContentRowCopy. Two things fall out of
that: eviction::reclaimable_bytes_by_type and its FFI are gone, since the
ledger's bytes_unwanted was the same number reached by a second code path; and
the remote row stops saying 'N stored on this node' about a different node.

Two bugs fixed on the way. Android patched a changed policy in place instead of
re-reading, which for a deficit is exactly the misreading these lines prevent —
and its initial load ran getSyncPolicies() on the main thread, which now walks
the ledger. Both go through Dispatchers.IO.

Also: From<StoreError> for SyncError delegates to the wrapped error rather than
flattening, so the ledger's cross-store reads keep reporting Busy as retryable
instead of as a bug.
2026-08-24 22:28:09 -07:00
Greg Shuflin ecc0d76b5e content_ledger: say accurately when a type row can be all zeroes
by_type gets a row for any type with a blob-backed content artifact, which
includes one whose content is neither here nor wanted. Absence and zeroes mean
the same thing to every caller; the doc comment claimed only the first
happened.
2026-08-24 22:28:09 -07:00
Greg Shuflin ad9b711840 sync: take the peer's name off the summary, not the screen's own row
sync_with_peer already resolves a display name for the peer, and its fallback
(a short id) reads better inside "X is syncing its own side" than the Ensemble
screen's "(unnamed)" placeholder. Also squares the doc's ContentLedger sketch
with the type that shipped.
2026-08-24 22:28:09 -07:00
Greg Shuflin d3a737b323 docs: record the sync-model correction where the old rule is stated
sync-management.md's 'every node satisfies its own policy by pulling' was
written as both a transport invariant and a product rule. The first is right
and unchanged; the second made 'make the server hold all my music' something
a user could set but not act on. Correct it in place, in the section that
states it, rather than leaving the correction only in the newer doc.

Also drops the phase-5 note describing the gap that closed, marks steps 1-2
of the redesign done, and lists steps 3-7 in TODO.md.
2026-08-24 22:28:09 -07:00
Greg Shuflin b67b5a94fe sync: 'Sync' means both nodes now, and reports files first
Two changes that only make sense together.

Directing a peer. sync_with_peer exchanged catalogues bidirectionally and
then ran content passes computed against the *local* node's wants, so setting
a peer's policy to Mirror from here and pressing Sync did exactly what it was
built to do and nothing the user asked for: the catalogue crossed and no
content moved, because the only node computing wants was this one. It now
sends node_admin::trigger_sync after the catalogue exchange and before its own
content pass — before, because a peer made to wait out a multi-minute download
here looks, from its own screen, identical to a peer that was never told. The
outcome rides back as RemoteReconcile so a frontend can distinguish 'wait' from
'that node never heard you'; the button says 'Sync both ways'.

This demotes sync-management.md's 'every node satisfies its own policy by
pulling' from product rule to transport invariant. Pull is still how content
moves and no node pushes uninvited — what changes is that instructing a peer
is a first-class act rather than an implementation detail behind a picker.
TriggerSync can still only cause fetching, never eviction.

Reporting. Four frontends hand-rolled this status line, all leading with a
document count and three calling blob transfers 'artifacts'. A catalogue sync
moves document rows whether or not a byte of content follows, so 'synced 1340
doc(s)' was a confident, accurate sentence printed in exactly the situation
reported as broken. copy::PeerSyncCopy is the one formatter; the file count
leads and is shown even at zero, because zero was the missing answer. Android
takes the whole line from Rust instead of concatenating its own.

Also: sync_with_peer had no guard against targeting the local node, which
reachable_ensemble_peers can return — harmless before, a node ordering itself
around over the network once a remote trigger is attached.

Kotlin unverified beyond detekt; no device in this sandbox.
2026-08-24 22:28:09 -07:00
Greg Shuflin 35ae5fc34a sync: one content ledger where three disagreeing walks were
The content plane was tallied three times over the same rows, in three
modules. Store::local_content_bytes_by_type counted every blob-backed
artifact including Thumbnail; eviction::reclaimable_bytes_by_type counted
only PrimaryContent/Attachment — so the two numbers printed on one
SyncPolicyControl row were computed over different sets. The third,
scheduler::compute_wants, was private and its result never shown, which is
why a Mirror policy that had silently bound to nothing (wrong type, an
Exclude up the tree) looked exactly like one that was working.

content_ledger::content_ledger walks once and answers all three: bytes_here,
bytes_missing (the deficit, itemized as the scheduler's content-pass work
list), bytes_unwanted. Thumbnails are out of all of them — they ride the
catalogue plane, so a dashboard under a policy picker overstated what the
policy governs by including them. The resolution rule (nearest
ancestor-or-self override, else the type policy) and its helpers move here
too, so 'want' and 'keep' can no longer drift apart in separate copies.

The deficit is not surfaced yet; that is step 3. This is the one walk it
will read from. Desktop settings now pays for one walk per Sync-tab visit
instead of two.
2026-08-24 22:28:09 -07:00
Greg Shuflin 79a7b6827d docs: a UX redesign of the sync system, denominated in content
The two-plane model in sync-management.md is built and correct; what was
never designed is how a person sees whether it is being honoured. Three
faults follow from that: an action on one node cannot satisfy an intent set
for another (pull-only, but the UI never says which node a button commands),
nothing anywhere reports a deficit (compute_wants is private and its result
unshown, so Mirror is unfalsifiable), and every count is denominated in
documents while every failure is a file that did not arrive.

Proposes a public ContentLedger (held/missing/reclaimable, one walk),
Reconcile-with-peer that also fires TriggerSync on the peer, one Placement
table per document replacing the Keep-here/Push-now split, and a vocabulary
that says files where policy governs files.
2026-08-24 22:28:09 -07:00
Greg ShuflinandClaude Opus 5 1ae685b83e player: no number in the glyph; 15 seconds each way
The skip interval is heading for a user setting, and an icon with "10" drawn
into it is a second place that number lives — the one place that can't follow
the setting. Android was picking between Material's numbered Replay5/10/30 and
Forward5/10/30 by matching on the configured seconds, with an unnumbered
fallback for anything else; that fallback was the honest case all along.

Both players now draw a plain circular arrow either way — lucide
`rotate-ccw`/`rotate-cw` on the desktop, Material's `Replay` and the same glyph
mirrored on Android, so the pair reads as one icon pointing two ways rather
than as two unrelated ones.

The interval is written where it can be derived from the value that produces
it: `step_label` behind a tooltip on the desktop (transport buttons had none;
without the number in the glyph they need one), and `stepDescription` as the
content description on Android. Neither can go stale against the button.

Default is now 15 seconds each way rather than back-10/forward-30, and it sits
in the agent — `SKIP_BACK_SECS`/`SKIP_FORWARD_SECS` and `SKIP_SECONDS` — so
making it configurable is a matter of where the value comes from and nothing
else.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUguiyAywfkRPDSFju4u5K
2026-08-24 19:07:46 -07:00
Greg ShuflinandClaude Opus 5 43d759aa52 docs: ADR 0046 — the player's regions are fixed, its contents are configured
ADR 0045 got Music and Podcasts onto one player per modality but said nothing
about what a player *is*, so each one kept the shape its first tenant happened
to have. This records the shape: four regions in a fixed order, an agent
configuring what goes inside them and never where they sit, and the invariants
that order exists to protect — metadata centred over the scrubber, the
visualization slot directly above the timeline, the primary transport anchored
so an optional control can't move it, play/pause filled because size alone
doesn't carry "strongest control".

It also records the two things that look like drift and aren't: the desktop and
mobile time/transport arrangements differ because ~340dp of phone width can't
hold two time labels either side of a usable scrubber, and `Visualization`
ships with only `None` because the value of the slot is that filling it later
touches no layout.

Also renumbers 0045 in its own heading and in the index, where it still said
0044 — the number 0044 already belongs to ensemble-private node names.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUguiyAywfkRPDSFju4u5K
2026-08-24 18:52:40 -07:00
Greg ShuflinandClaude Opus 5 dcc2904f1c android: one audio player, four regions, configured by capabilities
The mirror of the desktop change. Android had the opposite problem: not one
player that had grown two tenants, but two players that had never been one.
`EpisodePlayerScreen` carried a scrubber, time row and transport inline at its
foot; `MusicScreen` carried a private `MusicPlayerBar` doing the same job in a
different order, with a differently-shaped play button and its own idea of what
"loading" looks like. Nothing was shared but `MediaSlider`.

`ui/PlayerControls.kt` is now the one player, laid out as the design principles'
regions in a fixed order — artwork, metadata, visualization, timeline, primary
transport, secondary actions — with `PlayerCapabilities` deciding what goes
inside a region and never where it sits. `PODCAST_PLAYER` and `MUSIC_PLAYER` are
two values of that type, sitting in the screens that host them.

Where it deliberately differs from the desktop, and why: the desktop puts the
elapsed and trailing times either side of the scrubber and anchors the transport
to the left of a wide row. Neither survives a phone — ~340dp of content width
minus two time labels leaves the scrubber a stub, and a left-anchored transport
puts the play button under nobody's thumb. So the times sit below a full-width
scrubber and the transport is centred, which is the same width-driven split the
app already makes between two-column and stacked label/value lists.

The primary pair is a `TransportStep`, as on the desktop:

- Podcasts get `Skip(10)`/`Skip(30)`, handled inside the widget through
  `onSeek`, replacing the screen's own back-10/forward-10 buttons.
- Music gets `Adjacent`, and gains Previous/Next for the first time.
  `MusicScreen` captures the track list the tap came from (`playbackContext`),
  so browsing off to another artist mid-song doesn't redefine what that song's
  Next means, and `adjacencyOf` greys the pair out at either end and for a
  track with no surrounding list at all. Stepping while playing keeps playing.

The secondary cluster is a `@Composable RowScope.()` slot rather than a field.
That is what keeps `PlaybackSpeedControl` podcast-only and inside `podcast/ui/`
per ADR 0045 — the shared player never learns what is in the slot — and it is
the Compose-idiomatic spelling of a region whose contents belong to the host.

Also here:

- Play/pause is a `FilledIconButton` at 64dp against 52dp flanks. "Play/pause
  should be the strongest visual control" doesn't survive being one more
  outlined glyph in a row of them, and both are well past the 48dp target.
- Podcasts' trailing time counts down (`TrailingTime.REMAINING`).
- `formatDuration` moves from `podcast/ui/PodcastUtils.kt` to `ui/MediaTime.kt`,
  with `formatRemaining` beside it. A player shared by every audio agent must
  not reach into one of its own tenants' packages for a clock.
- The step glyphs map to Material's numbered replay/forward icons for 5/10/30s
  and fall back to an unnumbered circular arrow otherwise, rather than to a
  glyph claiming the wrong number. The content description states the real
  interval either way.
- Music's blob-availability line moves out of the player to a strip above it —
  the same move ADR 0045 records for the desktop's Stream-policy fetch line.

`Visualization` ships with only `NONE`, as on the desktop: the region is real
and its place in the order is fixed, nothing draws in it yet, and adding
something touches the enum and one composable rather than the layout.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUguiyAywfkRPDSFju4u5K
2026-08-24 18:51:27 -07:00
Greg ShuflinandClaude Opus 5 1220e4608c gui: the audio player is four regions and a capability set
docs/audio-player-ui-design-principles.md describes one player shared by Music
and Podcasts, laid out as four regions in a fixed order — metadata,
visualization, timeline, actions — configured by capabilities rather than by a
mode. The desktop had a single horizontal row instead: a 240px metadata column
on the left, the scrubber flexing in the middle, and every control the agent
offered piled at the right, so adding the rate pill moved the play button.

The bar is now a column, and each region is its own function:

        Primary metadata          centred over the scrubber, not over
       Secondary metadata         the transport cluster

       Optional visualization     collapses to nothing when absent

 elapsed ━━━━━●━━━━━ remaining

 [ back  ▶  forward ]      [ rate  stop ]

The actions row is `justify_between`, not centred: the primary cluster is
anchored left so a secondary control appearing or disappearing on the right
cannot move the button the user reaches for without looking. Play/pause is
accent-filled (`transport_button_primary`) and larger than what flanks it —
"play/pause should be the strongest visual control" doesn't survive being one
more grey glyph in a row of them.

`SpeedControl::{Shown, Hidden}` becomes `PlayerCapabilities`: artwork,
visualization, trailing_time, primary_actions, secondary_actions — one field
per region, in the order the regions appear. `PlayerControls` knows nothing
about music or podcasts; `music_player()` and `podcast_player()` are two values
of the same type, and the diff between them is the whole difference between the
agents' transports.

The primary pair is a `TransportStep`, and the two agents genuinely differ:

- `Skip(secs)` seeks *within* the track, handled in the bar — podcasts get
  back-10/forward-30. A relative seek is transport; the owner has no opinion.
- `Adjacent` steps *between* tracks, emitted as PreviousRequested/NextRequested
  — only Music knows what the next track is. It captures the track list it was
  activated from (`playback_context`), so browsing off to another artist while
  a song plays doesn't redefine what that song's Next means, and it reports
  `NowPlaying::adjacency` so the pair greys out at either end and for a track
  with no surrounding list at all. Stepping while playing keeps playing;
  stepping while paused just moves the selection.

Also from the principles, and from what the old bar got wrong:

- The trailing time can count down (`TrailingTime::Remaining`). Podcasts do:
  an hour-long episode's total length is a fact the user already knows.
- `format_time` gains an hours field. `M:SS` rendered an 83-minute episode as
  `83:20`, which reads as neither a clock time nor a duration.
- The scrubber's hit strip is 24px around a 4px groove. The interactive area
  has to be substantially larger than the visible line; it was 20px with the
  groove positioned by hand-tuned offsets, which is now derived from the
  strip's height so widening the target can't un-centre the line.
- Music's bar shows album art for the first time. It has the cover decoded
  already for the library the track was picked out of, so `NowPlaying::image`
  became a `TrackArt` of `Url` (podcasts, fetched by gpui) or `Decoded`
  (music), rather than Music re-encoding an image it is holding.

The player is capped at `CONTENT_MAX_WIDTH` and centred. Uncapped on a
maximized 4K window the elapsed and remaining times sit a metre apart with the
metadata stranded between them and the two ends stop reading as one player.

`Visualization` ships with only `None`. The region is real and its place in the
order is fixed; nothing draws in it yet. A spectrum analyzer means tapping the
rodio sample stream, which is its own change, and adding it touches this enum
and `render_visualization` and no layout.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUguiyAywfkRPDSFju4u5K
2026-08-24 18:38:54 -07:00
Greg Shuflin a92b3c154b audio: assert 1x is transparent, not merely non-empty
The unity-tempo test asserted only that SoundTouch emitted more than
40k frames for 44.1k of input — true of an output 10% short, or one
resampled to a different rate, or one that had passed through a stray
pitch shift. It would not have caught the class of bug it exists for.

Assert the property instead: at 1x the stretch stage should be as if it
weren't in the chain — identical length, and audio that matches the
input. Measured against a real MP3 the error is a flat -69 dB floor,
worst 100 ms window -67 dB, so the 40 dB floor asserted here is wide
enough never to flake and tight enough to catch a real regression.

The measurement is also the answer to "1x sounds muddy on the desktop":
it doesn't, to within a noise floor far below the source's own coding
noise.
2026-08-24 18:18:54 -07:00
Greg Shuflin 091fe3f6f4 audio: report the decoded format against the device's on every load
Chasing a report that podcasts play slow meant reconstructing, from
scratch, what rate the file decoded at and what rate the output device
had negotiated — the two numbers that between them explain every
uniform-speed-and-pitch complaint, and the two nobody could see. Log
them, with the applied rate, once per load at info (`-v`).

They routinely differ: rodio negotiated 44.1k on a machine whose
PipeWire graph is locked to 48k, and the mixer resamples between them.
That is fine and measures exact — which is the point of printing it,
so the next such report starts from the numbers instead of a bisect.
2026-08-24 18:18:54 -07:00
Greg Shuflin 0f4e618362 podcasts: an episode the bar merely holds is not a paused episode
Opening an episode screen hands its track to the shared transport bar as
*pending* (PlayerControls::set_pending) so the bottom bar's Play works
without the in-page Play being pressed first. Three screens read that as
playback: they compared their episode id against now_playing_document_id
and, finding a match with is_playing() false, rendered the episode's own
Play button as a disabled "Paused" — the moment the screen opened, before
anything had played, and inert when clicked.

Split the two states apart with PlayerControls::has_audio_session (the
predicate set_pending already computed inline) and pair it with the id
match at all three call sites. The episode and queue buttons stop being
inert in the bargain: where the bar really is holding the track they now
read Pause/Resume and toggle it, rather than reporting a status.
2026-08-24 18:18:54 -07:00
Greg Shuflin fba51142e4 Some audio player design principles 2026-08-24 18:18:54 -07:00
Greg Shuflin ca44c1afd5 gui: put Music and Podcasts behind the one transport bar
The desktop had two players. `components/player_controls.rs` was written for
Podcasts; `agents/music.rs` carried its own copy of the same bar — metadata
column, play/stop buttons, scrubber, time labels, position ticker, MediaSession
wiring — about 350 lines, and drifting: no rate control, no loading state, and
a hard-coded "Unknown Artist · Unknown Album" where the podcast bar showed real
metadata.

They diverged over one thing only, which is how audio is *sourced*: podcasts
have a URL to stream, Music has already resolved a track out of the blob store
or off a peer and wants the decoder built only when the user presses Play. So
that is the seam, and nothing else is per-agent.

The lib's MusicPlaybackRuntime is split. What remains is music::SelectedTrack —
a resolved track and nothing else, owning no AudioPlayer and driving nothing;
its play/pause/stop/seek/position functions are gone, because a transport was
never its job. music::ensure_sink_loaded is the bridge: the caller hands over
its own player at the moment playback starts, which is what keeps selection
lazy — browsing a library still never opens the audio output device.

NowPlaying's audio_url becomes an AudioSource of Stream / Resolved / Silent,
and PlayerControls grows a load() beside play() and set_pending(): put this
track in the bar, silent, replacing whatever was there. That is what selecting
a track in a library means, and neither of the other two said it. The rate
control is opted out of rather than removed (SpeedControl::Hidden) — a rate
control over a song is a novelty, and the shared bar shouldn't grow one just
because its other tenant needs it.

Two fixes fell out of the merge rather than being ported:

- the ticker's audio snapshot now happens on the background executor. Music's
  own ticker had moved it there deliberately (a decode holds that lock for
  hundreds of ms, and a main-thread wait on it stutters the window); the
  podcast ticker had not, and would have inherited the stall.
- set_pending no longer flushes progress. Folding it onto load() would have
  had it emit end-of-track PositionChanged for an episode that had just
  reported Finished, writing a position over what the owner acted on.

Music also gains what only the podcast bar had: a real subtitle (its codec
line), a loading state, and playback errors shown on the bar the user pressed
Play on rather than in the list they came from. ADR 0044 records the rule.
2026-08-24 18:18:54 -07:00
Greg Shuflin f4faadbc68 android: per-agent audio handles, and a speed control for podcasts
Two faults in the same transport, fixed together because they are the same
fault: state that belongs to one agent leaking into another.

**Shared playback state.** Playing a podcast and then opening Music showed the
Music bar sitting at the podcast's position — greyed out, because Music had no
track of its own, but scrubbed to somebody else's playback. One
AudioPlayerManager is right (the device plays one thing at a time, and the
ExoPlayer lives in a MediaSessionService so it outlives every screen), but
*what is loaded* belongs to whichever agent loaded it. So agents now take an
AgentAudioPlayer keyed to their PlaybackSource: it reads as idle whenever
another agent owns the transport, and every command is a no-op then too, so a
coroutine still running on a screen the user has left cannot reach into what
replaced it. Loading claims the transport — the one operation that is meant to
take it. A reader that wants the app-wide truth (the home screen's live-state
slot, which asks whose row is playing) takes AudioPlayerProvider.transport.

PlaybackState grows a title so the Music bar can name what is playing after the
screen that started it was rebuilt, and stops naming it the moment a podcast
takes the transport.

**Playback speed.** Android had no rate control at all, where the desktop has
had one since player_controls.rs. PlaybackSpeedControl is its counterpart: a
pill opening a menu of the same presets, the feed's remembered rate, and a
Custom… slider, with the desktop's semantics — a preset changes the session,
a confirmed custom rate is what the feed remembers. Persisted through a new
PodcastFfi::save_custom_speed onto the PodcastFeedCustomSpeed property the
desktop already writes and syncs, so a rate set on either node is the rate the
next episode starts at on the other.

Deliberately podcast-only. The rate is set on every load — reset to 1x by
loadUri — because ExoPlayer's speed is a property of the player, not the item,
and would otherwise carry a podcast's 1.5x onto the next song.
2026-08-24 18:18:54 -07:00
Greg Shuflin 459f1cdfed TODO: drop the relay-URL sealing item; sealing it would hide nothing
The item asked whether gossip's plaintext relay_url is a location leak.
It is not one worth closing:

- The value today is one of iroh's four default n0 relays, chosen by
  latency (use1-1/usw1-1/euc1-1/aps1-1.relay.n0.iroh.link), so it
  discloses a continental region, not a provider or a machine.
- More decisively, iroh already publishes each node's home relay *and*
  every discovered direct socket address under the node pubkey, in the
  clear, to dns.iroh.link and — since we opted into DhtAddressLookup —
  the mainline DHT. Node pubkeys come free from the ensemble registry,
  which is world-readable given only the ensemble public key. The
  observer the item posited already has IP addresses; a sealed region
  behind that is no wall at all.

Also fixes a stale hostname in the self-hosting item: iroh's prod
defaults dropped the iroh-canary label.
2026-08-24 16:54:58 -07:00
Greg ShuflinandClaude Opus 5 6e13f74d0a security: the pkarr registry stops carrying node names
The ensemble registry is a DNS packet on the mainline DHT, fetched with
nothing but the ensemble public key -- which syn ensemble info prints and the
pkdns bootstrap link embeds. Every entry carried name_len || name_bytes in the
clear, so a device label, and through it its owner, was world-readable to
anyone who had ever seen that key, a removed node included.

Sealing it there was the wrong trade. publish_membership runs only during
ensemble init/register, while the ensemble secret is briefly in memory, and no
code path ever rewrites the record -- so the name in it was a snapshot from
join time that no later rename reached. It cost privacy to publish a value
that was already drifting, and it cost packet budget: variable-length entries
meant how many members fit in pkarr's 1000 bytes depended on how long people's
laptops were called. Entries are now fixed-size at 105 bytes, and six still
fit.

The roster loses nothing gossip does not replace: names arrive sealed over the
topic and persist in peer_nodes, so a member reads as (unnamed) only until it
first announces itself. The version byte stays at 1 and the decoder takes a
fixed-length prefix, ignoring whatever follows, so a record published by an
older build still bootstraps -- its trailing name simply never read. A test
covers exactly that, since losing it would cost existing ensembles their
bootstrap.

syn ensemble dht-peers and ensemble info list registry entries without names
rather than borrowing one gossip happened to supply: those listings are what
is *published*, and a placeholder is the honest answer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkup9bGFrnEaBVG8TQTJrS
2026-08-24 14:35:59 -07:00
Greg ShuflinandClaude Opus 5 a33f20d7eb security: seal node names on the gossip wire
Gossip is deliberately not admission-gated -- GATED_ALPNS says why: it
authenticates per message instead -- and the topic is
derive_topic(ensemble_pubkey). So anyone who learns the ensemble *public* key,
which syn ensemble info prints and the pkdns link embeds, can join the swarm
and read every node name in the ensemble, rebroadcast every 60 seconds.
Signatures made those announcements unforgeable; they never made them private.

NodeAnnouncement.node_name is now a SealedName: base64url of nonce ||
ChaCha20-Poly1305(name), under blake3::derive_key over the default vault key.
That key is already derived from the ensemble *secret* and already stored on
every member wrapped under its own node key, so every member can open a name
and holding the public key cannot -- no new key material, no distribution
step, nothing new on disk. A separate derivation rather than the vault key
itself keeps a sealed name and a document blob from being interchangeable
inputs to the same AEAD.

Load-bearing details, each with a test: the signature covers the sealed bytes
rather than the plaintext, so a receiver checks authenticity before and
independently of decrypting; the node pubkey is the AEAD's associated data, so
a sealed name cannot be lifted onto another member's announcement; the
plaintext is padded to a 16-byte multiple, so 'phone' and 'laptop' are the
same size on the wire; every failure -- no key, over-long name, RNG -- yields
an announcement with no name at all rather than a plaintext fallback; and a
name this node cannot open leaves the peer unnamed, not rejected, since the
cert and signature have already established a member said this.

The three-node gossip integration test now names node B and asserts A shows
that name, so the round trip is covered over a real link and not only in
process. Opened names are stored in the clear in peer_nodes -- that is this
node's own disk, guarded by stores::permissions.

NodeRuntime::start loads and decrypts the default vault key before starting
P2P rather than after, since gossip needs the key derived from it. A node
without one is a node without an ensemble, which this already refused to start
for; it now refuses before opening an endpoint.

TODO gains the question this leaves open: relay_url still travels in the
clear in the same announcement, and it is coarse location data.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkup9bGFrnEaBVG8TQTJrS
2026-08-24 14:35:49 -07:00
Greg ShuflinandClaude Opus 5 b9e26f75de security: /version stops disclosing the node name; pairing hands it over instead
The loopback listener's module doc claimed every field of /version was already
public. True of node_pubkey, which is published to the mainline DHT. Not true
of node_name: 'Greg's work laptop' is not a credential, but it is about a
person -- their name, their employer, how many machines they own -- and that
route answers any process that can open a socket to loopback.

The field had exactly one consumer, the extension's node picker, and pairing
can serve it: redeeming a code read off this node's own screen is the moment a
caller stops being anonymous. So /pair answers node_name, the extension keeps
it on the stored linkage, and a node it has not linked shows as 'Daemon' or
'Desktop app' plus its pubkey. Unlink drops the name with the token, which is
the honest rendering.

Disambiguating several nodes on one machine -- ADR 0017's reason for putting
identity in this response -- is node_pubkey's job either way, and it does it
whatever the node is called.

ADR 0044 records the policy this is the first third of: a node name is
ensemble-private. The other two sites, the pkarr registry and gossip
announcements, follow in the next commits.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkup9bGFrnEaBVG8TQTJrS
2026-08-24 14:35:34 -07:00
Greg Shuflin 71b9c16954 gui: cap the four remaining uncapped detail screens, and stop forking the idiom
**Correction to the commit that added `detail_form`.** Its message said
`CONTENT_MAX_WIDTH` "already existed and documented exactly this problem, with
no consumers". The second half is wrong: it has eleven call sites across eight
files, and a documented house shape in `sizing`'s module docs. The claim came
from grepping `CONTENT_WIDTH`, which is not a substring of `CONTENT_MAX_WIDTH`
and therefore matched nothing. That commit is already on master@origin, so
this corrects it forward rather than rewriting it.

The consequence was a forked idiom: `detail_form::reading_column` wrapped the
body in an extra capped div, where every other screen puts a plain
`.max_w(CONTENT_MAX_WIDTH)` on the scrolling body itself. One idiom with a
dozen call sites beats two with thirteen, so `reading_column` is gone and
`human.rs` uses the house shape. `labeled_row`/`row_label` stay -- the
label/value grid is genuinely new -- and the module now says width is not its
job and points at where that lives.

**The sweep.** Every `overflow_y_scroll`/`uniform_list` in gui-app, against
whether its file caps. Four screens were detail-shaped and uncapped:

- `agents/jobs.rs` -- a job row is `justify_between`, so its label and its
  state/progress sit at opposite ends of the window.
- `agents/podcasts/queue.rs` -- controls stranded from the episode they act
  on, the same shape the subscriptions list beside it already fixed.
- `agents/podcasts/episode.rs`, `agents/podcasts/detail.rs` -- detail bodies.

Deliberately left uncapped, and why: the document table, presence view and
media library are grids where width *is* the information; `agent_sidebar`,
`hierarchical_sidebar`, `scrollbar` and `settings/widgets` are already narrow
or are components that should let their host decide; `settings/mod.rs` is a
shell whose three tabs each cap themselves.

Left as an open question rather than changed: `agents/notes/mod.rs`'s editor
and preview panes, and `components/markup_view.rs`. Both are prose surfaces
where a measure cap is arguably right and arguably not, markup_view is a
component with several consumers, and Split mode already halves the width --
that is a typographic decision to make deliberately, not a sweep's business.

CLAUDE.md's rule is rewritten to describe the real idiom, and gains the
uncapped cases.

Verified: cargo check/clippy --all-targets clean, 218 tests pass, just
lint-gui-layout clean. Not visually inspected -- four screens changed width.
2026-08-24 13:46:21 -07:00
Greg Shuflin 8b7e39bc3c CLAUDE.md: a label/value list is two-column on desktop, stacked on Android
Records a divergence rather than introducing one -- the previous commits left
the desktop profile as a label/value grid and Android's stacked, and without
this that reads as drift for the next person to compare the two.

The reasoning is width, not platform taste. A desktop `reading_column` is
1040px and leaves the value ~870 beside a 160px label column; a phone's
content width is ~330-380dp, leaving 156-208, which wraps long values to
three lines and makes each row taller than the stacked version it would
replace. That is the same split the desktop and mobile versions of the same
apps make -- macOS and GNOME Contacts are two-column, iOS and Google Contacts
stack.

Written as "don't make them match", because the tidying instinct is the
failure mode here. The genuinely open question is a tablet or foldable, not a
phone: the app has no adaptive-layout machinery at all (no WindowSizeClass,
no BoxWithConstraints), so Android's choice is unconditional today, and
introducing that machinery is worth doing on its own merits before it is
worth doing for this.

Pointers at both ends -- `read_only_row` and `ReadOnlyField` each name the
other -- so someone reading either screen finds the reasoning without having
to already know the rule exists.

Verified: just check-gui-nix and just lint-kotlin clean.
2026-08-24 13:35:36 -07:00
Greg Shuflin 191cf88cf9 humans: pin the Android profile's action bar to the bottom of the screen
Edit, Save and Cancel were the last children of the scrolling column, so on a
profile with a few facts on it you had to scroll past every one of them to
reach the button that leaves the mode you are in. They are the screen's exit,
not its last field.

`SubAppScreen`'s content slot is already a `ColumnScope`, so this needs no
extra nesting: the scrolling body takes `weight(1f)` instead of
`fillMaxSize()` and the bar follows it as an unweighted sibling, taking its
intrinsic height at the bottom. `HistoryTab` grows the customary
`modifier: Modifier = Modifier` for the same reason (last, with a default --
detekt's ModifierWithoutDefault and LambdaParameterEventTrailing both have
opinions here, and only the conventional order satisfies both).

The error line moves out of the scroll flow with it, as `PinnedError`. It was
the worst-placed thing on the screen: the failure that matters most is a save
the store refused, which happens at the moment the user is furthest from
wherever the message sat. This also gets the History tab an error surface at
all -- it returned before ever reaching the line that rendered `error`, so a
failure to load or log an interaction was silently dropped.

Verified: just gradlew compileDebugKotlin / test / assembleDebug, just
lint-kotlin (detektDebug, type resolution) all clean. Not visually inspected
-- needs a look on device.
2026-08-24 13:21:58 -07:00
Greg Shuflin 5a82db8009 humans: Android gets the editable fact values and the entry-row fix
The two model-level halves of the previous commit, which are bugs rather than
desktop layout taste and so belong on both frontends.

- A fact's value is a field in edit mode; its key stays fixed, for the same
  reason as on the desktop (the pair is the artifact id, so a rename is a
  delete plus an add, and `diffStaged` already emits exactly that). An
  emptied value deletes the fact.
- Save commits a filled entry row. Both entry rows move out of
  FactsSection/ContactSection into the screen, as `FactEntryState`/
  `ContactEntryState`, because Save has to be able to see them -- a fact typed
  in full and left in the row was silently dropped. `stageInto` folds a row
  into its staged list, and a row with one of two fields filled stops Save
  with a message on the field instead of vanishing. Still `remember(editing)`,
  so a cancelled edit discards them.
- The contact protocol picker's selection moves up with them, since staging a
  contact method now needs it at Save time.

The label/value grid and the width cap are deliberately not mirrored: the
first is still being looked at on the desktop, and the second is a 4K-monitor
problem a phone does not have.

Verified: just gradlew compileDebugKotlin, just gradlew test, just
lint-kotlin all clean. Not visually inspected -- needs a look on device.
2026-08-24 13:02:30 -07:00
Greg Shuflin d9015d7360 humans: editable fact values, a capped reading column, a label/value grid
Four things the desktop screen got wrong, from a look at it on a 4K display.

**Fact values are editable.** A fact row was read-only with a Remove button,
so correcting a typo meant deleting the row and retyping both halves. The
value is now a field; the *key* stays fixed, because the (key, value) pair is
what the store derives the artifact id from -- "renaming" one is a delete plus
an add, and a text field there would promise an in-place edit that does not
exist. An edited value reaches `save_current` as exactly that remove/add pair,
which `diff_staged` already produces without knowing it was an edit. Clearing
a value deletes the fact: a blank value is not a fact, and clearing the field
is the obvious way to say so.

`FactEdit` (key + live `TextInput`) is what the form holds; `orig_facts` stays
plain `FactRow` data, and `staged_facts` reads the fields back for the diff.

**Save commits a filled entry row.** Typing a fact in full and pressing Save
lost it -- only Add staged it. Save now folds both entry rows in first. A row
with one of its two fields filled is an unfinished edit and *stops* Save with
a message on the field rather than being dropped, which is the same bug in
quieter clothes. `add_fact`/`add_contact` return whether Save may proceed.

**The form no longer spans the window.** Every row stretched the full width,
so on a 4K monitor the Add and Remove buttons sat 2400px from their labels.
`sizing::layout::CONTENT_MAX_WIDTH` already existed and documented exactly
this problem, with no consumers; `components::detail_form::reading_column` is
the general way to take it, applied here to both tabs. The module explains why
`max_w` is right there and not the banned `flex_1`-plus-`max_w`: the column
sets no `flex_1`, so its width is ordinary cross-axis sizing resolved before
its children are placed. The `flex_1` stays on the scroll container outside it.
CLAUDE.md gains the rule, and `LABEL_COLUMN_WIDTH` joins the sizing tokens.

**View mode is a label/value grid.** Label in a fixed left column, value
beside it -- the property-list shape used wherever values are short (macOS and
GNOME Contacts, Notion, Linear). Values on this screen are one line apiece, so
stacking doubled the screen's vertical run to align things already aligned.
Two exceptions: an empty collection collapses to a single "Not recorded" row
rather than a heading with an apology under it, and Notes keeps its label
above full-width prose, since a paragraph in the value column gets a measure
too narrow to read -- which is why it also moves to the end of the form. Edit
mode stays stacked: an input needs the width. A fact key with several values
is written once with its values stacked beside it.

Verified: cargo check/clippy --all-targets clean, 218 tests pass, just
lint-gui-layout clean. Not visually inspected -- needs a look.
2026-08-24 13:02:30 -07:00
Greg Shuflin ac87464e37 CLAUDE.md: editing is a mode, and the mode is the whole screen
Writes down the rule the previous two commits implement, as TODO.md's Humans
entry asked ("a note in CLAUDE.md that all editable fields should work this
way"), and removes that entry.

The substance beyond "have an edit mode" is the three things that went wrong
on the Humans screen and would go wrong again unprompted:

- Collections on a form are staged like its fields, whatever the store does
  underneath. "Each row is its own artifact, so there's nothing to batch
  behind Save" is the reasoning both frontends independently used to write
  facts and contact methods straight through, and it is a fact about storage
  rather than a licence -- it makes Save mean two different things on one
  form and leaves a removal unrecoverable.
- Cancel and reload are one code path, because they are one act. Named
  because the desktop's fields live in TextInput entities rather than in the
  screen's own struct, so a Cancel that dropped only the staged collections
  would have left a cancelled rename on screen.
- Not everything on a screen is part of its form. An interaction is its own
  document shared with its other attendees, so it is written when the user
  says to write it and stays outside the mode. The test is field-of-record
  versus record-of-its-own, not "is it on this screen".
2026-08-24 13:02:30 -07:00
Greg Shuflin 2933946a44 humans: the Android profile is a mode too, matching the desktop
The same change as the previous commit, on the same screen's Compose half,
which had independently arrived at the same split model: singleton fields
behind Save, facts and contact methods written straight through on add and
remove ("Collections are persisted immediately, separately from the Save
button"). Both are staged now, and the profile has a view mode.

- An `editing` flag over the whole profile column. Each section draws its
  own two appearances rather than there being a read-only copy of the column
  beside an editable one -- same reasoning as the desktop's.
- `FactRow`/`ContactRow` replace the FFI records as the screen's state.
  `HumanProfile.facts` arrives grouped by key but is laid out and diffed one
  row per value, so it is flattened on arrival. A staged `ContactRow` has a
  null `uri`: which protocols are openable is dispatch the Rust side owns
  and a frontend must not invent a link, so a contact method isn't tappable
  until Save has been through and the canonical value comes back.
- The `collectionsReloadToken` effect becomes a plain `reloadToken` that
  re-reads the whole profile. Both exits from edit mode use it -- Save, so
  the form shows what the store made of the write, and Cancel, so it shows
  what was there before. Discarding the staged edit *is* reloading, so there
  is one path rather than a separate revert to keep in step.
- `saveProfile` does the diff and the writes, sequenced with `result {}` /
  `bind()` (ADR 0022) rather than a chain of `getOrThrow`. First failure
  stops the run, the caller reports it, and the form stays in edit mode with
  everything still staged.
- Entry fields in both sections are `remember(editing)`, so half-typed text
  is discarded along with the rest of a cancelled edit.
- `diffStaged`/`sameContact` mirror the Rust helpers of the same names, down
  to contact identity being protocol + value rather than the whole row.

Verified: just gradlew compileDebugKotlin, just gradlew test, just
lint-kotlin (detektDebug, type resolution) all clean; the regenerated uniffi
bindings carry the new ActionLabels.edit field. Not visually inspected --
needs a look on device.
2026-08-24 13:02:30 -07:00
Greg Shuflin 3cfae3f7bf humans: the desktop profile is a mode, and Save writes all of it
The Humans detail screen had two different save models on one form. The six
singleton fields staged behind Save, as did circles; facts and contact
methods were written straight to the store the instant they were added or
removed, on the reasoning that each is its own artifact row with nothing to
batch. True of the storage, wrong as a model: some of what you changed was
already committed and the rest was not, and there was no way to back out of
a removal. Commit pymrpswkquov made Save *look* live after such a change by
setting the dirty flag from the reload; that treated the symptom.

Facts and contact methods are now staged like everything else, diffed
against an orig_* snapshot on Save exactly as circles always were, and the
screen gains the edit/view mode TODO.md has been asking for:

- `DetailMode::{View, Edit}` on `Detail`. A person opens read-only; the
  action bar under the profile says Edit while reading and Save/Cancel while
  editing. Every section renders its own two appearances rather than there
  being a parallel render_profile_view/render_profile_edit pair, so the two
  cannot drift in order or wording.
- `reload_detail` replaces `refresh_collections`/`refresh_contacts`: one
  re-read of the whole profile, resetting the TextInput/TextArea entities
  too. That is what makes Cancel mean cancel -- the singleton fields live in
  those entities, not in `Detail`, so dropping the staged collections alone
  would leave a cancelled rename on screen. `set_content` emits no change
  event, so seeding the fields doesn't re-dirty the form.
- `diff_staged` is the one rule behind Save for all three collections, with
  `same_contact` supplying contact-method identity (protocol + value, the
  pair the store derives the id from -- not the label). Entries on both
  sides are written by neither list: re-saving an untouched profile must not
  restamp modified_at on rows nobody touched.
- A failed store write leaves edit mode up with everything still staged and
  says why beside the button, instead of only reaching the log.
- Empty fields and empty collections read "Not recorded" rather than a blank
  under a label, so view mode says what Edit would let you fill in.

Adds `copy::action::EDIT` (and its ActionLabels FFI field) now that two
frontends say the word.

Verified: cargo check/clippy --all-targets on gui-app clean, 218 tests pass
(9 new, covering the diff), just lint-gui-layout clean, cargo nextest across
the workspace 1142 passed.
2026-08-24 13:02:30 -07:00
Greg Shuflin e302f67270 humans: adding/removing a fact or contact method activates Save
Both platforms already write a fact/contact method straight to the store
the instant it's added or removed -- deliberately, per each platform's
own comments ("Collections are persisted immediately, separately from
the Save button" on Android; "written immediately... unlike the singleton
fields" on the desktop). Neither ever touched the dirty/canSave flag,
which is scoped only to the six singleton profile fields (plus, on the
desktop, staged circle add/remove) -- correct in the narrow sense that
there's genuinely nothing left for Save to persist for a fact, but it
left Save looking inert right after a change that had, in fact, already
gone through. Reported as confusing on both platforms (same design,
independently arrived at) -- worth fixing even though no data was ever
at risk.

gui-app (rust/gui-app/src/agents/human.rs): refresh_collections (the
add_fact/remove_fact reload, also called by the save handler) and
refresh_contacts (the add_contact/remove_contact reload) now set
`d.dirty = true`. The save handler's own `d.dirty = false`, which already
ran immediately after its own refresh_collections call, still wins for a
real save -- refresh_contacts is never called from there, so nothing
needs to undo it on that path.

Android (HumanDetailScreen.kt): the collectionsReloadToken effect (the
equivalent reload, fired by both FactsSection and ContactSection's
onAdd/onRemove) now sets `dirty = true` alongside reloading `facts`/
`contactMethods`.

Clicking Save afterward is a harmless no-op for the fact/contact itself
(it was already durable) -- it just re-writes the unchanged singleton
fields and diffs an empty circle change, then clears dirty, same as any
other save.

Removes the TODO.md entry this closes ("on Android adding new 'facts'
fields doesn't expose the save button").

Verified: cargo check --workspace, cargo clippy -p gui-app clean
(pre-existing unrelated warnings in lib aside), cargo test -p gui-app
--bin syn-gui (209 passed), cargo fmt; just lint-kotlin (detektDebug,
with type resolution) and just lint-kotlin-fast both clean, including a
successful compileDebugKotlin; just fmt-kotlin.
2026-08-24 13:02:30 -07:00
Greg ShuflinandClaude Opus 5 20b3933df8 chore: clear the standing clippy warnings in syn-cli and the lib
Six useless_borrows_in_formatting in cli-app/commands.rs and two
unnecessary_sort_by in the lib. All mechanical, no behaviour change:

- Dropped the redundant & on format! arguments, inlining the captures where
  that left a bare positional. The nested format! for the pkdns URL becomes a
  resolver_url local -- removing its & alone just trades the lint for
  format_in_format_args.
- sort_by(|a, b| b.k.cmp(&a.k)) -> sort_by_key(|x| Reverse(x.k)) in podcast's
  episode list and snippets' list. Both keys are Copy (Timestamp, and
  Option<Timestamp>), so this is not the clone-per-comparison version of that
  rewrite. Ordering is unchanged, None included: it is Option's smallest value
  and so still lands last once reversed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkup9bGFrnEaBVG8TQTJrS
2026-08-24 13:02:12 -07:00
Greg ShuflinandClaude Opus 5 7c4efe8369 cli: print a failed command's error once, not twice
main() both logged the returned error and printed it. Neither is redundant on
its face, but they were the same text in the same stream: error is enabled at
the default verbosity, init_logger targets stdout in a terminal, and after
daemonize stdout and stderr are the same log file. So every CLI failure came
out twice -- once wrapped in timestamp/thread-id/target furniture, once plain.
Store::validate's new permissions error made it obvious, being a paragraph.

Kept the plain stderr line, in red like the file's other failure paths. A
top-level error is the answer to what the user just typed, and log furniture
around a paragraph ending in a chmod to copy only makes it harder to read;
anything worth a timestamped record already logged itself where it happened,
with that moment's context rather than the exit path's.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkup9bGFrnEaBVG8TQTJrS
2026-08-24 13:02:12 -07:00
Greg Shuflin 0938efedb4 security: close two findings from the linkage audit
**A linkage token could mint itself more linkages.** /command and the Unix
socket shared one handler with no notion of which listener a request arrived
on, and it answered LinkageCmd::PairBegin/PairStatus/PairCancel for both. So a
token holder could mint a pairing code, read it straight back out of
PairStatus, and redeem it at /pair under a client_id of its own -- leaving a
second linkage that revoking the first does not touch, and could re-create at
will. ADR 0017 rests on revocation being the answer to a leaked token, so this
hollowed out the model rather than merely widening it.

handle_command now takes a Transport, and pairing control is refused for
Transport::Loopback. Pairing is an act of the person at the machine; the local
socket already proves that, a bearer token cannot. List and Revoke stay on
both -- a client dropping its own linkage is the 'unlink' path.

**Store directories were world-readable, with the node secret in plaintext.**
Nothing in the tree called set_permissions, so a store took the ambient umask:
measured drwxr-xr-x and -rw-r--r-- under the usual 022. secrets.value is plain
JSON, so any local user who could reach the file got the node keypair, and
with it the vault key (its wrapping key is node-derived, no interaction
needed), every blob, and a delegation cert that now passes ensemble admission.
The default path is protected on this machine only because ~/.local/share
happens to be drwx------; that is the XDG directory's mode, not ours, and any
explicit --store path had nothing.

Stores are now created 0700/0600, and Store::validate refuses to open one that
group or other can reach, ssh-style: the error names the mode, says what is at
risk, and gives the chmod. Repairing it silently was rejected -- a store that
was world-readable may already have been read, and quietly re-chmodding a
directory the user pointed us at is not ours to decide. The check covers the
directory and store.db, not a recursive walk: the directory mode is what
blocks traversal, and blobs are ciphertext whose key is not among them.

Both fixes have tests that fail without them, including an end-to-end one
showing a token holder cannot read an outstanding code or reach a second
linkage.

Recorded rather than fixed, in TODO.md's Security section: a token still
grants arbitrary local file read (ImportFiles) and write
(MaterializeDocument), which ADR 0017 deferred deliberately but which reads
differently now that the holder is a browser sandbox; the node secret is still
plaintext at rest; and /version leaks node_name unauthenticated. Also corrects
default_store_path's doc, which said ~/.config while the code uses
data_local_dir().
2026-08-24 13:02:12 -07:00
Greg Shuflin aae49bc883 gui: fix the ensemble status text staying stuck after both actions finish
Follow-up to the earlier status_priority fix, which only handled half the
bug. Sync -> Ping still didn't show the ping result once ping finished:
status_priority's tie-break for "neither is Pending, neither is Idle"
(both have a lingering Ok/Err) was a hardcoded preference for sync. That
covers the moment right after clicking Ping (ping is Pending, so the
Pending arm wins), but once ping *also* resolves, both sides are
non-Pending and non-Idle again -- exactly the case the hardcoded fallback
always decided, and always in sync's favor. So the display would flash the
ping spinner and then revert right back to the old sync text.

Neither ActionState alone carries which of the two was more recent once
both are simply "done" -- that's temporal information neither field's
current value contains, so it has to be tracked separately. Added
MemberRow::last_action: LastAction (Ping | Sync), set at the moment each
of EnsembleView::ping/sync starts (including sync's early "invalid peer
node ID" return, which still counts as the action the user asked for),
carried across a background refresh by carry_over_actions like the
states themselves. status_priority now takes it as the tie-break instead
of a fixed sync preference.

Added a regression test for this exact case (both actions resolved,
newer one wins the tie) alongside the existing ones.

Verified: cargo check --workspace, cargo clippy -p gui-app clean
(pre-existing unrelated warnings in lib aside), cargo test -p gui-app
--bin syn-gui (209 passed), scripts/lint-gui-layout.py clean, cargo fmt.
2026-08-24 03:58:00 -07:00
Greg Shuflin bbe5d8a376 gui: show a human whose fields haven't synced yet, marked pending
A human created on another node and synced here via doc-sync arrived as a
document row plus stubs for its artifacts (full name, nickname, ...) — the
values themselves are fetched in a separate, later pass
(scheduler::run_catalogue_fetch_pass, which fetches pending artifact stubs
eagerly regardless of SyncPolicy). Until that pass runs and succeeds
against a reachable holder, list_humans() correctly reports the human as
DocumentAvailability::Remote (or Unavailable, if no peer has claimed to
hold it), same as agents::humans::tests::outstanding_artifact_stub_is_remote
already covers on the lib side.

The GUI's reload_list filtered anything that wasn't Local out of the list
entirely — 'a Partial human... hide it rather than showing a misleading
"Unnamed" row'. That's exactly the case reported: a human synced (per
Documents, which lists by document record regardless of artifact
completeness) but invisible on the Humans screen, indefinitely if the
fetch pass hasn't run or the source peer isn't reachable — no way to even
discover it exists here.

CLAUDE.md's "Absence is not an error": a document whose content lives on
another node is a state to render, not blank and not a failure. Fixed by
keeping every human in the list and marking a non-Local one with
components::availability::word() — the same 'list row has an empty
trailing column, so it gets the word there' treatment media_library.rs
already uses for exactly this. An unnamed pending row next to a REMOTE/NO
SOURCE marker reads as 'still arriving', not as a data-integrity problem,
which is what the removed filter was actually trying to avoid.

Verified: cargo check --workspace, cargo clippy -p gui-app clean
(pre-existing unrelated warnings in lib aside), cargo test -p gui-app
--bin syn-gui (209 passed) and -p synchronicity_lib --lib agents::humans
(38 passed, incl. outstanding_artifact_stub_is_remote), scripts/lint-gui-
layout.py clean, cargo fmt.
2026-08-24 03:41:40 -07:00
Greg Shuflin b8b5b06b45 gui: bump Ensemble Membership fact-grid text to font::BODY
The "Ensemble key"/"This node"/"Created"/"Gossip topic"/"Bootstrap
link" labels were font::SMALL (12px) beside a value column already at
font::BODY (14px, text_value's node name) — the mismatch read as the
whole row being slightly too small, hash chips included.

Bumped the fact-grid labels to font::BODY, and added an opt-in text_size
override to HashChip (default unchanged: font::SMALL, so every other
chip in the app — including the roster table's own id chips, a few lines
below this same screen — is untouched) so the ensemble-key/node-key/
gossip-topic/bootstrap-link chips can match. CHIP_HEIGHT (18px) has
enough slack above BODY's line height to fit it without clipping.

Deliberately scoped to the Membership fact grid, not the roster table
below it (COL_ID/COL_TIME/etc. are fixed-pixel columns already sized
tight to font::SMALL content — bumping those risks reopening the
row-width issues just fixed in the two prior commits).

Verified: cargo check --workspace, cargo clippy -p gui-app clean
(pre-existing unrelated warnings in lib aside), cargo test -p gui-app
--bin syn-gui (209 passed), scripts/lint-gui-layout.py clean, cargo fmt.
2026-08-24 03:41:40 -07:00
Greg Shuflin 52159a9878 TODO.md bug report 2026-08-24 03:41:40 -07:00
Greg Shuflin b85b16ed97 gui: more vertical breathing room in the ensemble roster rows
A row's action buttons are control::ROW (2rem) tall, but the row itself
was only control::ROW_LG (2.25rem) — 0.125rem of slack above and below
the button before items_center() centers it, putting the divider lines
right up against a button's top/bottom edge. Bumped the row height to
control::ROW_XL (2.5rem), doubling that slack, rather than adding padding
alongside the fixed height every other cell in the row (connection dot,
coverage meter, timestamps) relies on for its own vertical centering.

Verified: cargo check --workspace, cargo clippy -p gui-app clean
(pre-existing unrelated warnings in lib aside), cargo test -p gui-app
--bin syn-gui (209 passed), scripts/lint-gui-layout.py clean, cargo fmt.
2026-08-24 03:41:40 -07:00
Greg Shuflin 1a9fbdb8df gui: fix ensemble roster border/button mismatch and stuck status text
Two glitches on the Ensemble screen's roster table.

1. Row divider lines stopped short of the Ping/Sync/Manage-sync buttons,
   and on a narrow window the trailing columns could disappear entirely
   with no way to reach them.

   render_member's row box defaults to flex's usual stretch-to-container
   behavior for its width, but none of its columns are willing to shrink
   below their fixed/minimum widths (every fixed column is flex_none, and
   the name cell has an explicit min-width floor) — so once the roster's
   total column width exceeds the available window width, the row's own
   box gets clamped to the (too-narrow) available width while its columns
   still paint at their real width, unclipped. The border, drawn at the
   row's box width, ends before the columns painted past it — and on a
   narrower window still, columns pushed past the window's own edge just
   vanish, since nothing offers a way to scroll to them.

   Fixed by wrapping the header row and the member rows together in an
   overflow_x_scroll() container (the same pattern components/markup_view.rs
   already uses for wide code blocks). Inside a scroll container, gpui sizes
   content to its real width instead of clamping it to the viewport, so the
   border now runs exactly as far as the columns do, and a window too narrow
   for the whole table can scroll right to reach the rest instead of losing
   it.

2. After a completed "Sync" left its green result text ("synced N doc(s)")
   in a row's status slot, clicking "Ping" never updated it — the ping's
   own Pending/Ok/Err was silently swallowed.

   action_status shares one status slot between Ping and Sync, chosen by
   `match (&ping, &sync) { (Idle, other) | (other, Idle) => other, (_, sync)
   => sync }`. Neither action resets back to Idle once it finishes, so once
   Sync held a lingering Ok/Err, neither of the "whichever is idle" arms
   matched a later Ping click (neither side was Idle any more), and the
   catch-all's fixed preference for sync won every time — permanently, until
   the row was reloaded.

   Fixed by giving Pending top priority regardless of what the other action
   is currently showing: a freshly-started action always wins over a
   lingering result from the other one. Pulled the decision out into a pure
   `status_priority` function with its own unit tests, including the exact
   reported scenario (Sync resolves, then Ping starts).

Verified: cargo check --workspace, cargo clippy -p gui-app clean
(pre-existing unrelated warnings in lib aside), cargo test -p gui-app
--bin syn-gui (209 passed, incl. 3 new), scripts/lint-gui-layout.py clean,
cargo fmt.
2026-08-24 03:41:40 -07:00
Greg Shuflin 4335bf1e81 gui: split settings.rs/ensemble.rs into a settings/ directory, dedupe
settings.rs (1772 lines) and ensemble.rs (997 lines) — the System/Sync/
Ensemble/Linkages screen's own two largest files — become a settings/
directory, following the same per-tab-file convention agents/documents/
already uses for its own tabs (mod.rs holds shared state + construction +
tab switching + top-level Render; each tab's own rendering/data-operations
live in their own `impl SettingsView` block in a sibling file):

  settings/mod.rs           SettingsView + every type used as one of its
                             fields, construction, tab switching, Render
  settings/system.rs        System tab: name/theme/zoom/timezone/pubkey/
                             about/danger zone
  settings/sync.rs          Sync tab: per-type policy, storage dashboard,
                             background scheduler, remote administration
  settings/reclaim.rs       The "Reclaim…" flow a Sync policy row opens
  settings/widgets.rs       Section chrome, a status line — shared by the
                             above
  settings/ensemble/mod.rs  EnsembleView: state, actions, top-level render
  settings/ensemble/load.rs  Building the snapshot off the UI thread
  settings/ensemble/row.rs  One roster row's element/column-width helpers

Duplication found and fixed along the way:

- settings.rs defined its own local section()/section_heading() — plain
  text_xl, no accent bar or rule — instead of using
  components::section::section_heading, "the app's one section-heading
  grammar" (ADR 0032 §5) that ensemble.rs and linkages.rs both already use
  correctly. Settings was the one screen quietly off the shared grammar.
  Now routes through the shared component like its sibling tabs do — a
  visible change on the System/Sync tabs, worth a `just gui` look.
- Three status-line renderers (Run now, remote Sync now, Reclaim) each
  hand-rolled the same `div().text_size(font::SMALL).text_color(..)`
  match over a 3-4-variant enum. Factored into one `widgets::status_line`
  helper; each renderer is now a one-line-per-variant match.
- A stale, superseded doc comment on `set_sync_policy` (a leftover first
  sentence from before remote administration existed, followed by the
  comment that actually describes current behavior) is gone — one comment,
  not two disagreeing ones.
- Root::new's two SettingsView-construction paths (already deduped in the
  prior commit) are unaffected; unrelated to this file.

Also updated the one other file with a path-specific doc comment,
tui-app/src/ensemble_screen.rs, to `gui-app/src/settings/ensemble/`.

Verified: cargo check --workspace, cargo clippy -p gui-app clean
(pre-existing unrelated warnings in lib/cli-app aside), cargo test -p
gui-app --bin syn-gui (206 passed) and -p synchronicity_lib --lib (993
passed), scripts/lint-gui-layout.py clean, cargo fmt.
2026-08-24 03:41:40 -07:00
Greg Shuflin dc86c0ec80 gossip: sign the NodeAnnouncement payload, not just the identity
A delegation cert proves who a node is; it said nothing about the fields
travelling beside it. Certs are public by design and ride in every
announcement, so any node in the topic swarm could collect one, rebroadcast it
with its own choice of relay_url and node_name, and every receiver would
ingest it -- writing an attacker-chosen relay address into iroh's address
cache and an attacker-chosen display name into peer_nodes.

Not an impersonation risk: iroh authenticates peers by node key at the TLS
layer, so a forged relay URL yields a failed or misrouted connection, never a
readable one. But ensemble/screen.rs resolves the roster's display name from
that peer_nodes row, so the names a human reads were writable by anyone in the
swarm. That is cosmetic today and stops being cosmetic at revocation, where
the roster is how a node gets chosen to act on.

NodeAnnouncement now carries announced_at_secs and a signature by the
announcing node's own key, same construction PurgeIntent already used -- its
doc comment drew the distinction explicitly, and that distinction no longer
holds, so it is rewritten. The signing payload length-prefixes each optional
string so ('ab','c') and ('a','bc') cannot collide, and distinguishes None
from Some("").

Signing stops forgery but not replay: a node's own past announcements stay
valid forever. PeerMap::upsert now keeps the newest announced_at_secs per node
and drops anything older, before touching the address cache rather than after.
That covers a process lifetime; persisting a high-water mark would cover
restarts, and is left in TODO.md with the reasoning for why it may not be
worth a schema column.

Also: TODO.md gains a Security section, headed by an audit of the linkage
bearer-token surface (ADR 0017's loopback listener), which was out of scope
for the P2P admission work and has never been reviewed on its own terms. It
also records the two amplifiers found during that audit and still unfixed --
wire-supplied origin_node, and unbounded LWW timestamps.

And corrects imprecise wording in admission.rs: certs are visible to swarm
members, not sent unencrypted -- gossip rides QUIC/TLS. The paragraph now says
why treating a cert as secret would be harmful rather than merely useless.
2026-08-24 03:29:05 -07:00
Greg Shuflin 4ab25dbc5b p2p: require a delegation cert on every ALPN
No protocol handler checked who was calling. Each read conn.remote_id(),
logged it, and served -- so any node that could dial ours, knowing only the
ensemble *public* key (printed by 'ensemble init', shown in Settings, carried
in the bootstrap link), could read the whole document catalogue, write to it
via doc-sync's reverse pull, push artifacts and blobs, and drive node-admin.

Every ALPN now runs a handshake first: the caller presents its DelegationCert,
and it is admitted only if the cert names our ensemble, is validly signed by
the ensemble key, and its node_pubkey equals the QUIC-authenticated
remote_id(). That last check is what makes a cert a credential rather than a
password -- certs travel in the clear over gossip, so a harvested one must be
useless without the node secret it names. No challenge/response is needed:
QUIC already proved possession.

Made hard to omit rather than merely documented. Inbound, protocols implement
EnsembleProtocol, whose serve() takes a CertifiedPeer that only this module
can construct; Gated<H> is the only bridge to iroh's ProtocolHandler.
Outbound, callers get an EnsembleEndpoint whose connect() runs the client half
-- the inner Endpoint is not exposed and there is no Deref. The escape hatch
both share is reaching past the wrapper to iroh, which the type system cannot
see, so 'just lint-p2p-admission' covers it. That lint earned its keep
immediately: P2PNode::ping was still dialling self.endpoint directly and would
have been refused by every peer.

Gossip stays ungated at the connection layer and authenticates per message
instead, as it already did -- the swarm is joinable by anyone who knows the
ensemble public key, so there is nothing to gate there.

This does not revoke anything: a delegation cert never expires and nothing can
withdraw one, so a node that was ever a member is admitted forever. It is the
prerequisite phase for docs/NODE_REVOCATION.md.

p2p_ping's two nodes previously used separate solo ensembles, which no longer
works -- correctly. They now share one, and a companion test asserts a node
from a different ensemble is refused at admission (checked against the
target's log, so it cannot pass on a dial that merely failed).
2026-08-24 03:29:05 -07:00
Greg Shuflin 1eb6951f86 docs: node revocation design; correct ADR 0014's authorization claim
Three-phase design for removing a node from an ensemble: admission control
on every ALPN, a signed revocation record, then epochs plus vault key
rotation for the lost/stolen case.

Documents the current state first, because it is worse than assumed: no
protocol handler checks ensemble membership, so any node holding only the
ensemble public key can read and write the document catalogue and drive
node-admin. Also records two amplifiers found while auditing --
wire-supplied origin_node, and LWW against an unbounded wire timestamp.

ADR 0014 claimed 'authorization is ensemble membership, which the iroh
connection already proves'. That was never implemented; amended in place
rather than left to mislead. Also marks ENSEMBLE_RESEED.md implemented --
it has been since reseed.rs landed -- and adds a TODO.md entry for
revocation.
2026-08-24 03:29:05 -07:00
Greg Shuflin 43c2109db1 Update test ensemble key 2026-08-24 02:21:05 -07:00
Greg Shuflin 6f64841f7a gui: dedupe the window-bounds debounce between Root and PopoutWindow
Follow-up to the previous commit's Root/root.rs extraction: Root::on_bounds_changed
and PopoutWindow::on_bounds_changed each hand-rolled the same debounce
idiom (bump a generation counter, cx.spawn a timer, check the generation
still matches once it elapses, then run the save) around a different
save action.

Factored the shared skeleton into root::debounce_geometry_save<T>: takes
the just-bumped generation, a closure reading the counter back off T, and
a save closure to run once the debounce survives uncontested. Both
call sites now just bump their counter, capture what the save needs, and
hand it to the helper — each down to a handful of lines instead of a full
cx.spawn block.

Verified: cargo check --workspace, cargo clippy -p gui-app clean
(pre-existing unrelated warnings aside), cargo test -p gui-app --bin
syn-gui (206 passed).
2026-08-24 02:17:55 -07:00
Greg Shuflin 0dd0889027 gui: extract Root into its own module, dedupe Ready-state build
Answers two questions about main.rs/app.rs: why they're split, and
whether there's duplication worth cutting.

main.rs was two things at once: process bootstrap (CLI parsing, logging,
the tokio runtime, the daemon socket, opening the store) and the full
gpui Entity/Render implementation of Root — the top-level view with its
own state machine (RootState::Initializing/Ready), subscriptions, and
main-window-bounds persistence. Every other screen-level view here
(SynchronicityView in app.rs, InitializationScreen, AgentSidebar,
SettingsView, ...) gets its own module; Root was the one living in the
crate-root file instead. Moved Root, RootState, its Render impl, and the
window-geometry helpers (window_geometry/window_bounds_from_geometry/
WINDOW_BOUNDS_SAVE_DEBOUNCE) plus close_popouts_with_main_window into a
new root.rs, re-pointing popout.rs's crate::-relative references and the
handful of intra-doc [`crate::Root`] links (zoom.rs, app.rs) at their new
home. main.rs is now CLI + main() + the small store-bootstrap helpers
(open_store/node_is_initialized/resolve_local_node) — 534 lines down to
~335, and it no longer needs `Entity`/`Render`/`Window`/`Context` at all.

Also folds a real duplication: Root::new's `initialized` branch and
Root::on_initialized separately built SynchronicityView, called
restore_popouts, and wrapped the result in RootState::Ready — near-
identical sequences (introduced across the last two changes to this
file). Extracted into one Root::ready_state helper both paths call.

Verified: cargo check --workspace, cargo clippy -p gui-app clean
(pre-existing unrelated warnings aside), cargo test -p gui-app --bin
syn-gui (206 passed).
2026-08-24 02:17:55 -07:00
Greg Shuflin 7abbcf1f7d gui: fix missing caret in an empty note/text-area
An empty note (or any TextArea/NoteEditor with no content) never showed a
blinking caret, even when focused. `layout` correctly shapes zero
WrappedLines for empty content, but `prepaint`'s cursor_quad computation
explicitly gated on `!content_empty`, and — independently —
`position_for_offset` had nothing to walk with zero lines and fell
through to `None`. Either alone would have suppressed the caret; both
were present. `MultilineTextElement::paint`'s own focus/blink gating was
already correct, so this wasn't a focus or blink-timer bug — there was
just never a position to paint at.

Fix: position_for_offset now reports the field's top-left when there are
no lines to walk (the empty-buffer case), and the redundant
`!content_empty` gate on cursor_quad is removed. Added two unit tests on
the pure position_for_offset function.

Verified: cargo test -p gui-app --bin syn-gui multiline_text_element (2
passed), cargo check -p gui-app, cargo clippy -p gui-app clean.
2026-08-24 02:17:55 -07:00
Greg Shuflin d702b6dfec gui: persist popped-out window state across restarts
Implements the TODO.md entry: which agent screens are popped out into a
window of their own, and where each window is, now survives a restart
instead of always folding back into the main window.

lib/src/stores/settings.rs: Settings gains a popouts: BTreeMap<AgentId,
WindowGeometry> field (Settings::popouts), keyed by popout::screen_key
so Settings/Ensemble share one entry. set_popout/clear_popout follow the
existing read-modify-write setter pattern. AgentId gains Ord (for the
BTreeMap key) and Serialize/Deserialize (kebab-case, matching as_str())
so it can serve as a persisted map key — guarded by a test that catches
drift between the two independent spellings.

gui-app: PopoutWindow now owns persisting its own position/size, mirroring
main::Root::on_bounds_changed for the main window (same debounce constant
and geometry helpers, now pub(crate) and shared). It saves its opening
geometry immediately on creation and again on every subsequent
move/resize. SynchronicityView::pop_in and on_window_closed clear the
persisted entry when a screen comes back into the main window, however
that happens.

On startup, main::Root reads Settings::popouts once (after
SynchronicityView is constructed, before the first paint) and hands it to
the new SynchronicityView::restore_popouts, which reopens each saved
window at its saved geometry — so the rail's amber marks and the
'popped out' message in the content pane are correct on the very first
frame. Neither this nor the main window's own restore special-cases a
display that's gone; both just hand gpui/the window manager the saved
rect and let it sort it out, per the TODO's open question.

Verified: cargo test -p synchronicity_lib --lib (981 passed), cargo check
--workspace, and cargo clippy -p synchronicity_lib -p gui-app clean
(pre-existing, unrelated warnings aside).
2026-08-24 02:17:55 -07:00
Greg ShuflinandClaude Sonnet 5 597b3cd6ca docs: ADR 0043, and the property-removal story in data-model/document-sync
Retires TODO.md's "Removal has no representation in the property model". The
two things the ADR does not itself reach go where they belong rather than
staying attached to it: an importing agent decides whether re-reading a file
updates the document already standing for it or makes a new one — it is the
only thing that knows two archives are the same issue — so comics' missing
rescan is tracked under that agent, not as general functionality. What the UI
for clearing a property should be is a real open question (which kinds may be
cleared at all, where the affordance lives, whether a SetUnion element gets one
distinct from clearing the whole set), so it joins Property Invariants in
data-model.md's open questions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkup9bGFrnEaBVG8TQTJrS
2026-08-24 01:52:21 -07:00
Greg ShuflinandClaude Sonnet 5 9190b9f12e music: clear a tag the file no longer carries
The scanner wrote what a file had and left everything else alone, so re-tagging
a track to change its artist worked while re-tagging to clear it left the old
value on the track forever. This is the case that surfaced ADR 0043.

Clears through remove_property_if_present rather than unconditionally: most
files have never carried most of the optional kinds, and a tombstone per absent
kind per track would then be announced on every sync of that document.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkup9bGFrnEaBVG8TQTJrS
2026-08-24 01:45:57 -07:00
Greg ShuflinandClaude Sonnet 5 327ecdaad8 doc-sync: carry property removals over the wire
DocumentRecord gains property_tombstones and property_set_elements, both
hanging off the document rather than off a PropertyRecord — the row they refer
to may be gone, same reason edge tombstones ride there.

SetUnion properties stop being sent as PropertyRecords entirely. Sending the
materialized row as well as the element state would have the receiver read
every element as added at the row's modified_at, and a removal arriving
alongside would lose to it. SYNC_PROTOCOL_VERSION goes to 16 to mark a change
in what a record means rather than in any enum: 15 and 16 parse each other's
chunks fine and simply fail to convey tags.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkup9bGFrnEaBVG8TQTJrS
2026-08-24 01:45:52 -07:00
Greg ShuflinandClaude Sonnet 5 06fbe1a1c5 store: represent property removal — row tombstones and per-element SetUnion state
Properties were the one granularity of the data model that could not express a
deletion: a document, an artifact and an edge each have a tombstone, and all
three follow the rule that a strictly newer write beats it. Two bugs followed.
A removed tag came back from any peer still holding the older set, because the
SetUnion merge was a plain union with no removal marker; and a property could
not be cleared at all, so a scanner that found a tag gone had no way to say so.

Both are answered here, under that same rule:

- property_tombstones, keyed by (document_id, kind) rather than the property's
  id, which is local to each node. Consulted by both write paths, so a peer
  cannot undo a removal by re-announcing what it still has.
- property_set_elements, which becomes the authoritative state for SetUnion
  kinds; the properties row is a materialized view of the present elements, so
  no reader had to change. Each element carries its own add and removal stamps,
  which is what lets a removal beat an unrelated concurrent add to the same
  property.

Existing databases are seeded at open, or the first materialization would empty
every tag list on the machine.

See docs/adr/0043-representing-removal-in-the-property-model.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gkup9bGFrnEaBVG8TQTJrS
2026-08-24 01:45:47 -07:00
Greg Shuflin 7101e2ee1f Add ADR 0042, remove TODO.md entry 2026-08-24 01:02:15 -07:00
Greg Shuflin ac83271875 CLAUDE.md update 2026-08-24 00:53:02 -07:00
Greg Shuflin 83c05a420a gui: fix re-entrant update panic on Pop Back In
Clicking a popped-out screen's "Pop Back In" button ran pop_in() from
inside SynchronicityView's own update (the button click handler),
which called window.remove_window() on the pop-out. gpui fires
window_closed_observers synchronously from inside remove_window's
call stack, so the on_window_closed subscription tried to
this.update() the same SynchronicityView entity that was already
leased for the click handler — panicking with "cannot update ...
while it is already being updated".

Defer the observer's SynchronicityView update to the end of the
current update cycle (cx.defer), matching the existing pattern in
components/menu/context_menu.rs for the same class of re-entrancy.
This covers both the Pop Back In button path and the pop-out's own
title-bar-close path.
2026-08-24 00:48:39 -07:00
Greg Shuflin e96eea417d Update test ensemble key 2026-08-24 00:41:58 -07:00
Greg Shuflin e36b2d8c0d gui: further dedup button.rs
Two more repeated shapes, beyond the hover/active wiring from the prior
commit:

- filled() and hover_fill() each hand-wrote the same
  cursor_pointer()/hover()/active() triple, differing only in which two
  colours they pass. Split that wiring out into interactive(el, hover,
  press), so it's written once and the two callers just supply colours.
- icon_button, bar_button, and transport_button each built an identical
  flex-centred square/round footprint (flex().items_center().justify_center()
  .size(..).rounded(..)) by hand before layering their own fill/text/icon on
  top. Factored into icon_shape(id, size, radius), generic over Rems and
  Pixels radii (shape::CONTROL vs shape::PILL) via Into<AbsoluteLength>.

No behavior change — verified each call site still sets exactly the same
style properties it did before, just via the shared helpers.
2026-08-24 00:37:50 -07:00
Greg Shuflin 14d8bb955d gui: every button gets a hover and a pressed state, deduplicated
A click on any button looked identical to idle until the async result came
back (fixed for the keyphrase Copy button in the prior commit), and two
variants — the primary filled button and danger_button — had no hover
feedback at all, only cursor_pointer(). Neither is a gpui limitation: gpui-ce
has .active(), a mousedown pseudostate right next to .hover() in the same div
API; this codebase just never called it.

First attempt used gpui::ColorExt::blend() with a low-alpha black to darken
each fill, which is wrong: blend() composites a translucent colour over
whatever is *behind* the element, not over the element's own prior fill — so
every pressed button faded almost exactly back to the screen's background
colour, which is what made pressing a button look like it vanished. darken()
is now a plain opaque RGB lerp instead.

Also collapses the six button variants' near-identical hover/active wiring
and (for button/danger_button/ghost_button) near-identical base-shape
builders into a handful of small combinators (darken, filled, hover_fill,
label_shape, flat_disabled), cutting the repetition the file had grown while
each variant picked up its own copy of the same three lines.
2026-08-24 00:31:41 -07:00
Greg Shuflin c240e519dd gui: the keyphrase Copy button says it copied
The onboarding recovery-phrase screen's Copy button wrote the phrase to the
clipboard and looked exactly the same afterwards, so a click read as having
done nothing. It now reads "Copied" for 1.2s, the same dwell and the same
mechanism as the pairing-code button in linkages.rs.

The reset task is held on the entity so a second click restarts the dwell
instead of the first timer cutting it short, and it is dropped when the
phrase is regenerated or the screen dismissed.
2026-08-23 21:57:36 -07:00
Greg Shuflin 9a9080ce01 gui: pop an agent screen out into a window of its own
Right-click any agent in the navigation rail to move its screen into a
separate window, and again to bring it back. The screen is not copied:
gpui entities live in the app rather than in a window, so the new window
renders the same entity the main one was, and nothing is rebuilt or
re-fetched on the way over.

The rail marks a popped-out agent in amber — label, glyph, and left edge,
plus a wash when it is also the current view — rather than the cobalt
selection block, because cobalt means "this is what you are looking at"
and this is precisely what you are not. The content area says where the
screen went and offers the way back, since a right-click menu nobody has
been told about is not one.

Settings and Ensemble are two tabs of one screen, so they share one
pop-out window (popout::screen_key); clicking either row retargets the
tab in the window it is in. Closing a pop-out sends its screen home;
closing the main window closes them all, which is also what lets gpui
quit. Snippets' store watch keyed off "is this the current view", which
pop-out makes a different question from "is it on screen" — it is now
reconciled from both.

Which screens are out is not persisted yet; TODO.md carries that.
2026-08-23 21:52:04 -07:00
Greg Shuflin 353455ae9a android: widgets reflect the job they start, in place
Android's sync/push/import controls each kept a boolean for "did this screen
just click me", which is the pre-JobRunner pattern docs/sync-management.md's
"Widgets reflect job state in place" section describes replacing. It says
nothing about work started anywhere else — the background scheduler, a remote
TriggerSync, this screen before the app was backgrounded — and it evaporates
when the screen goes away, so a pull you started and navigated back to looks
idle and offers to start itself again.

A widget now names its work as a (kind, subject) pair and gets back the live
job row for it. The pair is built in Rust (job_match_key) and compared against
JobItem's new match_key, so neither side spells the identity itself and an
unknown kind fails where it is written rather than producing a key that
matches nothing. Behind them is one shared watcher of the store's job-change
signal (jobs/ActiveJobs.kt), running only while something is looking: the Jobs
screen's Active tab, the home screen's "N running" slot (a one-shot read on
entry until now), and every bound widget read the same list.

Bound: document detail's "Sync to this node", its per-artifact "Sync", its
per-peer "Push now"; the Ensemble screen's per-peer "Sync"; and the Documents
screen's folder imports. Each keeps one local flag, starting, covering the
milliseconds between the tap and the job row existing — without it a second tap
lands in that gap and starts the work twice, which run_as_job does not dedup.
2026-08-23 21:51:39 -07:00
Greg ShuflinandClaude Opus 5 3e41273bbc TODO: the note session survives navigation; process death is what's left
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 fcdf59ba2d android: the open note outlives the screen showing it
The note editor's state lived in `remember`, which navigation disposes —
so a decision the user had been asked for vanished if they glanced at
another screen, taking their unsaved buffer with it. A question that
disappears when you look away is not one you were really given.

`NotesEditorSession` is that state as an activity-scoped ViewModel. A
plain `viewModel()` inside a NavHost destination would be scoped to the
back-stack entry and cleared on pop — exactly the lifetime this has to
outlast — so it resolves against the activity instead. The screen
*around* the note keeps using `remember`: the tree, the sidebars and the
dialogs are cheap to rebuild and mean nothing once you have left.

The rail carries `1 incoming` off the screen with it, so the question is
visible from the home row rather than only by opening the note again.

Two things the guard has to get right, and the second is why it compares
against `heldFor` rather than `noteId`. Selecting a note sets the id
first and loads second, so between those two there is a session whose id
says one note and whose text is still the last one's; compared against
the id, switching away from a note with something outstanding would look
like a reason not to load the note being switched *to*, leaving the
screen on a note that never arrived. And the guard covers unsaved edits,
not only an unanswered incoming body — which means text now survives a
rotation, where before this it was lost with the composable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 f6fc542372 AGENTS.md and TODO: alert-don't-apply now has three worked examples
The design principle listed the desktop's and the TUI's; Android's is the
third, and `IncomingBody.alertFor`'s doc comment is where the rule for
telling their write from ours is actually written down.

What's left is narrower than the item it replaces: the alert itself works,
but Android's state lives in the `NotesScreen` composable, which
navigation disposes — so leaving with the choice unanswered drops the
unsaved buffer and returns to their version. That is one of the acts
AGENTS.md lets the incoming version through on, so it is the right
outcome; it just happens silently, and the desktop keeps its banner.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 49f39afafb android: the note editor announces a body that arrived elsewhere
The desktop and the TUI both watch the open note, announce a version
another node wrote, and stop writing over it until the user chooses.
Android did neither: a save is a whole-buffer write applied as a diff
against whatever the store holds *now*, so flushing on the way out of the
screen deleted the other node's edit back out of the merged text —
silently, and from every node, not just this one.

The rule for telling their write from ours is `IncomingBody.alertFor`, a
plain function so the part worth getting right can be checked without a
note, a store, or a screen. Two readings are uninteresting and both
matter: an unmoved store (every change to every *other* document arrives
on this signal too, so that is the common case by a wide margin), and a
store that moved to what the editor already holds, which is this node's
own save completing.

That second one is also what stops "keep mine" looping. It adopts their
version as the baseline *before* asking for the write rather than after
it lands, because the write is asynchronous and any signal arriving in
the gap would otherwise re-raise the alert the user just answered.

The banner is a strip above the text, not a dialog over it — a modal
would be its own violation of the rule, taking the screen from someone
mid-sentence to ask a question they may not want to answer yet. It names
what each choice costs, because with whole-buffer saves both of them lose
something: taking theirs drops what has been typed since it appeared,
keeping this node's removes their edit everywhere.

The save gate is narrower than the desktop's, which drops the whole save.
A title is an ordinary last-write-wins property on the document row, not
part of the body artifact, so it is still written while the choice is
pending — the same split the screen already makes for a note whose body
this node doesn't hold.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 d92a87a9db TODO: fold the change-signal work into the entries it touched
Three edits, all consequences of ADR 0041 landing rather than new work.

`JobsFfi::wait_for_change` no longer exists — the persistence section
named it as "the first instance of the answer" to reactive UI without
Room, with generalizing it as the open part. That is what `ChangesFfi`
is, so the bullet is now a statement rather than a task.

The Android note-editor gap was in two places at once: the Notes section
already owned it, in more detail, so the change-signal list points there
instead of saying it again.

And that Notes item still described the desktop's mechanism as a poll,
which it hasn't been since this work — the shape to port is a re-read on
the change signal, and `OnStoreChange` is already wired to that screen
for the tree.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 66e351bd85 daemon: say "syn-daemon" in ps, not whatever forked it
`daemonize` forks without exec'ing, so the daemon inherits the argv of
whatever started it. A daemon started by the TUI shows up as
`syn-tui -s ./store` — and since it is built to *outlive* that client
(ADR 0004 puts the store lock here), what a `ps` an hour later shows is a
TUI that apparently never exited. I fell for it myself this session and
nearly killed a working daemon.

Two names, because different tools read different ones. `comm` gets
`prctl(PR_SET_NAME)`, which `ps -o comm`, `top` and `pgrep -x` show.
`cmdline` — plain `ps`, and the one that misleads — has no call behind
it: the kernel reports the bytes between the `arg_start`/`arg_end`
pointers recorded at exec, so the only way to change it is to write over
that region, which is what every `setproctitle` does.

The title carries the store path, since one machine can run a daemon per
store and that is the only thing telling two of them apart. The room for
it is whatever the client's own command line happened to be — 42 bytes
for `syn-tui -s ./test-store` — so a real path usually loses something,
and it loses its *head*: the front of a store path is a home directory
every store on the machine shares, while the end says which store this
is. `…ject/synchronicity/test-store` identifies it; the first thirty
characters would only have identified the user. The cut steps off UTF-8
continuation bytes so `ps` never draws a replacement glyph, and stops
short of `arg_end` because past it is the environment.

All of it is best-effort: a name that didn't take is cosmetic, and the
inherited command line is at least true about where the process came
from. Only the write itself is unsafe — what to write is a pure function,
tested against the boundaries where it would otherwise have gone below
zero.

Writing the test turned up the constraint worth knowing: `PR_SET_NAME`
names the *calling thread*, and `comm` is the main thread's. The daemon
calls this from main after the fork so it lands, but anyone moving the
call would silently lose half the fix — now said in `set`'s doc comment,
and why the test reads `/proc/thread-self/comm` instead.

Foreground mode and the GUI's embedded socket are left alone; their argv
is already honest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 66f9835d7e ADR 0041 and TODO: record the Android half
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 dc56990c37 android: screens follow the store, and the ledger crosses the FFI
Android is in the store's process like the desktop app, but a uniffi
boundary carries calls and values, not channels — so it gets the shape
built for clients that have to ask: `ChangesFfi::cursor`/`wait` over the
same revision counters the daemon serves (ADR 0041).

One watch for the whole process, shared as a reference-counted flow and
collected through `OnStoreChange(nativeLib, CHANNEL) { ... }`. Two things
fall out of Compose that the other two toolkits needed code for: a
Composable that isn't composed isn't collecting, so a screen off the back
stack watches nothing, and `WhileSubscribed` stops the wait shortly after
the last screen goes, so a backgrounded app holds no thread parked. Burst
coalescing does not fall out, and is arranged the same way as on the
desktop — a 150 ms settle window, so a catalogue sync costs a handful of
reloads a second rather than one per committed transaction.

Nine screens follow it. Most already had the seam — a reloadKey a local
edit bumps — so following the store is bumping the same counter. Two
needed more. The Documents list makes the same settled-or-hold choice the
desktop's does, since a reload there also drops the expansion set and
goes back to page one, and shows the held change with the new
`ChangedElsewhereStrip`. The Notes screen re-reads the *tree* and never
the open body: that screen has no alert-don't-apply yet, so re-reading
the body would be exactly the silent overwrite the rule forbids.

`JobsFfi::wait_for_change` goes with this — it was the jobs-shaped
version of the same call, and the Jobs screen now collects the `Jobs`
channel of the general one. One signal, not two.

Also: `ChangeCursor::moved` asks whether a revision *differs* from the one
last seen rather than whether it is greater. The one way it can fall is
`SyncNode::reset_node` wiping the database and building a fresh `Store`
with counters at zero, and a watcher holding the old cursor has to hear
about that rather than wait deaf until the new store climbs past it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 9c493a06f2 ADR 0041 and TODO: record the GUI half
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 2a06e6a038 gui-app: screens follow the store, not the navigation
Every writer that can change what a GUI screen shows is already in this
process — a sync through the P2P node it hosts, a capture through the
daemon socket it also hosts, an edit two entities away — so the signal
was already here and what each screen was writing for itself was the
loop that waits on it. That is now `store_watch`, and the screens that
had no loop at all follow the store rather than waiting to be navigated
back to: the Documents list, the Notes tree, all five media libraries,
Humans, the podcast subscriptions and the Ensemble roster.

The last store *poll* goes with it. The podcast queue's three-second
timer is a subscription, so a queue reordered on the phone is noticed at
once instead of within three seconds, and a queue nobody is touching
costs nothing.

Two things the shared loop gets right that a per-screen one kept having
to: a burst of commits — which is what a sync is — costs one re-read
rather than one per transaction, and an off-screen screen re-reads
nothing. The second matters because every agent view here is built once
at startup and kept alive behind the one showing, so an ungated watcher
would have ten screens rebuilding out of sight; `watch_on_screen` reads
the sidebar's current view, and nothing is missed because arriving at a
screen already re-reads it. `JobsView` stays ungated on purpose: it
publishes the nav rail's running-job count, so it has to be right while
it is not the screen on display.

Each refresh answers CLAUDE.md's rule in the terms of its own screen.
The Documents list is one the user points at, so a new page is applied
outright only when there is nothing to disrupt and otherwise held and
announced — the choice `agents::snippets` already makes. The libraries
and the Humans roster apply outright: sorted by name, an arrival lands
in its own place instead of pushing the list down. The Notes tree
applies because `set_nodes` keeps the collapsed set, the selection and
an in-flight rename by id — and the open note's body is still
`watch_open_note`'s business, announced and never applied. The Ensemble
roster carries each row's ping/sync feedback across a refresh, so a peer
announcing itself doesn't wipe the answer the user just asked for. None
of them reports a failed read to the screen: nobody asked for it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 fb086f69c8 ADR 0041 and TODO: record the change-signal generalization
Also drops the provenance repair-path item: it needs a pre-0038 peer to
have synced first, and this project has no old clients to be compatible
with at this stage.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 99c9622615 daemon + TUI: AwaitChange generalizes from jobs to the whole store
`JobsCmd::AwaitChange` was the right mechanism in the wrong scope — it
could only ever say a job row moved, and a sibling command per store
would have made every screen its own client, with a parked daemon thread
each. It becomes `DaemonCommand::AwaitChange { since: ChangeCursor,
timeout_ms }`, answering with a `ChangeSnapshot`, parked on
`Store::await_change` through the same `spawn_blocking`. A zero timeout
with a default cursor reads where the store stands without waiting, so
no second command is needed to start from the present.

The TUI's Jobs screen was its only caller, so its replacement lands here
rather than leaving a commit that doesn't build. That private waiter and
the Notes screen's 1500 ms timer both become one `ChangeWatcher`: a
thread parked in `AwaitChange`, whose cursor the main loop diffs each
frame to mark the screens that read a moved channel. Documents and
Ensemble reacted to nothing at all before this; both do now.

Marking is not re-reading. A screen here re-reads by asking the daemon,
so it does that while the user is looking at it and when they switch to
it — refreshing all four per frame would cost a document page, a note
tree, a job list and an ensemble snapshot during exactly the sync this
exists for.

The refreshes are written so a sync can't disrupt what the user is
doing: Documents keeps its expanded turnstiles and its cursor by id
rather than going through `load_roots`, the Notes notebook list restores
its cursor by id instead of jumping to the first row, a change arriving
mid-prompt or mid-edit is held until that ends, and the Ensemble reload
leaves the status line's ping/sync outcome alone.

The CLI gets nothing and wants nothing: a `syn` command runs once,
prints, and exits — there is no frame to re-render.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg ShuflinandClaude Opus 5 75ba3904cc stores: one change ledger every announcing store bumps
The document/artifact bus, the job store's revision, the linkage signal
and a new one on peer nodes all bump a shared `ChangeLedger`: a counter
per `ChangeChannel` behind one condvar, so a single wait covers all of
them. Each store keeps the in-process announcement it already had and
bumps its channel at the same moment, so the two shapes cannot disagree
about whether something happened.

A counter rather than the events is what survives a round trip: a client
that asks, is answered, goes away to reload and asks again can only be
told what it missed if it can say where it was.

`JobStore::revision`/`wait_for_change` stay as the jobs channel's view of
the ledger, so Android's `JobsFfi::wait_for_change` is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-23 21:18:42 -07:00
Greg Shuflin 70e15693be ADR 0040: record the carrier change and its one visible difference
The serde_json::Value on CommandResponse::result is gone: 1627 us round trip
on the 500-row document page against 497 us carrying already-serialized JSON
text. The 1.13 ms saving is larger than the whole JSON-vs-MessagePack gap at
that size, which is the comparison this ADR opened with.

Also records the one thing that is not identical. A Value object is a BTreeMap
without preserve_order, so the old carrier alphabetized object keys where the
struct now emits them in declaration order — equivalent JSON, different bytes,
on a wire with non-Rust readers. Written down so a future reader does not
mistake it for a regression.
2026-08-23 21:18:42 -07:00
Greg Shuflin 1e856f88b2 daemon protocol: carry the response body as RawValue, not serde_json::Value
CommandResponse.result held a serde_json::Value, so every answer was walked
twice on each side: built into a tree then serialized, parsed into a tree then
destructured. Measured on the 500-row document page, the largest routine
response: 1627 us round trip, against 497 us carrying the already-serialized
JSON text. 1.13 ms, which is more than any binary format the protocol was
compared against would have saved (ADR 0040).

This is the change that the typed response bodies made cheap. The carrier is
named in exactly two places — commands::body() and client::query_daemon_as —
so it is a two-function edit rather than 138 call sites, which is what the
previous commit's doc comments claimed and this one collects on.

The JSON is equivalent but the bytes are not identical, and the wire has
non-Rust readers, so a test pins the difference: a serde_json::Value object is
a BTreeMap without the preserve_order feature, so routing a body through one
alphabetized its keys, where serializing the struct emits them in declaration
order. Both are valid JSON and every reader here looks fields up by name — the
browser extension via JSON.parse, the CLI's pretty-printer via a Value it
still builds for indenting, which re-sorts them anyway.

serde_json gains the raw_value feature at the workspace root. The one
remaining Value on a decode path is client::get_version, which reads the
/version body field by field on purpose so it can interrogate a daemon that
does not share this build's types.
2026-08-23 21:18:42 -07:00
Greg Shuflin 6de3e6c0d9 TODO/ADR 0040: drop connection reuse, considered and rejected
~28 us on a small command against a ~150 us fresh round trip, and no call site
issues a request per item, so it is per user action rather than per row.

The deciding factor is structural rather than the margin: the connection
cannot outlive the runtime driving it, since send() puts hyper's connection on
a spawned task and query_daemon drops the runtime on return. Reuse means
caching a runtime and a connection per thread — a shared one would serialize
the TUI's background threads behind its foreground queries — and then owning a
liveness check on every call, because nothing polls the connection task between
block_ons, plus invalidation across every thread each time
ensure_daemon_running replaces a mismatched daemon. That is a hang-shaped
failure mode bought for microseconds.

Records where the real remaining number is instead: the serde_json::Value
carrier, 1.18 ms of double traversal on the 500-row document page against the
~260 us reuse would save at that size.
2026-08-23 21:18:42 -07:00
Greg Shuflin adffa7e49c TODO/ADR 0040: fold in what landed, leave connection reuse
The typed response body and the per-call runtime are done, so TODO.md keeps
only the one measured win still outstanding — connection reuse — with the note
that query_daemon's build-send-drop shape is what makes it non-trivial, and
that a single shared connection would serialize the TUI's background threads
behind its foreground queries.

ADR 0040 moves its Decision half into the past tense and records three things
the implementation turned up: the four bodies where an Option distinguishes
"not applicable" from zero, the empty-note bug typing surfaced in
`syn note show`, and the two hand-rolled JSON reads that stay on purpose.
2026-08-23 21:18:42 -07:00
Greg Shuflin 39be93a53f daemon and clients: answer and read through the typed response bodies
Replaces the last of the hand-written JSON on the daemon protocol. The daemon
answers every command through one body() helper over a protocol struct — 61
json! literals gone — and the CLI and TUI decode into that struct instead of
indexing the value by string key, which was ~77 sites, nearly all of them with
an unwrap_or default behind them.

Two behaviours change, both because the old shape hid a state:

- `syn note show` on a note whose body has not reached this node printed an
  empty note. NoteSnapshot::body() has no way to express that, so it now says
  the text is on another node and names the command that pulls it. This is the
  same rule the TUI already followed and the GUI states outright: absence is
  not an error, and an empty buffer invites a retype that forks the document.
- A response this build cannot read now says so. Every consumer previously
  defaulted its way to an answer — "0 document(s)" for a body it did not
  understand. That is usually a daemon from another build, which ADR 0036's
  handshake replaces, except against the GUI's embedded socket, which it
  deliberately leaves alone.

The two hand-rolled reads that stay are deliberate and now say why:
client::get_version, whose whole job is to interrogate a daemon that may not
share this build's types, and EnsembleAddr { json: true }, which passes iroh's
own address JSON through for a user to paste.

tui-app gains a direct serde dependency for the decode helper.

Also drops the per-screen Value plumbing: the ensemble screen's worker thread
now describes its own outcome (it knows which command it ran), and the notes
screen splits its one query() into send() for the writes it ignores and
query_as() for the reads it does not.
2026-08-23 21:18:42 -07:00
Greg Shuflin 7c02e99333 daemon protocol: a response body struct per command
CommandResponse.result is a serde_json::Value, and until now every producer
built one with a json! literal and every consumer dug it back out by string
key with an unwrap_or default. A field the daemon renamed surfaced as a
confident 0 or an empty string in the UI rather than as a compile error. This
adds the vocabulary: one struct per command's answer in protocol, plus
client::query_daemon_as to read one.

Four of them distinguish "not applicable" from "zero", which is the part
that would be easy to get wrong later, so a test asserts the absence survives
the round trip:

- AssetSyncSnapshot's catalogue fields are None for the single-artifact pull,
  which runs no catalogue phase. Some(0) would report "none of 0 peers
  answered" about a phase that never ran.
- EnsembleSyncSnapshot's counters are None when a sync was already running:
  this call deferred and moved nothing, which is not "synced, nothing to do".
- NoteSnapshot carries no content when the body is on another node. An empty
  string there invites a retype, and saving that forks the document.
- DocumentListSnapshot has no total on the indexed fast path, which answers
  from one LIMITed query and never counts the rest.

The wire shape is unchanged: the browser extension reads these bodies from
JavaScript and the CLI prints several of them verbatim. See ADR 0040, which
also covers why the format stayed JSON while this changed.
2026-08-23 21:18:42 -07:00
Greg Shuflin 0f3cdf3a3a daemon client: a current-thread runtime per request, not a multi-threaded one
query_daemon and ensure_daemon_running built tokio's multi-threaded default
runtime for a path that awaits one Unix-socket round trip and cannot use a
second core. Measured 934 us to build and tear down against 11 us for a
current-thread runtime — the largest single item in a typical request, and
several times the JSON serialization the protocol was suspected of being slow
because of (ADR 0040). The TUI pays it per screen refresh and per
JobsCmd::AwaitChange long-poll iteration.

Kept per-call rather than shared in a OnceLock: the TUI runs long commands on
background threads while the main thread keeps querying, and a shared
current-thread runtime serializes concurrent block_on calls, so a catalogue
sync would stall every query behind it.

The server's own serve loop and cli-app's one-shot P2P commands keep the
multi-threaded runtime — they have real concurrent work.

Adds a test that blocks on the real sync entry point. hyper keeps the
connection on a spawned task that a current-thread scheduler only polls while
something else on that runtime is awaited; if that stopped holding the request
would hang rather than error, which no existing test would have caught.
2026-08-23 21:18:42 -07:00
Greg Shuflin d9a5271740 adr 0040: the daemon protocol stays JSON; type the response body instead
Closes TODO.md's "Explore alternatives to JSON for daemon protocol" as
explored and rejected. Measured on this project's own payload shapes:
MessagePack saves ~150 us on the largest routine response (500-row
DocumentItems), against a 934 us multi-threaded tokio runtime that
query_daemon builds per call and a 1.18 ms double traversal forced by
CommandResponse.result being a serde_json::Value. CBOR decodes slower than
serde_json for structured payloads. The browser extension is a JavaScript
client of /command, the CLI prints JSON as user-visible output, and a binary
wire makes a version mismatch quieter rather than louder.

Replaces the TODO item with the work that was actually hiding behind it -
typing CommandResponse - plus the two unrelated wins the measurements
exposed on the request path.
2026-08-23 21:18:42 -07:00
Greg Shuflin bb2805dc25 jobs: every surface runner-backed, so off-desktop jobs dedup and cancel
The `run_as_job*` family wrote job rows straight to `store.job_store`,
never registering with a `JobRunner`. Those jobs — every FFI sync, push,
eviction and single-file import, and every CLI/daemon import — had no
in-memory entry to dedup against and no cancellation token, so two taps on
"Sync to this node" were two concurrent transfers of the same subtree and
`cancel_job` answered `false` for all of them.

The family now takes `&JobRunner` instead of `&Store` and opens its job
through the runner like every other caller. Both surfaces already held one
(`SyncNodeCore::job_runner`, `AppState::job_runner`); the CLI's no-daemon
fallback builds a `JobRunner::transient`, which skips `new`'s startup
housekeeping — a one-shot `syn` command is in no position to declare
another process's `Running` rows interrupted.

The store-only `StoredProgress` reporter goes away: work that reports
progress now reports to the job's own handle, so `is_cancelled` is live
rather than permanently false. The daemon's `ImportFiles` gains a check
between paths to go with the one `import_directory_tree` already had, so
`syn jobs cancel` genuinely stops a directory import part-way.

`JobRunner::try_start` is new alongside `start`, returning
`JobNotStarted::{AlreadyRunning, NotRecorded}`. The split matters because
`start`'s `None` conflates a dedup hit with a failed row write, and
telling someone their import is "already running" when SQLite refused the
job row is a bug report nobody can act on.

Cancelling a single blocking P2P call still only marks the row —
`asset_sync` reads no cancellation signal — which is the same granularity
desktop's own detail-screen buttons have. TODO.md now names that as the
remaining gap.
2026-08-23 21:18:42 -07:00
Greg Shuflin 2db03889c5 TODO.md note 2026-08-23 18:25:58 -07:00
Greg Shuflin be3f232196 gui: let the hand-laid-out grids measure their columns
The document list, the presence survey and the detail screen's sync list
shared Table's Column layout but not its measuring, so every data column
was a hand-tuned guess — COL_SIZE was 108 because someone widened it after
a subtree total overlapped the presence indicator, and the presence grid's
node columns were 116 and truncated the node names the view exists to show
in full.

table.rs grows the measuring half of that layout: GridColumns is the cache
a screen keeps, ColumnMeasure is what it declares its content to, and
ColumnSizes is the cheap-to-clone answer the row builders take. The
declared content is fingerprinted, so no screen has to remember to
invalidate anything when its rows change — changing them is the
invalidation — and a zoom change re-measures because the widths are device
pixels. Columns are measured in the type they are actually drawn in
(CellText), which is what stops a monospace byte count being sized as
proportional text.

Every converted column keeps its old fixed width as its Auto minimum, so
the grids look exactly as they did until a value would have come up short,
and the only thing measuring can do is widen the column for that row.

DocumentsView measures all four grids once per render pass, before the
&self renderers run: measuring wants &mut self for its cache and
render_detail holds a borrow of self.detail for the whole of its call.
2026-08-23 16:45:17 -07:00
Greg ShuflinandClaude Sonnet 5 f798c77925 TODO.md: reorganize and dedupe; move FTS5 trigram option into ADR 0034
Consolidated duplicated Search entries into one section, moved
agent-specific items (Snippets, browser extension, per-artifact sync,
music tag scanning) under Agents, and merged the duplicated
sync-status/error-surfacing items under Android/Kotlin Improvements.

Also moved the FTS5 trigram tokenizer item out of TODO.md into an
expanded 'deferred option' section in ADR 0034, alongside the existing
materialized-path-column option — it's a design note to weigh later,
not near-term work.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ndrve7B613JDaTX2mojoAm
2026-08-23 04:40:06 -07:00
Greg Shuflin 6f6ad0a1a1 cli: one spinner rule for every network wait
`spinner::with_spinner` covered a handful of hand-picked call sites, so
`syn ensemble ping`, `syn ensemble sync`, `syn docs sync`, and `syn docs
purge` all sat silent while iroh dialled a peer.

Whether a command blocks on the network is a property of the command,
not of the call site that sends it — the daemon does the waiting either
way. So `spinner::wait_message` maps `DaemonCommand` to its wait text and
`spinner::for_command` wraps a dispatch in it, which puts the whole
daemon path behind one decision in `client::send_command` instead of a
spinner remembered per command. `import-url` now takes its wording from
the same table rather than retyping it.

Left out on purpose: `EnsembleAddr` and `GossipNeighborCount` name the
network but only read the live node's in-memory state.

Also drops the template `.unwrap()` in `with_spinner` — a bad template is
no reason to abandon the operation it decorates.
2026-08-23 04:08:24 -07:00
Greg Shuflin c590fcd464 TODO.md note 2026-08-23 03:56:21 -07:00
Greg Shuflin d6e8cc7499 snippets: Save, and a plainer source field
"Save" rather than "Keep" — it is the word the rest of the app already
uses (copy::action::SAVE), so the composer is now spelled the same way
every other form is. The URL field says "Source URL (optional)", which
names the thing rather than describing it, and the text box has no
placeholder at all: an empty box under a heading that says New snippet
does not need to be told what it is for.
2026-08-23 03:53:16 -07:00
Greg Shuflin b16709bfae snippets: a composer, so the screen can make one too
New snippet in the header opens a box for the text and one optional line
for where it came from. It calls the same SnippetsManager::capture the
extension and the CLI do, so a snippet made here is filed by the node in
the same place under the same rules — this screen names no destination
either (ADR 0039).

Not a permanent form at the top of the list: the screen is for reading
what arrived, and an occasional act shouldn't tax that every time it is
opened. Closing discards what was typed, because a composer that quietly
kept a draft would be a second place clippings live, and the screen's
whole claim is that it shows what the node has. A capture that fails
leaves the composer open with the text still in it — losing what someone
just typed is the one outcome worse than failing.

Existing clippings stay read-only for the SyncGuarded reason in the
module docs; a composer has no such problem, since nothing can arrive for
a snippet that does not exist yet.
2026-08-23 03:49:17 -07:00
Greg Shuflin ef466fd9ce TODO.md reorg 2026-08-23 03:46:08 -07:00
Greg Shuflin 1386deccfc TODO.md note 2026-08-23 03:35:21 -07:00
Greg Shuflin 8110584bba notes, linkages: react to change signals instead of polling
Notes' open-note watch now follows the document bus. The event carries
the ids its transaction wrote, so everything that isn't the open note
costs a comparison and nothing else — and a note body arriving from
another node lands the moment it commits rather than up to two seconds
later.

That case is also why the bus had to grow: a synced body is an *artifact*
write, and ArtifactStore announced nothing. It now shares DocumentStore's
bus and announces the document an artifact belongs to, which closes the
one documents-row write that escaped entirely (the CRDT merge bumping
modified_at — precisely the note-arriving-from-elsewhere case the watch
exists for).

The Linkages tab splits in two, because its poll was doing two unrelated
jobs. The list follows a new LinkageStore signal, so a client unlinking
itself or a pairing completed from the CLI lands without a tab switch.
The one-second tick stays exactly where it was: it drives a countdown,
and a clock has to tick whether or not anything happened.
2026-08-23 03:14:06 -07:00
Greg Shuflin 315f932614 documents: announce every committed change, and let Snippets react
Replaces the Snippets screen's two-second poll with a subscription. The
poll was the wrong pattern for a reason worth writing down: a store is
owned by exactly one process (StoreLock), so every writer that can
produce a clipping — the extension's capture through the daemon socket
this app hosts, a synced one through the P2P node it also hosts — is
already in the same process as the view waiting for it. Nothing had to
cross a boundary; there just wasn't a channel.

DocumentStore now carries one, mirroring JobStore's: a broadcast of
DocumentEvent, one per committed transaction, carrying the ids it wrote.
The discipline JobStore documents having to keep by hand — announce after
the commit, never from inside the transaction — is kept by construction
here instead: write methods record into a pending list, and batch()
publishes it only when the transaction commits, so a writer cannot
forget and a rollback cannot announce. Both batch entry points do it,
since either may be the one a document was written in.

One event per commit, not per row, is what makes it usable during a sync:
a chunk of a hundred documents wakes a screen once. Subscribers re-read
rather than applying what the event carries, so falling behind and
missing events entirely is survivable — which is what the GUI does on
Lagged.

The bus covers documents and properties; artifacts announce nothing yet,
and TODO.md carries both that gap and the one documents write that
escapes it.
2026-08-23 03:14:06 -07:00
Greg Shuflin 0c1d636f03 snippets: notice clippings that arrive while the screen is open
The screen only ever re-read its list on navigation, so a clipping saved
from a browser on the other monitor didn't show up until you left and
came back. It now watches the store every two seconds while it is
showing — the same shape notes uses for an open note, since nothing in
the store announces a write and a capture lands either through this
process's own daemon listener or through a sync.

What it does with an arrival depends on whether there is anything to
disrupt. Prepending to a list someone is reading shifts every row below
it, which is the thing CLAUDE.md's first design principle forbids — so
the new list is applied outright only when the user has expanded nothing
and is at the top, and is otherwise held behind a "2 new clippings —
Show" line in the list itself. The common case is the first one: clip in
a browser, watch it appear.

The watch stops when you navigate away, which is also the other moment a
held version is applied: coming back is an explicit act.
2026-08-23 03:14:06 -07:00
Greg ShuflinandClaude Sonnet 5 981b62e25c Send NodePresence across the FFI as a uniffi::Enum
DocumentNodeStatusItem::presence was a String filled with
NodePresence::label(), and Kotlin's PresenceLook.of() parsed it back by
matching string literals with an else -> WAITING catch-all. NodePresence
now derives uniffi::Enum and crosses the FFI directly; PresenceLook.of()
and .label() take the enum with exhaustive when blocks, so a new variant
is a compile error instead of silently falling into WAITING.

Addresses TODO.md's 'Send NodePresence across the FFI as a uniffi::Enum' item.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ndrve7B613JDaTX2mojoAm
2026-08-23 03:01:23 -07:00
Greg Shuflin b5bb14b3a2 Update frizbee to 0.13 and migrate to its Matcher API
The free `match_list`/`match_list_parallel` functions are gone; matching now
goes through `Matcher`, which compiles the pattern once and reuses the SIMD
backend. `Matcher::new` takes the needle literally (`Matcher::from_query`
would parse `^foo`/`foo$`/`!foo` query syntax, which is wrong for a
user-typed name or tag), so the three call sites keep their old semantics:
`find_human_by_name`, the combo box, and the tag input.

Two silent `Config` changes came with it. `sort` went from `bool` to the
`SortStrategy` enum, defaulting to `ScoreThenIndexAsc` — the same
best-first order these sites already relied on. `casing` now defaults to
`Smart` rather than `Ignore`: an all-lowercase query still ignores case,
but any uppercase letter demands the same case in the candidate, and a
mis-cased query ("GREG" for "Greg Shuflin") stops resolving entirely
rather than merely ranking lower. That's wanted, so it stays — pinned by
`find_human_by_name_is_smart_cased` and noted on the lookup's doc comment,
since nothing about the call site hints at it.

Also fixes a `flex_shrink()` call in snippets.rs left over from the gpui
bump, which renamed the no-arg form to `flex_shrink_1()`.
2026-08-23 02:43:29 -07:00
Greg Shuflin 29f21c033d gui: update gpui to 7913984 and fix the palette color API break
gpui-ce moved its color types onto the `palette` crate — `Hsla`/`Rgba` are
now re-exports of `palette::Alpha<Hsl/Rgb, f32>`, so the old
`From<Rgba> for Hsla` is gone and conversion goes through palette's
`IntoColor`. gui-app takes `palette` as a direct dependency (pinned to
gpui's own 0.7.6) so it can name that trait:

- `components::note`'s three helpers take `impl IntoColor<Hsla>`, matching
  gpui's own `text_color`; that alone fixes every note/fill_note/overlay_note
  call site passing a theme `Rgba`.
- `HighlightStyle`/`TextRun` colors built from theme `Rgba` use
  `.into_color()` instead of `.into()`.

Two other API changes in the same bump:
- `TextRun` gained `letter_spacing: Option<Pixels>` — `None` everywhere we
  build one.
- `flex_shrink()` now takes an f32; the old no-arg form is `flex_shrink_1()`.
  Renamed the two call sites and the sizing/AGENTS.md notes that name it.
2026-08-23 02:43:29 -07:00
Greg Shuflin 4807495ff0 gui: take the upstream play and pause icons
Both carried a v1.21.0 license header while not matching the v1.21.0
tarball, so vendor-icons.sh rewrote them every time anyone ran it to add
an unrelated icon — which is how they turned up as a drive-by change in
the snippets work.

Re-vendored from the pinned version, which is the only state in which
that script is idempotent: a second run now produces no diff. Upstream's
are a little heavier — pause's bars 5x18 rather than 4x16, play a rounded
path rather than a sharp polygon — and read fine at icon::SM, which is
what the transport bar draws them at.

The rest of the set already matched the pin; these two were the whole
drift.
2026-08-23 02:20:41 -07:00
Greg Shuflin 086d71d447 snippets: let the empty state be one line
"Nothing clipped yet." and nothing else. The paragraph under it explained
where clippings come from, which is the browser extension's job to say at
the moment someone is in a browser with text selected — here it is read
once and then in the way forever after.
2026-08-23 02:08:14 -07:00
Greg Shuflin 41be454e32 extension: say which id is the node's and which is this browser's
The popup showed one identity per node and called it "Identity", and
never showed the extension's own client id at all — so the value the
node's Settings ▸ Linkages screen files a linkage under was invisible
from the side that owns it, and the one id on screen was easy to read as
"mine".

Now the per-node field is "Node id" and this browser's own id sits once
at the foot of the popup, under its own rule, labelled "This browser" —
apart from the node list because it is a fact about a different machine.
Both are truncate-with-reveal and copyable, through one implementation
now that two things want it.

Also takes the code field's placeholder to 123-456, matching what the
node writes.
2026-08-23 02:08:07 -07:00
Greg Shuflin 5c9ccfbc90 linkages: group the pairing code, and let it be copied
The code is read off one screen and typed into another, which is exactly
the length at which six unbroken digits get lost — so every surface now
writes it 123-456 through one shared pairing::display_code, and the GUI
grew a Copy button beside it, since a copied code looks identical to an
uncopied one and the clipboard says nothing itself.

The dash is presentation only: the node still compares plain digits, and
the extension strips every non-digit from what was typed or pasted. A
dash someone can see is not a dash they should have to think about.

Copy puts the plain digits on the clipboard rather than the grouped form
— the clipboard is a hand-off to anything, and not every client will
strip what ours does.
2026-08-23 02:07:38 -07:00
Greg Shuflin 3831e160ee snippets: a Snippets screen in the desktop app
A list of clippings, newest first, each showing the text itself rather
than a title — the title *is* the first line, so a list of them would be
the same words twice at different lengths. Rows clamp to a few lines and
expand on click; Copy puts a clipping back on the clipboard, Delete
removes it.

Read-only on purpose. Everything here arrives from somewhere else, and an
editable buffer that a sync can land on needs the SyncGuarded
alert-don't-apply flow around it (ADR 0031) — the body is
last-write-wins, so an unguarded editor would quietly lose one side.
NoteEditor is reusable as-is when that gets built; TODO.md carries it.

A snippet whose text is on another node says so rather than showing its
title as though that were the clipping — absence is a state to render,
not a blank.

Also flips ADR 0038 and 0039 to Accepted now that both are built.
2026-08-23 01:40:59 -07:00
Greg Shuflin 48e87c3b16 extension: clip a selection into a node
A context menu item — the one thing that cannot live in a popup — and a
recent-clippings list under each linked node in the popup, read back
through the same /command surface the menu writes through, so "did that
land?" is answered by the node.

The extension still never reads pages. contexts: ["selection"] makes the
browser hand the selected text to the click handler, so this needs no
scripting permission and no host access to the sites being clipped from,
only to 127.0.0.1. An extension that read the page to find the selection
would be asking for far more than clipping is worth.

The menu is rebuilt from stored linkages on start and whenever they
change: one item when a single node is linked, a child per node when
several are, and no item at all when none is — an entry that could only
fail is worse than none, and the popup is where "not linked yet" gets
explained.
2026-08-23 01:40:59 -07:00
Greg Shuflin 4bcc1a0db9 snippets: capture, list and delete from the daemon and the CLI
DaemonCommand::Snippet carries no destination — the node resolves where
a capture lands, so a client never learns a document id (ADR 0038). That
is what a paired browser extension will call; `syn snippets` is the same
three verbs plus a show, and reads stdin when given no text, so
`pbpaste | syn snippets capture` is the same act from this side of the
machine.

Also fixes a bug found while checking the ADR's own claim that a snippets
root costs one row in the Documents list: only_roots was honoured by
search_document_items but not by search_documents, so
`syn docs list --roots-only` quietly listed children too on every sort
order that takes the second path.
2026-08-23 01:40:59 -07:00
Greg Shuflin a0b5e78e82 snippets: the model — a Snippet document, an anchored root, a plain TextBody
Implements the lib half of ADR 0039.

A snippet is an ordinary document: Title from its own first line, the
page it came from as the new generic SourceUrl property (Immutable —
provenance is not something a later edit revises), and the text itself as
the new TextBody artifact, which is NoteBody without the CRDT. The page's
own title rides along as a Fact, since nothing dispatches on it.

Every capture is filed under one root, so the Documents list — which
shows roots and folds children behind a count — stays one row deep
however many thousand accumulate. That root is the first anchor: a
deterministic id from (agent, slug) in its own namespace, created on
first capture, Provenance::Anchor so it is listed like any container and
can never be tombstoned.

Callers never name a destination. capture() resolves it through a
SnippetsDefaultRoot pointer on the agent's settings document, so a second
snippets tree later moves a property instead of changing anything a
client knows — and a pointer at a deleted document falls back to the
anchor rather than costing someone a clipping.

Adding three wire enum variants bumps SYNC_PROTOCOL_VERSION to 15; the
fingerprint test caught the omission, which is what it is for.

A new AgentId is a new arm in every exhaustive match, Kotlin's included.
Android has no Snippets screen yet and its clippings still sync there, so
the agent gets a placeholder screen that says so rather than being left
out of the list — a phone that disagrees with the desktop about which
agents exist is the harder thing to explain.
2026-08-23 01:40:59 -07:00
Greg Shuflin 527e9d53bc documents: a Provenance per document, replacing DocumentType::is_derived
Implements ADR 0037. is_derived was one boolean answering three
questions — may this be tombstoned, should it be listed, is its id
deterministic — which agreed for the three types that answered true and
stop agreeing the moment an agent wants a visible, well-known root.

Provenance { User, Anchor, Derived, Machinery } is stored on the
document, immutable on the wire, with the three predicates derived from
it. A pre-0037 store gains the column by ALTER TABLE and is backfilled
from the type list is_derived used to carry; peers that predate the field
send none, and their records read as User, which every document but a
handful is.

The listing exclusion stops interpolating type names into NOT IN (...)
and becomes a predicate on the new column. SearchParams::include_derived
becomes include_hidden, and the flag it backs is now spelled
--show-hidden / "Show hidden" across CLI, TUI, GUI and Android, since
agent settings rows were always in what it hid.

Note the trap this introduces, and which the tests here now demonstrate:
a MusicAlbum built with Document::new is an ordinary user document that
merely has that type. That is the point — the classifier moved onto the
document — but it means a caller can now get it wrong where the type
system used to decide.
2026-08-23 01:40:39 -07:00
Greg Shuflin f9e4ae83c5 adr: provenance per document (0038), and snippets (0039)
Two decisions the browser extension's first real feature forced.

0038 retires DocumentType::is_derived, which is one boolean answering
three questions — may this be tombstoned, should it be listed, may a
wikilink reach it — that agree only for the three types that answer true
today. A snippets root needs the first and the negation of the second, so
it replaces the boolean with a Provenance field on the document itself:
User, Anchor, Derived, Machinery, with the three predicates derived from
it. Per-document rather than per-type because an anchored root and a
user-made second root are the same DocumentType and differ only here.

0039 makes a snippet an ordinary document under an anchored root, rather
than a note (a clip is not something the user wrote — the same argument
Interaction already makes against Note) or an artifact on one global
document (which opts out of search, sync policy, wikilinks and per-item
purge for a document-count worry the roots-only Documents list already
answers). Its body is a new plain TextBody artifact rather than NoteBody:
a clip does not need a CRDT per copy, and SyncGuarded — not Loro — is
what keeps a sync from disrupting an edit.

Numbered 0038/0039 rather than 0037/0038: master landed its own 0037
(list virtualization) while this branch was in flight.
2026-08-23 01:40:39 -07:00
Greg Shuflin 2f4a2e4327 android: repair the NoteItem merge master landed broken
NotesModels.kt held two NoteItem declarations — the pre-virtualization one
carrying `availability` (ADR 0033) and the virtualized one carrying
`override val id` (ADR 0037) — which is a conflict resolution that kept
both sides. Kotlin refused it ("Conflicting declarations", "'id' hides
member of supertype"), and NotebookRepository, which passes
`availability =`, refused with it.

One declaration, both fields: the tree needs the id to key its virtualized
rows, and the row still needs to mark whether this node holds the note's
body.

Not part of the snippets work — it just sits between this branch and a
Kotlin build that compiles at all.
2026-08-23 01:40:39 -07:00
Greg Shuflin 650c887192 Remove extraneous code 2026-08-23 01:16:06 -07:00
Greg ShuflinandClaude Opus 5 cb017f582a gpui: virtualize HierarchicalSidebar with uniform_list
The tree sidebar looped over every uncollapsed row each render — the same
plain `.children()` shape MediaLibrary shed on 2026-08-18, and on the
collection that grows fastest, since a notebook is what a user adds to every
day. It now uses uniform_list, which builds and lays out only the rows in the
viewport.

Three things uniform_list demands in return, because it measures row 0 and
gives every row that height:

- No gap between items. The 1px inter-row separation moves inside the item,
  as a row_slot wrapper padding below a row of exactly control::ROW.
- The inline rename editor can no longer grow its row (min_h -> h). TextInput
  gains a compact() variant whose tighter vertical padding lets the whole
  field — border, padding, and a 20px line — sit inside a 32px row.
- Scrolling moves to a UniformListScrollHandle; the hand-rolled scrollbar
  reads the plain ScrollHandle that one wraps, via plain_scroll().

And one behaviour change worth knowing about: while a rename is in progress
the list anchors to that row. The editor exists only while its row is
rendered, and a field that stops being rendered loses focus, which the sidebar
reads as a click-away and commits — so scrolling the row out of view would
silently commit the rename. It can still be scrolled to either edge of the
viewport, just not past.

ADR 0037 records the cross-modality convention this completes, and TODO.md's
entry is retired into it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CbS8L587Q6qxbnZt1QHoxg
2026-08-23 01:11:51 -07:00
Greg ShuflinandClaude Opus 5 1f38e6854a Android: virtualize the notebook sidebar tree
NoteTreeList already flattened the tree into a memoized List<NoteRow> and drew
it into a verticalScroll Column, which composes and lays out every row a
notebook has. LazyColumn — the same widget MediaLibrary.kt and DocumentList.kt
already use — composes only the rows in the viewport.

Keyed by item id, so a row's own state (its long-press menu) stays with its
item as the tree expands, the filter narrows, or a sync reorders the list
underneath it. That needs an id every NoteTreeItem answers to, so the two
subclasses' ids are hoisted onto an abstract val on the sealed class.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CbS8L587Q6qxbnZt1QHoxg
2026-08-23 01:10:43 -07:00
Greg ShuflinandClaude Opus 5 56583854eb TUI: virtualize the notes and documents lists
ratatui's List already paints only the rows that fit, but it takes an
already-built Vec<ListItem>, so a screen that maps over its whole collection
every frame pays to format, elide and allocate a Line for every item it owns
at the terminal's redraw rate. The new virtual_list module computes the index
range a list of a given height will actually paint — reproducing what List
does with a ListState internally for single-line items — so the screens build
only that slice.

Applied to the two screens whose lists can plausibly grow: notes (notebook
list and notebook tree) and documents. jobs_screen keeps handing List the
whole collection because its items are two lines tall, which the index
arithmetic here can't address; ensemble_screen and sidebar.rs are bounded by
the node and agent counts.

tree_rows still measures the availability mark column over every item rather
than over the window, so the column holds still as the list scrolls.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CbS8L587Q6qxbnZt1QHoxg
2026-08-23 01:09:35 -07:00
Greg ShuflinandClaude Opus 5 39c55bc6c2 docs: record the Pictures streaming adapter and the FFI shape behind it
ADR 0016 gains the amendment for the last blob-backed agent to get an
adapter, including the two things deliberately left out of it — no
read-ahead, since a library is browsed rather than read forward, and the
pane rather than an error for an image that never comes.

ADR 0033's Android section says why the availability reached that
sidebar through a new agent FFI object rather than by widening the
generic document row, and narrows what is still open there to the
structural question ADR 0032 owns.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CFsX3bn3rTqrx7vFSC62Wo
2026-08-23 00:17:59 -07:00
Greg ShuflinandClaude Opus 5 dde8093ca6 android: mark availability in the Pictures sidebar, and open what isn't here
The library now comes from the Pictures agent's own tree rather than a
generic document search, so each row carries where its image can be read
from. The mark is the notes tree's: the word in a trailing column,
costing nothing in a library that is entirely here, and textOnAccent on
the selected row.

The viewer streams what this node doesn't hold, showing the same fetch
progress the comic reader does, and says "blob not found for document
<uuid>" to nobody ever again — an id ADR 0026 says not to show, for a
state ADR 0033 says isn't a failure. It gets the pane instead, in Rust's
words.

AbsentContentPane moves to ui/Availability.kt on the way past: the
rule-over-sentences layout had been written twice already, and this
would have been the third.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CFsX3bn3rTqrx7vFSC62Wo
2026-08-23 00:17:59 -07:00
Greg ShuflinandClaude Opus 5 c7d9f55e31 gui: the picture viewer fetches, and stops calling absence an error
Selecting a picture whose blob lives on another node ended in "Failed to
load image" — the canvas reporting a fault for the ordinary condition in
an ensemble. It now reads locally first, and only on the one error that
means the bytes are elsewhere does it wait on a peer, with the shared
in-place progress treatment and a cancel.

The wait goes through network_task, not the background executor: a
thread parked on a peer is a thread the rest of the UI can't have.

When nothing reachable is serving it — or the user cancels — the canvas
gets ADR 0033's pane treatment instead: the rule over sentences, in the
words lib now owns. Which of the two absences it is comes from the tree
walk that already computed it, kept whole rather than collapsed on the
way in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CFsX3bn3rTqrx7vFSC62Wo
2026-08-23 00:17:59 -07:00
Greg ShuflinandClaude Opus 5 7e6ed42459 lib: give Pictures its own FFI object, and let it stream
Pictures was the only media agent with no FFI object at all, so Android
reached past it to the generic document search — which returns Image
documents and nothing else. No albums, and no availability on a generic
document row, which is why that screen could mark none.

PicturesFfi::list_tree is the same build_picture_nodes the desktop
already calls, so the two modalities can no longer disagree about what
the library contains; PictureTreeItem is a uniffi::Record like
MusicTreeItem and ComicTreeItem beside it.

get_image_bytes is the local-then-peer load, matching
ComicsFfi::get_page_bytes down to the one error it treats as "ask a
peer". Pictures was the last blob-backed type that couldn't open what
this node doesn't hold (ADR 0016).

copy::picture_absent holds what a viewer says instead of an image it
couldn't get, so the desktop and Android can't explain one condition two
ways. Neither wording is written as a failure: absence is not an error.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CFsX3bn3rTqrx7vFSC62Wo
2026-08-23 00:17:59 -07:00
Greg ShuflinandClaude Opus 5 d988b7c721 android: mark availability in the notes tree
The Notes sidebar was the surface ADR 0033 named as never having marked a
note whose body it holds only a stub for — and Android had been dropping
the state on the way in, rebuilding NoteTreeItem.NoteItem from the FFI's
NoteTreeEntry without its availability.

The desktop sends a tree row's state to a hover tooltip, which a touch
screen has nowhere to put. So the row takes the terminal's answer from the
same ladder: the word in a trailing column, costing no width at all in a
notebook that is entirely here, and eliding the name rather than the mark
when one of them isn't. On the selected row it is written in textOnAccent,
like everything else on the saturated selection block (ADR 0032 §5) — the
two states are told apart by the word, not by the colour.

Starting an absent note over now reloads the tree, since that is the one
action that makes a row's mark stale from under it.

Comics needed nothing: its library is MediaLibrary and its reader has the
pane. What is left is Pictures, which is handed no availability to mark at
all and renders a remote image as an error; TODO.md now says so.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CFsX3bn3rTqrx7vFSC62Wo
2026-08-23 00:17:59 -07:00
Greg ShuflinandClaude Opus 5 29c493b6f8 dev: stop editor rust-analyzer from running cargo outside the devShell
rustaceanvim overrides rust-analyzer's own defaults when `cargo-clippy` is on
PATH (config/server.lua): it forces `checkOnSave = true` with
`check.command = "clippy"`, so every write to a Rust buffer runs clippy across
the whole workspace. That cargo invocation happens outside `nix develop`, where
this workspace's native deps can't build — observed in a rust-analyzer log as
`failed to run custom build command for alsa-sys` / `yeslogic-fontconfig-sys`.
So it recompiles a large dependency tree on every save, dies in a build script,
and returns no diagnostics at all. It doesn't even share artifacts with a real
build: the editor drives the rustup toolchain while flake.nix pins 1.92.0.

`rust/rust-analyzer.json` turns it off, and excludes the archived slint GUI from
indexing. rustaceanvim looks for that filename at the cargo workspace root,
which `cargo metadata` reports as `rust/` for every crate here. Keys are flat
and dotted rather than nested so a developer's own machine-specific settings
merge with these rather than replacing them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172MSMpGA7YaqAHkUSSo8bo
2026-08-22 23:56:50 -07:00
Greg ShuflinandClaude Opus 5 db0d9fbd24 gui: fold the single-line text input into the shared editing trait
`components/multiline_editing.rs` held the editing half of the two *multi-line*
widgets; `text_input.rs` carried its own copy of about twenty of the same
handlers — left/right, the select_* pair, home/end, the word-wise moves and
deletes, backspace/delete, clipboard, escape, and the mouse handlers. The
module is now `components/text_editing.rs` and all three widgets share it.

The three obstacles TODO.md named, and what each turned into:

- **Geometry** is now the `EditingBuffer` trait: `offset_at`, `ime_bounds`, and
  a `row(direction)` whose default leaves the caret where it is, since a
  single-line field has no other row. `MultilineBuffer` answers from its
  `Vec<WrappedLine>`; `SingleLineBuffer` (in `text_input.rs`, next to the
  element that writes it) from one `ShapedLine` plus a scroll offset, and it
  also overrides line_start/line_end to the ends of the value so a `\n` that
  arrived via `set_content` can't strand Home mid-value. Everything else on
  the trait is a default method over the text.
- **Enter** stayed one action set: `bind_editing_keys` binds neither Enter nor
  Up/Down, and `bind_submit_keys`/`bind_multiline_keys` each claim them for
  their own widget. Up/Down had to move too — an input's key context is the
  innermost one while it is focused, so binding them there would take the
  arrows away from the list a command palette, combo box or tag input puts
  under its field.
- **The event** did not need merging. `InputEvent`'s ~15 consumers are
  untouched: the shared code asks only for the two events every editor has,
  through `emit_changed`/`emit_cancel`, and `Submit` is an overridable action
  handler like `insert_newline`. A `TextArea` never grows a `Submit` variant it
  can't emit.

`MultilineEditing` survives as a sub-trait carrying `height()`, which is all
`MultilineTextElement` needs beyond the shared surface, so the paint side keeps
its blanket impl and the input isn't dragged into it.

Two behavior changes fall out of the fold, both wanted: the input gains
undo/redo (Ctrl+Z/Y, unbound anywhere else) and breaks undo coalescing on
navigation, and `character_index_for_point` now answers Some(0) rather than
None over an empty field.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172MSMpGA7YaqAHkUSSo8bo
2026-08-22 23:41:04 -07:00
Greg ShuflinandClaude Opus 5 cf9f7754e3 gui: give the settings node-name field a definite width, and lint the shape that broke it
The field was `div().flex_1().max_w(FIELD_MAX_WIDTH)` — the same
grow-then-clamp shape that gave the Notes search field 2px of input inside a
630px box. With free space larger than the cap, the frame's final width comes
from growing and then being clamped, but its children were laid out against
its max-content width and are never replaced, so the field drew as a slice too
narrow to read what was being typed into it.

- `render_node_name` now takes a definite `.w(FIELD_WIDTH)` plus
  `flex_shrink()`/`min_w(px(0.))`, so it still gives way to the Save button on
  a narrow window — the only half of growing that was doing real work.
- `FIELD_MAX_WIDTH` -> `FIELD_WIDTH`: it is a definite width, and its old name
  is what invited `.max_w()`.
- `sizing.rs`'s `layout` docs blessed `.flex_1().max_w(TOKEN)` for "a field
  sharing a row with something else" and named this very function as the
  example. That exception is why the bug came back; it's gone.
- `just lint-gui-layout` (scripts/lint-gui-layout.py) now fails on `.flex_1()`
  and `.max_w()` in one element chain. It matches parens rather than lines, so
  an exploded chain and a `.child(div()...)` argument are each seen correctly,
  and it exempts chains that also declare `.flex_col()` — there `flex_1` grows
  height and the cap is on the untouched cross axis. Clippy cannot see this
  class: both calls are perfectly ordinary on their own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172MSMpGA7YaqAHkUSSo8bo
2026-08-22 23:41:04 -07:00
Greg Shuflin 34ebb91c54 extension: ship the Synchronicity icon
Rendered from assets/synchronicity-icon.png — the same icon the desktop
and Android apps use — at the four sizes a browser picks between, and
committed rather than generated, since src/ has to stay loadable with no
build step. `just extension icons` re-renders them.

The crop is measured rather than eyeballed: the mark occupies 412x451 of
the 775x771 source, so a 578px square centred on it leaves the mark
filling ~78% of the frame. Uncropped, a 16px toolbar icon was a smudge
with a dot in it.

The test asserts every icon the manifest names exists and is as wide as
the size it is filed under — a browser that can't load one silently draws
a puzzle piece instead.
2026-08-22 23:34:47 -07:00
Greg Shuflin a96840de3f linkages: trim the pairing card's copy
The idle card is one line — "Generate a linkage code" — over the button
that does it. The waiting card keeps the countdown and drops the rest:
the absolute expiry time was there for a user who looked away, but the
code is dead in two minutes either way, and the attempt-cap line
explained a defence rather than telling anyone what to do next.
2026-08-22 22:45:13 -07:00
Greg Shuflin 2acad8786c linkages: drop the explanatory paragraph under the heading
The tab's own contents say what a linkage is better than a paragraph
about it does: a list of programs, each with a Revoke button. What is
left under the heading is the one fact the screen can't show — the
loopback address companions reach this node on.
2026-08-22 22:37:38 -07:00
Greg Shuflin 728bce508f extension: link a browser to a node, and say where linking happens
The popup gains per-node link/unlink controls: a code field that redeems a
pairing over /pair, a stored token keyed by node pubkey (not port, which
changes every restart), and an Unlink that revokes on the node before
forgetting the local copy — a forgotten-but-not-revoked token is still a
live grant sitting in someone's settings screen.

A stored token is confirmed by running `status` with it rather than
trusted, so a linkage revoked on the node stops reading as "Linked" here.

Also: the Linkages tab names the loopback port companions reach this node
on, or says plainly that there isn't one — a node that lost the port race
at startup otherwise mints codes nothing can ever redeem, which reads
from the other side as "the extension is broken".

Amends ADR 0017 with the six things implementation changed, and rewrites
TODO.md's browser-extension section around what is left: mobile pairing,
/ws, capability scoping, and the extension actually doing something.
2026-08-22 22:23:25 -07:00
Greg Shuflin 0ff6d0a43f linkages: bearer-token access for the browser extension (ADR 0017)
Adds the Rust half of ADR 0017's pairing: a LinkageStore of revocable
grants, an in-memory pairing challenge, a guarded loopback listener, a
Linkages tab in GUI Settings, and `syn linkage list/pair/revoke`.

A linkage is one program on this machine holding a bearer token for this
node's command surface — the browser extension first, other companions
later. The token is minted once and only its blake3 hash is stored; a
client-minted client_id makes re-pairing the same install rotate its
token in place rather than accumulate rows.

The loopback listener now serves /pair and /command alongside /version,
behind three layers that do not replace the token: web-page origins are
refused, CORS is echoed only to extension origins (never *), and POST
bodies must be application/json so a page cannot reach either route
without a preflight it will not get.
2026-08-22 21:42:57 -07:00
Greg Shuflin 9c17d6f607 lint: close out ADR 0022's Kotlin lint follow-ups
Three of the four resolve; the InjectDispatcher one was the wrong shape.

- getOrElse { throw it } is now enforced by `just lint-kotlin-rethrow`, a
  grep -Pz guard both lint recipes depend on. detekt still cannot express it
  (it is a throw expression, not a method call), but a recipe closes it
  without the Gradle subproject + RuleSetProvider the ADR rejected. Proven
  to fire on the one-line and multi-line spellings, and to ignore
  getOrElse { return }, before landing.
- InjectDispatcher: re-measured at 98 findings, only 39 of them in the five
  repositories; the other 59 are @Composable sites where an injected
  dispatcher is a defaulted parameter with nothing to substitute. So it
  stays off permanently rather than "until repository tests exist", and the
  real work — those tests, and the dispatcher parameter they need — moves to
  TODO.md's Testing section.
- LaunchedEffect (76 sites then, 89 now) stays deliberately open pending a
  crash to justify it; recorded in the ADR, not tracked as work.
- The ~14-15 min lint cost is gone: measured 5s of Gradle work, ~12s wall,
  warm. The lib/build.rs .jj/working_copy trigger was the cause, not type
  resolution.

detekt.yml's change is comment-only. Verified with lint-kotlin-fast (config
validation) and lint-kotlin (type resolution), both green.
2026-08-22 20:53:41 -07:00
Greg Shuflin efe00a0722 rustfmt fix 2026-08-22 20:50:01 -07:00
Greg Shuflin 58520131b4 Reduce copy verbosity 2026-08-22 20:49:34 -07:00
Greg Shuflin 7bfa4b7794 docs: retire the shared-property-projection TODO into data-model.md
The sweep it asked for comes back clean — the only PropertyKind:: outside
lib is a #[cfg(test)] fixture in syn-daemon — so what is left is a standing
convention, not unfinished work. Move the rule and the reason for it into
docs/data-model.md under Property, and repoint rss-reader.md §4 at it.
2026-08-22 20:27:21 -07:00
Greg ShuflinandClaude Opus 5 6584aa4f0d ci: stop wiping the cargo target dir after every APK build
The android APK job took ~13.5 min on a runner with a persistent
CARGO_TARGET_DIR, and the log showed it compiling `quote`, `syn` and
~600 other dependency crates from scratch on every run. Two causes, and
they compound:

* The job ended with `cargo-sweep --maxsize 2GB`, unconditionally. The
  live working set is bigger than that (the aarch64 release tree alone
  is ~2 GB, plus the host debug tree `uniffi-bindgen` is built from), so
  the sweep always cut into it — and since it evicts oldest-first while
  `.fingerprint/` entries are both old and tiny, it reclaimed 871 MiB
  while throwing away cargo's whole record of what was already built.
  The next run re-invoked rustc for all ~1060 crate units; sccache
  turned 92% of them into cache hits, which hid the problem rather than
  fixing it. Sweep only when the dir is actually over a cap.

* CARGO_BUILD_JOBS was pinned at 2, which throttles the build twice
  over: across the dependency crates, and again on the 6m45s tail,
  because rustc draws jobserver tokens from cargo for parallel LLVM
  codegen — so synchronicity_lib's 16 release codegen units were being
  emitted two at a time. Derive it from the runner, capped by RAM
  rather than cores alone so a small runner doesn't swap.

Also logs the runner's cores/RAM/free disk and the target dir size, so
the next run says what the machine actually has.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZKNoVdLEtNvcbgCpc9Bq6
2026-08-22 19:52:43 -07:00
Greg ShuflinandClaude Sonnet 5 7c7b52bf6c android: fix two node-init/ensemble UI bugs on a fresh ensemble
- Ensemble screen: "1/0 other nodes reachable now" on a single-node
  ensemble. gossipNeighborCount and the members roster are independently
  sourced (live gossip mesh vs. the membership registry) and can disagree
  transiently; gate the reachable-count branch on otherMembers being
  non-empty too, not just the gossip count.
- CreateIdentityScreen (enter ensemble key): opening the soft keyboard slid
  the instructional text up underneath the back button. The content column
  was Alignment.Center, so imePadding growing its effective height
  re-centered it upward; switch it to Alignment.TopCenter with a top
  padding that clears the back button, so it can only grow downward.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015WyXVQTyKcc7yMG9KCEr8F
2026-08-22 19:35:05 -07:00
Greg Shuflin 4120f43ef4 pdf: trim the empty-library message to "No PDFs yet"
Drops the "import a file, or open synchronicity on another device..."
explanation, matching the minimal style used elsewhere.
2026-08-22 19:32:14 -07:00
Greg Shuflin 4e3cdfedf3 update test ensemble key in justfile 2026-08-22 19:27:53 -07:00
Greg ShuflinandClaude Sonnet 5 9c2495a645 copy: consolidate media-library empty-state text into synchronicity_lib
Adds a shared copy::library_empty module (music, podcasts, pictures, comics
& manga, PDF viewer) so the GUI and Android agents show the same words for
the same absence instead of each frontend typing its own:
  - Music library: "No music library" (was a verbose import instruction).
  - Podcasts subscriptions: "No podcast subscriptions".
  - Podcasts episode list: "No episodes" (GUI told the user to click
    Refresh; both platforms already load episodes on their own).
  - Pictures canvas: "No image selected" (GUI said "No image displayed").
  - Comics & Manga library: "No comics yet"; In Progress/Recently Added tab
    copy is now shared too.
  - PDF viewer canvas: "No PDF selected" (GUI-only state; Android navigates
    to its viewer only once a PDF is picked).
  - Humans empty state drops its "start keeping track of people" subtitle,
    leaving just "No people yet" plus the Add button.

Exposed to Android via a library_empty_copy() FFI record, mirroring the
existing action_labels/placeholder_copy pattern.

Also migrates Android's MediaLibrary.kt off its closed LibraryTab enum onto
the same consumer-declared LibraryTabConfig/tabs model the desktop already
uses (ADR 0025), replacing the OptionalTabConfig opt-in params. A finder tab
that should snap back to the first tab on activation (Recently Added, In
Progress) now opts in via LibraryTabConfig.bounceBackOnActivate instead of
the component hardcoding which tabs those are. The unconditional
Recommended tab -- an inert placeholder backed by no real data on either
platform -- is gone, so Comics & Manga shows the same three tabs on both
platforms; PdfLibraryScreen.kt and VideoScreen.kt move onto the new tabs
API too as the migration's other two consumers.

Trims copy.rs's doc comments throughout: cuts restated rationale and
multi-paragraph justifications down to the load-bearing sentence.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015WyXVQTyKcc7yMG9KCEr8F
2026-08-22 19:27:53 -07:00
Greg ShuflinandClaude Sonnet 5 3e71dbc79e documents: trim the empty-library placeholder to "No documents"
Drops the "Click 'Import from local file…' to add a document" subtitle,
matching the minimal one-line empty-state style used elsewhere.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015WyXVQTyKcc7yMG9KCEr8F
2026-08-22 18:58:04 -07:00
Greg Shuflin cf13b42034 copy: share the job-state words and the display timestamp
The last two hand-written mirrors of Rust behaviour in the frontends, and
one of them had already drifted visibly.

Job states were spelled out three times: on the enum in the desktop, on the
snake_case tag in the TUI, and again on the tag in Android. copy::job_state
now holds the five words, keyed on the tag because two of the three surfaces
only ever have the tag -- the TUI reads job rows off the daemon as JSON, and
Android gets them through the FFI as strings. JobState::display_name routes
the enum through the same list rather than repeating it, which is why label
returns Option rather than echoing its input: that is what lets the method
hand back a 'static str without a second copy of the words.

Each frontend keeps its own composition, which is presentation and genuinely
differs -- the TUI writes "Failed: <error>" where the desktop shows the error
alone in red, and Android prefers a live progress message over the word
"Running". Only the words are shared.

The timestamp was the drifted one. JobUtils.kt carried a DateTimeFormatter
described in its own doc comment as matching Timestamp::format_display, and
it did not: "MMM dd, yyyy HH:mm" with no zone suffix, so the same job read
"Aug 22, 2026 15:24" on Android and "Aug 22, 2026 15:24 PDT" on the desktop.
A displayed time with no zone on it is a poor thing to show on a system
whose premise is that the same documents are open on several machines at
once. copy::format_timestamp is now the one implementation, and Android
gains the zone it was missing.
2026-08-22 16:41:54 -07:00
Greg Shuflin 9acde425e1 copy: hoist the placeholders, button labels, and job-kind names out of the frontends
Follows the fetch-progress copy into copy.rs, and turns up three bugs on
the way.

Placeholders. copy::human_display joins node_display and document_display,
because the three are not interchangeable and the frontends had been
treating them as though they were: the TUI labelled untitled *notes*
"(unnamed)", as though a note were a node, and the desktop wrote its own
"Unnamed" for a person. A nameless person does not read as "Untitled".
Nine sites across gui, tui and Android now resolve through lib.

copy::action holds the button words. The rule is "more than one surface
says it" -- Remove and Edit are deliberately absent, since hoisting a label
only one frontend uses buys indirection and no consistency. Twenty-six
Cancel sites plus Save/Delete/Rename/Import now read one definition, and
content_fetch::CANCEL/TRY_AGAIN become re-exports: they are ordinary
labels the fetch block happens to need, not words about fetching.

That surfaced the second bug. Android's snackbar offered "Retry" while the
fetch block offered "Try again" -- the same offer, worded two ways, on the
same device. Now one word.

And the third, which was mine: JobUtils.kt mirrored JobKind::display_name
with a hand-written `when`, and mirrors go stale. It never learned
library_build, and content_stream broke it again this session, so the Jobs
screen would have rendered both through its fallback as "Library_build" and
"Content_stream". It now calls job_kind_label over the FFI, so a kind added
in Rust arrives here without anyone remembering to come back.

Android's formatBytes went the same way in the previous commit; this
finishes the sweep for the literals that were left.
2026-08-22 16:41:32 -07:00
Greg Shuflin eb4d267d86 copy: rename help.rs, and define the fetch-progress copy once for both modalities
help.rs was three things under one name: help text (the presence tooltips),
display placeholders (node_display, document_display), and value formatters
(format_bytes, format_last_seen, short_id). Only the first was help. It is
now copy.rs -- the single place a user-visible string is written -- and its
module doc says so.

copy::content_fetch is the new tenant, and it holds both halves: every word
a user reads while waiting on a transfer, and the state machine that
decides which words apply. Sharing the strings while forking the logic that
picks them would have left the interesting half duplicated -- and that half
is where the bug actually was, when the desktop and Android each kept their
own derivation and disagreed about whether a zero-byte transfer was
connecting or running.

Both frontends are now renderers over it. components::remote_fetch calls it
directly; Android reaches the same two functions through
content_fetch_display/content_fetch_copy, with the button labels and
subject nouns in a record fetched once. Neither file contains a string
shown to anyone, and the state-machine tests moved to lib where the logic
lives.

Android's own formatBytes is gone the same way. It counted in decimal units
and stopped at MB, so a 50 MiB file read "52.4 MB" there and "50.0 MB" on
the desktop, and a 2 GiB one read "2147.5 MB" against "2.0 GB". Two
surfaces quoting different sizes for the same blob is worse than either
convention being wrong; it now delegates to copy::format_bytes over the
FFI, keeping its Long-taking shape so the seven call sites are untouched.

placeholder_copy() exports "(unnamed)" and "Untitled" for the same reason,
though the screens hard-coding them are not converted here.
2026-08-22 16:40:18 -07:00
Greg Shuflin 460129ff89 content fetch: a Cancel alongside Try again, and one shared failure sentence
A failed block offered only "Try again", which is a dead end for anyone who
has decided not to bother -- it then sits over the library until they pick
something. Both modalities now offer both: try the node again, or put it
down. A running transfer still offers just the one way out, because
stopping it is the only choice there is.

On the desktop that meant separating "the fetch is over" from "the user is
done with the failure": end() deliberately leaves a failure standing so the
canvas keeps its explanation, so dismiss_failure() is the explicit clear
that Cancel binds to.

The two modalities' copy is now identical, checked literal by literal. The
six state strings already matched; the failure sentence did not -- the
desktop wrapped it ("Couldn't open this PDF: couldn't reach a node that has
this PDF", saying couldn't twice and this PDF twice) while Android showed
it bare and lowercase. Neither was right. Both now pass the error through
untouched and let the component capitalize it, so the words are the shared
Rust ones from content_fetch and the agents, and neither modality writes
copy of its own.
2026-08-22 16:37:08 -07:00
Greg Shuflin e40652bad3 content fetch: fire the stall warning inside the connect timeout, not after it
STALL_HINT was anchored above blob_stream's 15s per-peer connect timeout on
the reasoning that anything shorter would call an ordinary peer attempt
wedged. That conflates the bound on a connect *failing* with how long a
working one takes -- a handshake that is going to succeed resolves far
sooner than 15s.

The consequence was that the warning could only appear once a second peer
was already being tried. With a single unreachable peer -- the ordinary
case for a two-node ensemble, and the one actually hit -- the fetch failed
at 15s and went straight from Connecting to Failed, so the state this work
added was unreachable in the case that most needed it.

8s on both modalities: comfortably longer than a healthy connect, with
enough of the window left that the warning precedes the failure rather than
arriving with it. The clock is not reset between peers, so "no node has
answered in Ns" stays true cumulatively across attempts.
2026-08-22 16:37:08 -07:00
Greg Shuflin 33c1fbc951 content fetch: report a node that never answers, and keep failures on screen
Two gaps a real failure exposed. Opening a PDF whose only holder was
unreachable sat on "Finding a node with this PDF…" for the full 15s
blob_stream connect timeout, then the block vanished with nothing said.

The stall clock now starts when the job appears rather than at the first
byte. Timing it from the first byte meant the commonest failure there is --
a peer that never answers -- was the one case that could never be reported,
because the byte that would have started the clock never arrived. Arming
still starts nothing: a job row is what says a transfer is genuinely under
way. Wedged with zero bytes gets its own words ("No node has answered in
Ns -- still trying") since there is no transfer to call stalled, only
silence. The threshold drops to 18s so it lands above one connect attempt
and still well inside the fetch timeout.

Both modalities gain a Failed state. §4.1's third state is "visible,
non-modal, with a retry affordance", and a block that disappears into a
snackbar is precisely the silent non-return the rule exists to prevent --
so the block stays up with the reason and a Try again. Android's PdfAgent
now returns the Result instead of logging it away, so the message is the
Rust one: Offline and NotFound want different words and different
affordances, and only the FFI layer knows which happened.

NotAvailableRemotely is reworded to "couldn't reach a node that has this"
across content_fetch, pdf, and comics. It maps to Recourse::RetryLater
precisely because the holder may be asleep rather than gone, and telling
someone their file is unavailable when their laptop is merely shut is a
worse error than saying nothing.

A test caught the desktop losing its Connecting branch in the rewrite --
state() now matches Android's stateOf ordering exactly, silence outranking
the byte count, with a comment saying so.
2026-08-22 16:37:08 -07:00
Greg Shuflin 4d08e15439 tui, cli: stop painting Removed as an error
Content this node deliberately evicted is absent, and absence is not an
error (CLAUDE.md; ADR 0032 §4). The desktop GUI fixed this when
PresenceLook was written — its NotHere takes text_tertiary — but the two
terminals still gave Removed the error colour, which reads as a fault
where there is none. Both now dim it, as they already dim Absent; the
word beside the glyph carries which kind of gone it is.

Also files the last stringly-typed presence consumer: Kotlin's
PresenceLook.of() still parses the literals the way the desktop GUI did
before NodePresence replaced them, and crossing the FFI as a
uniffi::Enum needs a machine that can compile Kotlin.
2026-08-22 15:52:27 -07:00
Greg Shuflin 3afbcc3f8b node_status: make the presence vocabulary a type
The five presence words — Present, Ref, Absent, Unknown, Removed — were
a stringly-typed enum. artifact_presence_for_node and
blob_presence_for_node computed one and returned &'static str; six
places wrote the literals; help.rs matched them back with an
unknown_label fallback for words that couldn't occur; gui-app parsed
them into a real enum (PresenceLook::of) and cli-app matched them to
pick a glyph. The vocabulary was also restated a seventh time in a
protocol doc comment and an eighth in a test's expectation list.

NodePresence replaces all of it. Serialize/Deserialize carry it over the
daemon socket, and because serde spells a unit variant with its own
name, the wire format is byte-identical to what the literals produced.
label() is IntoStaticStr rather than a hand-written table, the same
drift-free shape DocumentType::type_name() uses — one derivation feeds
both the wire and the word.

Note this is not NodeDocumentPresence with a derive bolted on: that enum
has two of the five values and is one of three weaker facts the display
state is computed from. It gets a From impl, which is total.

Both help.rs tooltips are now exhaustive matches, so unknown_label is
gone, and the test that listed the words drives off VariantArray
instead.
2026-08-22 15:52:27 -07:00
Greg Shuflin 83c6da6716 docs: record the TUI's share of the availability treatment
ADR 0033's "Other modalities" said the TUI showed availability nowhere
and left the terminal equivalents open. It now has them, so the section
records which two rows of the table the terminal took and why, along
with the two things it still lacks — the No source escape hatch, and the
Documents screen, which is not an availability surface in any modality
yet.
2026-08-22 15:52:27 -07:00
Greg Shuflin dad2ca1d0e notes: mark a note whose body lives on another node, via serde
ADR 0033 settled what to say about DocumentAvailability and where; the
TUI said it nowhere, so a note this node holds only a stub for opened
with no indication of it.

Getting the state to the terminal meant deleting a layer, not adding
one. NotebookCmd::Tree's reply was assembled by hand — tree_node_to_json
writing field names as string literals, and a matching walk over
serde_json::Value in each client — and the hand-written version had
already drifted: the TextFormat that serializes as "plain_text"
everywhere else in the protocol went onto the tree as "plain", because
the two spellings lived in different files and nothing made them agree.
So NoteTree/NoteTreeNode derive Serialize/Deserialize (serde(tag =
"kind"), which reproduces the flat shape a tree walker wants),
DocumentAvailability derives them with rename_all = "snake_case", and
the daemon's reply is to_value(tree). The TUI and the CLI deserialize a
NoteTree and match on real variants; "no_source" becomes "unavailable",
which is the better answer to the ADR's own point that the machine name
and the prose must be separable.

The terminal then takes two rows of the ADR's table rather than
inventing an answer of its own. The notes tree row is the list row: the
word goes in a trailing column, sized to the widest mark actually in
view, so a notebook that is entirely here spends no width and one
holding only Remote notes reserves no room for the longer "No source".
When a name can't fit beside its own mark the name is elided — a row
clipped to look unmarked would say the opposite of the truth. The
preview pane is the full pane, with the desktop's and Android's
sentences under a rule (────── for Remote, ╌╌╌╌╌╌ for No source, dropped
below six columns where a broken line stops looking broken). The pane
header gets nothing, which is the desktop's 260px-rail argument in a
terminal. Both editors already refused a body that isn't here; the
refusal now names which state it is in.

syn-cli notebook tree gains the word too — it had been handed three
states and shown none.

No escape hatch for No source yet: that needs a daemon command for
NotebookManager::abandon_absent_body, so the copy says where the way out
is instead of offering a key that isn't there.
2026-08-22 15:52:27 -07:00
Greg Shuflin e771868f76 android: open PDFs through a file, not a 271 MB byte array
Fixes an OutOfMemoryError crash on the PDF library screen: renderPdfCover
read a document's whole blob into the JVM heap to rasterize page 0, which a
large PDF cannot fit — the reported case tried to allocate 271 MB against a
~192 MB growth limit, and every cover in the library tried in turn.

The allocation was never needed. MuPdfDocument.openFromBytes writes the
array to a temp file and calls Document.openDocument(path), so mupdf reads
a file either way; the ByteArray was a full extra copy of the document on
the way to a file it was going to make anyway. PdfRepository's FromBytes
already carried a comment about OOMing on large PDFs — this is the same
hazard one level up.

content_fetch::write_blob_to_file streams a blob's plaintext to a path a
chunk at a time, local or remote: the local branch decrypts chunk by chunk
rather than calling BlobStore::load (which would move the same mountain on
the Rust side), and the remote branch is the existing peer loop with a file
for a sink, which is what pump_session's sink parameter was for. Peak
memory is one 64 KiB chunk whatever the document's size.

PdfFfi::write_to_path exposes it, and the Android library screen uses it
for both covers and opening, handing the viewer a PdfSource.FromPath. A
blob already on disk is a local decrypt and gets no job row — a library
rendering covers would otherwise post one per thumbnail — while a blob off
a peer stays a watchable, cancellable ContentStream job.

PdfFfi::get_bytes goes away with it. Added earlier today, now used by
nothing, and a byte-array whole-PDF loader is exactly the shape that
crashed: an API offering to do it would be used. ComicsFfi::get_page_bytes
keeps its byte-array shape because a page image is small and is decoded
from an array regardless.

Covers stay local-only, as the design called for: renderPdfCover checks
isBlobLocal first, so walking a library never starts a fetch. And
materializePdf sweeps its previous cache file on the way in, bounding the
cache at one document — the file has to outlive the call, so it cannot
clean up after itself on the way out.
2026-08-22 14:45:45 -07:00
Greg Shuflin 2fd79e060a android: give readers the shared content-fetch progress treatment
PdfFfi::get_bytes is the PDF counterpart to ComicsFfi::get_page_bytes: local
blob store first, then streamed from whichever peer holds it, so a PDF that
hasn't synced here opens rather than showing "PDF data not found". The
Android library screen now calls it instead of the local-only blob read.

ui/RemoteFetchProgress.kt is the Android half of the desktop's
components::remote_fetch, and reads the same ContentStream job rows: a
determinate bar with byte counts, an honest indeterminate one when there is
no denominator, and a wedged state once the counter has been still for 20s
— warning-styled, and without abandoning the transfer, because a slow peer
is not a failure. Both readers get a cancel.

The comic reader's read-ahead moves to ComicsFfi::prefetch_page_bytes, the
untracked call, so three speculative rows per page turn don't bury the page
the reader is blocked on. renderPdfCover stays local-only: a library of
covers is not worth a fetch each.

The PDF progress block is laid over the library rather than under it —
appearing in the column would shorten the list and move rows out from under
the user's finger.

SyncError grew a Cancelled variant (Recourse::RetryNow), since telling
someone to report a bug because they pressed Cancel is the mismatch ADR
0023's taxonomy exists to prevent; SyncFailures.kt's exhaustive when picks
it up, exactly as that file's doc comment says it should.

TODO.md's Android-PDF-streaming entry is replaced by the TUI follow-up: it
is the one modality still without the treatment.
2026-08-22 14:45:45 -07:00
Greg Shuflin 4b300b5df0 content-fetch: one shared, tracked, cancellable remote blob fetch
The PDF reader, comic reader, and music's Stream-policy fallback each had
their own peer loop, timeout constant, and NotAvailableRemotely variant --
and none of them could say how far along a transfer was, because
BlobStreamSession::read_to_end is where the byte counter stopped existing.

Adds lib::content_fetch: the peer loop, the per-peer timeout, a throttled
byte counter reported through the existing ProgressReporter, and a cancel.
Each of these transfers is now a JobKind::ContentStream job -- deliberately
not ContentFetch, which the scheduler uses for transfers that leave a
durable local copy; the two key on the same document but end in different
places, so sharing a kind would make them dedup against each other.

JobProgress::fraction_done now falls back to the byte fraction when there
is no unit count, so a single blob transfer draws a determinate bar rather
than the indeterminate spinner this work exists to remove.

On the desktop, components::remote_fetch replaces pdf_viewer's
fetching_remote and music's fetching booleans with a state the screen can
actually render: connecting, running with byte counts, or wedged -- a peer
that goes quiet is now distinguishable from a slow one while it is still
true, rather than surfacing as an error two minutes later. Read-ahead
fetches stay untracked, so a page turn doesn't bury the page the reader is
blocked on under three speculative job rows.
2026-08-22 14:45:45 -07:00
Greg Shuflin 34e08a9de8 docs: scaffold Android visual design review 2026-08-22 05:02:12 -07:00
Greg Shuflin 86bca7a9cf pomodoro (gui): stack the session count under the phase name
Side by side, 'Focus' and 'no sessions yet' read as two peers on one line.
Stacked, the phase is the heading of the countdown below it and the count
is its caption, which is the relationship they actually have.
2026-08-22 03:53:33 -07:00
Greg Shuflin fc0f3a0d2c pomodoro: implement the timer agent on the desktop and Android
The cycle itself lives in the shared lib as a pure state machine —
phase order, when the long break falls due, MM:SS formatting, progress —
so both modalities drive one definition rather than each re-deriving
'after four focus sessions, take the long one'. It holds no clock: each
frontend feeds it elapsed milliseconds from its own monotonic source
(Instant on the desktop, SystemClock.elapsedRealtime() on Android), so a
screen that stops being painted still counts real time.

Completing a phase advances to the next one *paused*. A break that
started itself while the user was away is a break they didn't take, and
the focus-session count would become a record of wall-clock rather than
of work done.

Nothing is persisted or synced. A countdown is a thing happening at this
node right now; restoring one from disk two days later would be counting
down to nothing.

The timer crosses the FFI as a uniffi record with pure transition
functions, which is what lets Compose treat each transition as a new
value to recompose from.
2026-08-22 03:53:33 -07:00
Greg Shuflin 1a4764e2bd docs: move the materialized path idea from TODO.md into ADR 0034
It was filed as a TODO item, which reads as work that is meant to happen.
It isn't: path enumeration would buy contiguous tree slices and delete the
per-modality assembly, but it costs a migration and a reparenting invariant
that corrupts ordering silently when it breaks, and the unindexed title
filter dominates anything the tree work costs today.

Record it in ADR 0034 as a deferred option instead, with what it would buy,
what it would cost, and when to revisit. TODO.md keeps only the FTS5 item.
2026-08-22 03:11:08 -07:00
Greg Shuflin 12eae1a1f4 TODO.md tweak - remove design work no longer necessary 2026-08-22 03:04:06 -07:00
Greg ShuflinandClaude Opus 5 7e7cafe7d0 docs: correct the Kotlin lint timings in AGENTS.md
AGENTS.md told agents to budget ~14-15 min for `just lint-kotlin` and pointed
them at `lint-kotlin-fast` as the practical alternative. That cost was the
build-sha rebuild, and it is gone: warm, the recipe is 2s with nothing changed
and 26s after a Kotlin edit. Left as written, the guidance would send a future
session planning around a two-second command — and toward the fast recipe,
which cannot see the six type-resolution rules that are the whole reason
lint-kotlin exists.

A genuinely cold tree still pays ~15 min to build the aarch64 dependency tree
once, so that number stays, scoped to the case it applies to.

Also records the failure signature, since this is a regression that hides well:
if the recipe takes minutes again with nothing changed, look at lib/build.rs
first, and the tell is rustc running during a lint.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016n5WWHbMmck6B6LM67Vi8a
2026-08-22 02:57:23 -07:00
Greg ShuflinandClaude Opus 5 49d74ee937 android: let buildRustLib and copySharedAssets go up to date
Neither task declared inputs or outputs, so Gradle could never skip them and
both ran on every invocation. buildRustLib is the expensive one to leave
awake: it shells out to cargo, and generate<Variant>UniffiBindings — and
therefore compileDebugKotlin and detektDebug — hang off it, so an
always-running task at the root keeps the whole chain from settling.

The input list has to be complete, because it decides whether cargo is
consulted at all; cargo remains the authority on incremental rebuilding once
it is. synchronicity_lib has no local path dependencies, so the set is
tractable: the crate's own sources, its build.rs and Cargo.toml, the workspace
Cargo.toml and Cargo.lock for dependency versions and profiles, and the
justfile — which is where RUSTFLAGS, the NDK linker and the
ANDROID_NDK_VERSION pin live, so a toolchain change arrives as an edit to a
watched file.

copySharedAssets gets the same treatment, matching copySharedFonts, which
already declared both.

Verified: with nothing changed `just lint-kotlin` reports 12 actionable tasks,
12 up to date, in 2s (previously 4s with two tasks always executing). Editing
the justfile wakes buildRustLib alone; editing a lib source wakes it and the
binding regeneration behind it. Every declared path exists, which Gradle
enforces — it fails outright on a declared input that does not — so none of
them is silently dropped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016n5WWHbMmck6B6LM67Vi8a
2026-08-22 02:57:23 -07:00
Greg ShuflinandClaude Opus 5 3d4e8786f4 daemon: identify a build by its own inputs, not by the commit hash
ADR 0005's decision — derive the "is this daemon reusable" check rather than
hand-maintain a protocol constant — still holds. Its carrier does not.

COMMIT_HASH is baked into synchronicity_lib, so it can only refresh when that
crate rebuilds. An edit confined to syn-daemon, which is where DaemonCommand
and CommandResponse actually live, cannot move a constant compiled into lib —
so the check could not see the one kind of change most likely to break the
wire. Fixing the build-stamp churn sharpened this: lib/build.rs now reads the
working-copy commit without snapshotting, so an uncommitted edit need not move
it at all. In the other direction the hash was too broad, restarting a
perfectly good daemon because an Android screen or a doc changed.

syn-daemon/build.rs now hashes syn-daemon/src, lib/src and both Cargo.tomls
with blake3 and exposes the digest as syn_daemon::BUILD_ID. /version reports
it; ensure_daemon_running compares it. Scope is those two crates because
between them they define the wire and everything reachable from it — cli-app,
tui-app and gui-app cannot change it and no longer force a restart.

Both handshake sides compile from syn-daemon (client.rs and server.rs are
modules of one crate), which is what makes a per-crate digest usable as a
comparison at all. Hashing each binary's own file would not work: the daemon
and the CLI are different binaries and would never match.

COMMIT_HASH is unchanged and stays in the response. "What commit did this come
from" is a human-facing question on an about screen where an approximate answer
is fine; whether two processes speak the same protocol is not.

Verified across the four cases that matter: a syn-daemon edit moves the id
(3e1b8fc9 -> d69a1147), a lib edit moves it (e261440b), a cli-app edit leaves
it alone, and reverting any of them restores the original digest exactly. A
no-op rebuild is stable, and build.rs names only paths that exist, so it does
not reintroduce the always-rebuild trap lib/build.rs fell into.

A build script can fail quietly by emitting an empty value, and two empty ids
would compare equal — making every stale daemon look current. A unit test
asserts the id is a full 16-character hex digest.

ADR 0036.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016n5WWHbMmck6B6LM67Vi8a
2026-08-22 02:57:23 -07:00
Greg ShuflinandClaude Opus 5 08079a9598 android: turn on the Gradle build cache and detekt's parallel analysis
Two settings, neither of which was the bottleneck — the build-sha rebuild in
the previous commit was — but both of which are free and apply on every machine
that builds this project.

org.gradle.caching serves an unchanged detektDebug from the cache instead of
re-analysing, which is the common case after a `clean` or a branch switch.
gradle.properties is project-level, so this applies however Gradle is invoked
(gradlew, `just gradlew`, Nix, CI, Android Studio); anyone who wants it off can
override in ~/.gradle/gradle.properties, which takes precedence over the
project file.

detekt's `parallel` analyses files across threads and is off by default.
detektDebug is the type-resolution pass ADR 0022 requires to pass, and it is
the slowest remaining step once the Rust rebuild is gone.

org.gradle.parallel stays commented out: single-module build, nothing to
parallelise against. org.gradle.configuration-cache stays off and the reason is
now recorded next to it — buildRustLib, copySharedAssets and copySharedFonts
all call `copy { }` (and buildRustLib `project.rootDir`) at execution time,
which the configuration cache forbids; they need FileSystemOperations injected
and their paths captured at configuration time first.

Measured on this machine, `just lint-kotlin` with the previous commit in place:
no-op run 4s (was 13m12s), and 26s for a real Kotlin edit, which is a Kotlin
recompile plus the type-resolution pass. The cross-build it used to trigger is
now 1s rather than 5m58s.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016n5WWHbMmck6B6LM67Vi8a
2026-08-22 02:57:23 -07:00
Greg ShuflinandClaude Opus 5 3e3be09c50 build: stop rebuilding synchronicity_lib on every jj command
lib/build.rs stamps the build with its commit (ADR 0005) and watched VCS paths
to know when to re-run. In a jj repo that trigger is unfixable, and it was
costing ~6 minutes per no-op build of the largest crate in the workspace — a
warm `just lint-kotlin` with nothing changed measured 13m12s, about half of it
this.

`.jj/working_copy` is rewritten by *every* jj command, including read-only
ones: a bare `jj log` bumps the mtime of both `checkout` and `tree_state` while
`@`'s commit id stays put. Cargo compares mtimes, so a `jj status` was enough
to force a rebuild. Worse, build_sha shelled out to `jj log` without
--ignore-working-copy, which snapshots — the script dirtied its own trigger on
every run and could never be up to date.

The `.git` paths were the same bug from the other side. They don't exist in a
non-colocated jj repo (the backing store is at `.jj/repo/store/git`), and a
rerun-if-changed naming a missing path re-runs the script on every build.
Verified against a control: a build script watching a missing path recompiled
on runs 2 and 3, one watching a real path stayed fresh. So a non-colocated
checkout had the permanent rebuild too, and its stamp fell through to
"unknown".

There is no jj path whose mtime means "the content changed", so this drops VCS
watching entirely. A build script that emits no rerun-if-* directive gets
cargo's default — re-run when a file in this package changes — which is exactly
when the crate recompiles anyway. The stamp is free and still changes whenever
this crate's code does, which is what it is for: telling whether two running
binaries came from the same code.

CI is branched, because naming any rerun-if-* opts out of that default: a
script emitting only rerun-if-env-changed does not re-run even when the crate
recompiles, which locally would freeze the stamp until `cargo clean`, but in CI
is required or crane's cached cargoArtifacts would carry a stale SHA into a
release build.

Measured after: three rounds of jj activity, zero rebuilds; touching a lib
source still rebuilds and re-stamps; the local stamp still equals `@`; and
SYNCHRONICITY_BUILD_SHA still overrides and is still watched.

One narrowing to note: the stamp now tracks this crate's sources rather than
the whole repo, so editing only syn-daemon no longer changes it, and the
daemon/client handshake in syn-daemon/src/client.rs will not catch that case.
Making that check exact again means keying it on something other than lib's
compile-time constant.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016n5WWHbMmck6B6LM67Vi8a
2026-08-22 02:57:23 -07:00
Greg ShuflinandClaude Opus 5 12bdd86e28 docs: ADR 0035 for reading PDF metadata in lib
Records why the parse lives in lib rather than in each viewer, and why
hayro-syntax rather than the mupdf crate: it is the PDF Syntax chapter in pure
Rust with no C and no bindgen, and it was already in synchronicity_lib's
dependency closure via typst and krilla, so it costs no build time anywhere,
Android included.

Also covers the two things a reader would otherwise get wrong — that PDF text
strings are PDFDocEncoding absent a BOM (and that PDFDocEncoding is not
WinAnsi), and that page_count is deliberately still each viewer's own.

Drops the finished TODO entry. The neighbouring page-count entry stays but its
blocker changed: the count is now read at import, so what is left is
persisting and rendering it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016n5WWHbMmck6B6LM67Vi8a
2026-08-22 02:57:23 -07:00
Greg ShuflinandClaude Opus 5 27fee668df gui, android: both PDF viewers get document info from lib
Deletes gui-app's extract_metadata and the info:* key lookups in Android's
MuPdfDocument.metadata(). Both now call the shared reader, so the desktop app,
Android and the importer describe a document identically — which is the point
of ADR 0035, not a side effect of it.

Android reaches lib through pdf_metadata_from_file(path) rather than a
bytes-taking export: its viewer always has the document as a file, either the
picked file itself or the temp copy mupdf's Java binding requires, so
MuPdfDocument now carries that sourcePath and hands it over. Sending a
ByteArray across the FFI instead would make a large document resident twice.

page_count stays each viewer's own. read_metadata fills it from the page tree
for the importer's sake, but a viewer that has the document open through its
renderer overwrites it with that renderer's count: the number in the info
popup has to be a count of pages the user can actually navigate to, and two
parsers can repair a damaged page tree differently.

mupdf goes back to being what it should be on both platforms — a renderer.
PdfOutlineItem is still filled in per-viewer, correctly so: resolving an
outline entry's destination to a page number is the renderer's job, and only a
viewer ever asks for an outline.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016n5WWHbMmck6B6LM67Vi8a
2026-08-22 02:57:23 -07:00
Greg ShuflinandClaude Opus 5 b4631a3ba1 pdf: read a document's own metadata in lib, with hayro-syntax
PdfMetadata existed as a shape with nothing to fill it. Each viewer populated
it from its own mupdf binding — the Rust crate in gui-app, the fitz Java
binding on Android — so there were two independent answers to "what does this
document call itself", and the import path had none at all: PdfFfi::import and
import_pdf_file both run inside lib, as does the SUPPORTED_FILE_TYPES dispatch
that syn-cli and bulk directory import reach, and none of those has an mupdf
binding. So an imported PDF was titled `1706.03762v7`, never `Attention Is All
You Need`.

Reading /Title is a parse, not a render, so lib does it itself. hayro-syntax
implements the PDF reference's Syntax chapter in pure Rust — xref tables and
xref streams, broken-xref repair, objects inside object streams, stream
filters, decryption — and was already being compiled into this crate as a
transitive dependency of typst and krilla, so naming it directly costs no
additional build on any target, Android included. The alternative, the mupdf
crate, is a bundled C tree behind bindgen that would land in syn-daemon,
syn-cli, syn-tui and the Android cdylib to lift one string.

read_metadata is the single reader. Unparseable bytes are None rather than an
empty record: every caller has a fallback, and an empty record would instead
assert the document is untitled and zero pages long. write_pdf_properties now
takes the document's bytes and titles it via imported_title — the document's
own /Title when non-empty, pdf_title(file_name) otherwise — so no import path
can skip asking the document its name, and the two callers still cannot
disagree.

Text decoding is ours, because hayro resolves string escapes and decryption
but returns raw bytes: a PDF text string carries no encoding beyond an
optional BOM, and without one it is PDFDocEncoding, not UTF-8 and not Latin-1.
The distinction is load-bearing at 0x80..=0x9F, where PDFDocEncoding puts the
ellipsis, em/en dashes and curly quotes that real titles are full of and
Latin-1 has C1 controls. It is also not WinAnsi: the curly apostrophe is 0x90
here, where WinAnsi has 0x92 (trademark).

ADR 0035.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016n5WWHbMmck6B6LM67Vi8a
2026-08-22 02:57:23 -07:00
Greg Shuflin 2afb6fff51 docs: record the flex_1-plus-max_w layout trap in CLAUDE.md
The failure it produces is silent, contents-dependent, and looks like a
bug in the child rather than the container — worth stating next to the
other gpui sizing rules so it isn't rediscovered by instrumenting a text
element again.
2026-08-22 02:55:45 -07:00
Greg Shuflin d95bcddde1 gui: size the header search field definitely, not by growing into a clamp
The Notes search field showed a blinking caret and no text. Instrumenting
TextElement said why: its bounds were 2px wide — exactly CARET_WIDTH — so
the caret fitted in the content mask and all 148.73px of correctly
coloured Inter was clipped away.

The 2px is arithmetic, not a coincidence. header_search asked to grow into
the free width and stop at a maximum. With the free space wider than that
maximum, the frame's final width came from growing and then being clamped,
but its children had already been laid out against its max-content width:
2px of border + 24px of padding + a 24px magnifier + a 12px gap + the
input's own 24px of padding + a zero-width string = 86px, leaving the
input 86 - 84 = 2. The frame then drew at the 630px it had grown to, with
its contents still placed for 86. Documents escaped it only by leaving
less free space than the maximum, which is why one agent's field worked
and the other's didn't on identical markup.

So the field is a definite width now, which is never re-sized after its
children are placed. flex_shrink keeps the one part of growing that did
real work — giving way on a window too narrow to hold the field. Nothing
about the arrangement changes: the frame was already drawing at exactly
this width.
2026-08-22 02:55:45 -07:00
Greg Shuflin 7d9456f6bb gui: build the notes search field inline, not as a child entity
Notes was the one agent that wrapped its header search field in a Render
entity of its own; Documents and the PDF library lay the same frame out
directly in their own render. The entity bought nothing — the field has no
state beyond the input it holds — so NotesView now owns the TextInput and
renders the frame itself, with search_bar.rs becoming the impl NotesView
block that builds it, the same file split list_view.rs already uses.

Made while chasing the field's invisible text, on the theory that the
entity boundary was what set Notes apart. It wasn't: the cause was
header_search growing into a max-width clamp, fixed separately. This
stands on its own anyway — one fewer layer, and one layout shape across
all three agents.
2026-08-22 02:55:45 -07:00
Greg Shuflin 93117838bf android: search the notes tree, in the same shape Documents searches
NotebookSidebar has rendered a SynSearchBar bound to NotesScreen's
searchQuery since it was added, and the query was never applied to
anything — NoteTreeList got the whole tree regardless. It now narrows the
tree the way the documents list narrows its own: matches raised and their
typed run marked in the accent, the collections above them kept as
context, non-matching siblings hidden.

visibleNoteRows flattens the tree to rows before rendering, so filtered
and unfiltered listings are one list built two ways and the row itself
only has to know its emphasis. It reads isExpanded and never writes it, so
clearing the field hands back exactly the tree the user had open; a
filtered listing therefore shows no turnstile, since one would either lie
about the rows below it or change the state the filter is meant to leave
alone.

RowEmphasis and the highlighted-name builder move from documents/ui into
ui/, where both trees can have them — a filtered documents list and a
filtered notes tree should be recognisably the same act, and notes has no
business importing from the documents package to get it.

TODO.md's entry for the inert search box goes; in its place, a Notes note
to take cues from Obsidian and search note *bodies* with a preview of the
line each hit sits on. That is a different kind of result row from a tree
row and wants design work first, so it is recorded, not built.
2026-08-22 02:55:45 -07:00
Greg Shuflin b053e0899e gui: search the notes tree, in the same shape Documents searches
The Notes header has had a search field since ADR 0032 §5 put one there,
wired to nothing. It now filters the notebook tree the way the Documents
list filters its own: matches raised and their typed run marked in the
accent, the collections above them kept as context, non-matching siblings
hidden.

The filter lives in HierarchicalSidebar, so every tree gets it, and it is
a display filter and nothing else — it reads the collapse set and never
writes to it. A filtered listing therefore offers no twisty (one would
either lie about the rows below it or change the state the filter is
meant to leave alone), the keyboard's expand/collapse is inert while
filtering, and reveal() no longer opens ancestors of a row that is
already on screen. Clearing the field hands back exactly the tree the
user had open.

Also: the Notes and PDF search fields drew a second bordered, padded box
inside the header_search frame, which both doubled the chrome and ate the
width the field is there to give the text. Both now use TextInput::bare,
which is what it is for; the clear button Documents grew moves into
screen_header so all three fields clear the same way.
2026-08-22 02:55:45 -07:00
Greg Shuflin c9d0974874 android: give the reading surface its own content colour
Recolouring MaterialTheme's scheme was not enough to move the body text onto
a light page: a Text with no explicit colour reads LocalContentColor, not the
colour scheme, and the app's own Surface had set that to chrome ink several
levels up. Paper and White therefore rendered a light ground under text still
painted for Charcoal — legible only in the Dark surface, which happened to
agree with the chrome.

ReadingSurfaceView now provides LocalContentColor = page.ink alongside the
recoloured scheme, which is what a Surface would do for its own content
without also bringing an elevation overlay.
2026-08-22 02:51:44 -07:00
Greg Shuflin 2bcc12b5af gui, android: move the reading surface control into the Notes toolbar
The reading surface has exactly one visible effect in the app right now —
the Notes preview pane — so a row on the app-wide Settings screen asked the
user to change something two screens away from anywhere they could see it
land. It is now a dropdown beside the view-mode switcher in the note's own
toolbar, in both modalities, shown only while a preview is on screen.

The value itself doesn't move: still node-local Settings, still theme::Page
on the desktop. Only where it's offered changes.
2026-08-22 02:51:44 -07:00
Greg Shuflin dc9fc0fd51 Bound the comic reader's fetched-page cache; unlink the test daemon socket
ComicsView::fetched_pages was a plain HashMap cleared only when a different
comic opened, so within one comic it grew for the whole reading session — a
few hundred pages of a series read end to end is a large heap of image bytes
never looked at again. Streamed pages are deliberately not written to the
blob store (ADR 0010), so the cache has to exist; it just has to be bounded.

It is now FetchedPages: an LRU bounded by total bytes (128 MiB). A type
rather than two fields on the view because the byte total is only meaningful
in lockstep with the entries — every path that changes one must change the
other, which is worth making unstateable rather than remembering. Bytes
rather than a page count because page sizes differ by an order of magnitude
between a web comic and a 600 dpi scan. LRU rather than discarding whatever
is behind the reader because paging backward is ordinary, and recency says
that without the cache knowing where in the comic the reader is.

Separately: DaemonGuard SIGKILLs the daemon, so it never unlinked its own
socket, and every run of the cli-app integration tests left a .daemon.sock in
the tree. Gitignoring it is not enough — nix develop/nix build copy the
working directory as a path: input and refuse a socket outright, so one test
run broke every Nix recipe until someone deleted the file by hand. The guard
now removes it on drop.
2026-08-22 00:27:09 -07:00
Greg Shuflin c8de242da1 Give Android's comic reader the desktop's streaming path
Since ADR 0016 every blob-backed type is streamable, but Android's comic
reader loaded pages from the local blob store alone, so it gated
MediaItem.activatable on DocumentAvailability.LOCAL — exactly the
overloading the desktop's activatable doc comment warns against, which is
how the remote fallback got left permanently unreachable there.

FFI: ComicsFfi::get_page_bytes serves a page from the local blob store and,
only on BlobStoreError::NotFound, streams it from whichever reachable peer
holds it via agents::comics::fetch_comic_page_bytes_remote. Fetched bytes
are never written to the permanent blob store (ADR 0010).
ComicsFfi::pages_needing_prefetch exposes the lib's already-tested
read-ahead selector; comics::PREFETCH_AHEAD moves out of gui-app so both
modalities read ahead by the same depth.

Android: ComicRepository.loadPage returns Ready/NotHere/Undecodable instead
of a bare nullable, so a page no peer will serve renders the availability
treatment in place rather than a spinner that never ends;
ComicRepository.prefetchAhead drives the window off the reader's settled
page into an LRU-bounded cache (the desktop's equivalent map is unbounded,
which a phone reading a long series can't afford). activatable is now
unconditional at both call sites, and coverComicId no longer consults
availability — only the first page's blob decides whether there's a cover,
and a comic reads REMOTE the moment any one page is missing, so that check
withheld covers that were sitting right here.
2026-08-21 23:50:17 -07:00
Greg ShuflinandClaude Opus 5 caa0599b7c sync: ask peers what they hold before pulling one document
"Sync to this node" only ever fetched what the *local* catalogue already
flagged as missing, so a document whose value changed on another node since
the last scheduler pass reported itself as already up to date — the local
catalogue's opinion, presented as the ensemble's.

sync_document_assets_recursive now runs both planes in order: a scoped
catalogue exchange with every ensemble peer (refresh_document_catalogue),
then the existing depth-first content walk, which re-reads children after the
refresh so documents discovered in the first phase are included.

Scoping needs a new wire affordance. SyncRequest::document_scope is a flat id
allowlist, and a requester can only name documents it already knows about — a
note added to a folder on another node has no id it could put there. The new
SyncRequest::expand_subtree asks the responder to expand each scoped id over
*its own* tree instead. Both directions of the exchange carry the flag, so
each side expands against its own descendants and the folder converges. It
stays off for push_document_to_peer, where the sender is naming exactly what
it intends to hand over. #[serde(default)] keeps an older peer reading as
false, i.e. today's behavior; no SYNC_PROTOCOL_VERSION bump, since no wire
enum changed.

Both phases are best-effort per peer, which makes "how many answered" load-
bearing rather than diagnostic: "up to date" is a claim about the ensemble
only if someone answered. DocumentSyncResult and the daemon JSON now carry
catalogue_peers_available/catalogue_peers_refreshed, and all four surfaces
(gpui, Android, TUI, CLI) distinguish three outcomes that used to collapse
into "Already up to date on this node" — nobody to ask, nobody answered, and
checked-against-N-peers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpbZGtPGzbvLLQXCfVcqat
2026-08-21 22:46:21 -07:00
Greg Shuflin 80bc85d745 android: emit uniffi bindings as generated sources, not into the source root
uniffi's Kotlin bindings were written into
android/app/src/main/java/com/gregshuflin/synchronicity/uniffi/ — an untracked
build output living in a tracked source root. Everything around it was a
workaround for that: a .gitignore entry, and three separate tooling exclusions
(the ktfmt SourceTask filter, Detekt, DetektCreateBaselineTask) to keep
formatters and linters off a file none of them should touch. `gradlew clean`
also could not remove it, so a file generated from an older .so could survive
indefinitely.

Emit them under the module's build/ directory instead, handed to AGP through
the Variant API: a GenerateUniffiBindings task with a DirectoryProperty output,
wired per variant with variant.sources.kotlin.addGeneratedSourceDirectory. That
carries the task dependency with it, so preBuild no longer needs to list the
task. The Android SourceSet API was the obvious route but AGP 9 rejects a
Provider there outright, pointing at the Variant API precisely so Studio can
tell generated from static sources.

The justfile recipe now takes the output directory as a parameter; Gradle
passes the per-variant path AGP chose. The task is named
generate<Variant>UniffiBindings now, since addGeneratedSourceDirectory owns the
output location and so cannot share one task between variants.

Verified that ktfmtCheck and detektDebug no longer see the generated file at
all (0 matching source entries) with the exclusions deleted, that clean removes
it, and that a from-scratch assembleDebug regenerates it.

The one argument for the old arrangement — reading the Kotlin FFI surface on a
machine with no Android toolchain — was already moot: the directory was
gitignored, so a fresh clone never had it either.
2026-08-21 20:13:35 -07:00
Greg ShuflinandClaude Opus 5 aa91e3266a gui, android: lift the Charcoal ramp off the floor
The rail, the window and the media canvas all sat within 1.08:1 of each
other — three near-blacks that read as one surface failing to be itself
rather than as three surfaces. Darkening the rail can't fix it: the range
below the ground is spent. So the ground lifts and every surface moves up
one rung of the ramp that was already there, which keeps the spacing that
was already tuned.

The rail now sits 1.19:1 under the window, matching Slate's own step, and
the rail and media canvas share one floor value instead of differing by
1.01:1. `text_tertiary` is re-derived to hold the 4.28:1 its restriction
in ADR 0032 §8 is calibrated against; the dark reading surface drops to
`#0f1217` so a page still has an edge against the lifted chrome.

Closes the Charcoal hand-tuning item in TODO.md; ADR 0032 §3 carries the
re-measured ratios and a new amendment with the reasoning.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HkDnWfvQnYwbYaSbWrfAK5
2026-08-21 18:04:39 -07:00
Greg Shuflin ee58cf7ce2 docs: ADR 0034 for the filtered document tree
The session's main piece of work had no record outside commit messages: the
prior art it follows (Xcode / IntelliJ / Obsidian), why emphasis goes on the
match rather than dimming the context, the two ordering rules that keep a
keyset-paginated list from reordering itself as pages arrive, and what a twisty
is allowed to promise in a filtered view.

Records the backwards first attempt deliberately. Withdrawing the context
without raising the match reads acceptably on the dark ground and too thin on
the light one, because mid-greys on a light ground sit perceptually closer to
black than their contrast ratios suggest -- worth knowing before someone tunes
this by eye on Charcoal alone.

Expansion-not-persisted lands here as a Consequences bullet, which is where it
belongs: it is a property of this design, not a decision in its own right. The
reasoning is also on reload() itself, at the line someone would otherwise
'fix'.
2026-08-21 17:48:27 -07:00
Greg Shuflin f6e421696b gui, android: raise the match instead of only withdrawing the context
The reasoning said 'emphasise the match, don't dim the context', and the code
did the opposite: every row used to be text_primary at MEDIUM, and the change
left matches exactly there while dropping context rows to text_secondary at
NORMAL. Only the substring highlight actually sat above the baseline. The
result reads on Charcoal and is too close together on Slate, which is what a
one-sided treatment would predict.

Row emphasis is now three-way rather than a bool, which is also what an
unfiltered listing needs: it has no matches and no context, and must keep the
appearance it had before filtering drew any distinction. A filtered listing
raises its matches to SEMIBOLD as well as withdrawing context to NORMAL, so the
separation is two channels wide from both directions rather than one.

Bolting the raise onto the old bool would have made every row of an unfiltered
list semibold, since is_match was unconditionally true there -- the enum is
what makes that impossible to get wrong rather than merely currently right.

text_secondary stays where it was: 6.31:1 on Charcoal and 5.71:1 on Slate, so
there is no headroom below to spend, and a context row's name is what the
reader needs in order to place the match.
2026-08-21 17:28:49 -07:00
Greg Shuflin de47bb67f0 docs: file Android's dead notes search box, and unstale two ADRs
Found while sweeping for untracked work at the end of the session.

NotebookSidebar renders a SynSearchBar bound to NotesScreen's searchQuery, and
nothing ever applies it -- NoteTreeList gets the whole tree regardless. Filed
rather than fixed, because 'delete the box' is a real candidate: a notes tree
may be small enough that scrolling is genuinely fine, and a control that does
nothing is worse than no control.

ADR 0030's consequences told a future reader to reuse media_library's
marker_glyph() / Icon::Cloud vocabulary, which ADR 0033 deleted -- so the
instruction now points somewhere that doesn't exist. Amended in place rather
than rewritten: the instruction stands, only the destination changed.

ADR 0016 claimed Android has no availability indicator and that ComicNode
flattens the enum; both are false now, and the TODO entry it deferred to
('Design a general media reader UI') no longer exists. Amended to say which
half is done and where the remaining half -- the streaming adapters -- is
tracked.
2026-08-21 17:06:36 -07:00
Greg Shuflin 6f2b63e9a2 android: draw a filtered document list as a tree, matching the desktop
Ports the change the GUI just got. The screen flattened the hierarchy whenever
a filter was active -- so it answered 'what matched' but never 'where does this
live' -- and drew a turnstile on every row with children regardless.

filteredDocumentTree is the Kotlin half of visible_filtered_rows, with the same
two ordering rules: a subtree sorts by the earliest match inside it, and matches
keep page order within a parent, so a later page only adds rows beneath
ancestors already positioned rather than reordering what is on screen. Its
tests mirror the Rust ones case for case, so the two can't drift.

Matches are emphasised rather than context withdrawn -- onSurface at medium
weight against onSurfaceVariant at normal, with the searched substring
highlighted in the primary colour. ADR 0032 section 8 forces that direction
here: a context row's name is what the reader needs in order to place the
match, so it is not decorative text and may not be dimmed below AA.

The turnstile now appears only on a match, where expanding shows what is inside
it, rendered as context.

Verified with just gradlew assembleDebug, just gradlew test (6 new tests), and
just lint-kotlin.
2026-08-21 16:57:46 -07:00
Greg Shuflin 0c6f9ef0d6 ffi: carry a filtered page's ancestor context to Android
DocumentPage gains a context field, populated from ancestors_of when the params
are filtered -- the same shape the desktop's DocPage took. Ancestors are read
in the same transaction as the matches they explain, so a consumer can't render
a page whose context is one write out of date with it.

Empty when unfiltered, and ordinary DocumentItems either way: a consumer that
ignores the field gets exactly the flat page it got before this existed.
2026-08-21 16:57:37 -07:00
Greg Shuflin 1d37ec6344 TODO: file the two document-search performance options we didn't take
Closes the filtered-twisty entry, which is now implemented, and records what
was deliberately deferred while doing it:

- FTS5 with a trigram tokenizer, which is the actual perf win available. The
  title filter is a leading-wildcard LIKE over a json_extract, so it is
  unindexable and already scans the join; the tree work added here is a handful
  of primary-key lookups next to it.
- A materialized path column, which would give exact depth-first order straight
  from SQL and make a filtered page a contiguous slice of the tree -- at the
  cost of a migration and a reparenting invariant to maintain forever.

Neither is worth doing unprofiled; filed so the options are on record rather
than rediscovered.
2026-08-21 15:51:55 -07:00
Greg Shuflin 6849ea38cf gui: draw a filtered document list as a tree, with its matches emphasised
A filtered listing rendered flat, so it answered 'what matched' but never
'where does this live' -- and it still drew an expand twisty on every row with
children, wired to a toggle the flat view never read. The chevron was present,
clickable, and inert.

Now it is the shape Xcode's navigator filter, IntelliJ's speed search and
Obsidian's explorer search settle on: matches in place, their ancestor chains
drawn around them as context, non-matching siblings hidden.

Emphasis goes on the match rather than dimming the context, with the searched
substring highlighted in the accent inside a matching title. That is what the
prior art does, and here ADR 0032 section 8 requires it: a context row's name
is what the reader needs in order to place the match, so it is not decorative
text and may not be written below AA.

Two ordering rules keep the list stable as pages stream in -- a subtree sorts
by the earliest match inside it, and matches keep page order within a parent --
so a later page only adds rows beneath ancestors that are already positioned,
never reorders what is on screen.

The twisty now appears only on a match, where expanding shows what is inside it
(the one place a filtered view deliberately shows rows the filter didn't
select, rendered as context). A context row has its matching descendants
beneath it already and offers nothing to expand.

Tests cover the ordering rules, a match that is also an ancestor of another
match, and a match whose parent didn't come back with the page -- the assembly
has to stay total rather than dropping rows it can't place.
2026-08-21 15:51:48 -07:00
Greg Shuflin af2809d03e lib: one recursive CTE for a document's ancestor chain
A filtered list selects documents wherever they live, and a bare list of them
says nothing about which notebook or series each came out of. ancestors_of is
what lets a filtered view draw the chain around its matches -- the Xcode /
IntelliJ / Obsidian pattern for filtering a tree.

One CTE rather than a query per level: the recursion steps id -> parent_id by
primary key and UNION folds shared ancestors together, so a notebook holding
forty matching notes contributes its two ancestors once rather than eighty
times. It also drops ids that were asked about, since a match that is itself an
ancestor of another match is already on screen as a match and must not be
repeated as context.

Ordering is deliberately not the store's business: context rows only mean
anything in the position their descendants put them in.
2026-08-21 15:40:52 -07:00
Greg Shuflin dfce9a1dfc lib: define the availability vocabulary once, on the enum
The user-facing words were written twice -- once in the desktop's
components::availability, once in Android's ui/Availability.kt -- with nothing
tying them together but a comment. A state that goes by two names is two states
as far as the reader is concerned, and ADR 0033 says the words are the part
that has to match across surfaces, so they now live on
DocumentAvailability::label beside the variants they describe.

The desktop's label() delegates to it. Android reads it across the FFI via a
new availability_label free function, resolved once per variant into a map
rather than per row. The daemon's JSON spelling moves to wire_name on the same
enum -- kept separate from label rather than derived from it, since one is
prose that can be reworded on taste and the other is a wire value a rewording
must not silently change.

Also unifies the sidebar tooltip on 'No source': it had briefly said 'Not
present', which was the divergence this commit exists to make impossible.

Verified with cargo test --workspace, just gradlew assembleDebug, and
just lint-kotlin.
2026-08-21 15:32:51 -07:00
Greg Shuflin fa7d4e40c4 gui: make the sidebar tooltip a coloured dot and one word
The tooltip carried a full sentence ('Remote -- on another node, not synced
here yet'). A tooltip is a glance, so it now shows the row's name and, under
it, a presence dot in the state's colour plus the single word.

This is the one place the treatment spends a dot, and it can afford one exactly
because the word is beside it: a mark that has to be learned is fine next to
its own gloss and unreadable alone, which is why no row anywhere carries a bare
one.

The tooltip says 'Not present' where a card says 'No source'. A card's word
sits beside a subtitle with no other context, so it reports what the ensemble
knows; a tooltip is attached to the row being pointed at, so it can say the
plainer first-person thing without being read as a claim about anywhere else.

tooltip.rs's second line is a (word, colour) pair rather than an element,
because TextTooltip is a Render view and an element can't be stored across
renders -- so it draws the dot itself and stays ignorant of availability.
2026-08-21 15:17:33 -07:00
Greg Shuflin 8cc5364979 TODO: the documents expand twisty is live but inert while filtering
A filtered result set renders flat on purpose -- document_table maps every row
to indent 0 and ignores self.expanded, because a filter can match a child whose
parent was excluded. But table_row still draws the twisty for any row with
children and still wires it to toggle_expanded, so while filtering the chevron
is present, clickable, and does nothing the flat view ever reads.

Suppressing it is two lines and probably wrong alone -- it would leave no way
to see that a matched document has children. Filed with the three answers and
what each would need rather than patched.
2026-08-21 15:17:25 -07:00
Greg Shuflin 72ea48b1df gui: size the documents Size column for its own values, and rename Here to Presence
A container's row shows a subtree sum with a '(total)' suffix, which at 72px
was wider than the column. The old comment reasoned that overflow would extend
harmlessly into the next column's leading space; it did not -- it painted over
the presence indicator. Size is now wide enough for '1023.9 KB (total)', shared
with the presence view's grid so the two document tables still line up, and
every cell truncates rather than overhanging so a value nobody anticipated
clips with an ellipsis instead of colliding.

'Here' becomes 'Presence'. The column reports one of four states (Here,
Arriving, Not here, Unknown), only one of which is 'here', so the old header
named a value rather than the question.
2026-08-21 15:17:20 -07:00
Greg Shuflin 44bcbcd61d docs: record the availability-marking decision as ADR 0033
Also replaces the closed TODO entry with the three that fall out of it: the
TUI's port (it shows availability nowhere today), Android's non-MediaLibrary
screens, and Android's missing streaming path -- which is why its comic library
gates tappability on LOCAL, the one thing the desktop's MediaItem::activatable
doc comment insists must stay independent of availability.
2026-08-21 14:51:13 -07:00
Greg Shuflin 267956d9fd android: port the availability treatment off the cloud badge
Same three treatments as the desktop, for the same reasons -- rule and word on
a card, word in a list row's trailing column, sentences in the notes pane -- so
the condition reads the same on both modalities.

Two Android-specific notes. The dashed rule is drawn with a PathEffect rather
than a border, because Compose's border has no dash. And the sourceless state
moves from colorScheme.error to the palette's colorWarning: 'no node has said
it holds this' is not a fault, and painting it red contradicted ADR 0032 §4 and
CLAUDE.md's own 'absence is not an error' -- the desktop already used warning
here, so this was also a divergence between the two.

Verified with 'just gradlew assembleDebug', 'just lint-kotlin' (detekt with
type resolution), and 'just gradlew test'.
2026-08-21 14:49:38 -07:00
Greg Shuflin 7bf75a1db3 gui: retire the cloud badge for a rule, a word, and a tooltip
Three surfaces, three treatments, chosen by how much room each has instead of
forcing one mark everywhere:

- Grid card: a status rule in the gap the card already left between cover and
  title, plus the state word in the subtitle row it already renders. Both cost
  zero height and neither touches the artwork -- which the corner badge did, on
  the one part of a card the view exists to show. The rule reads while scanning
  a grid; the word reads once a card has caught the eye, so the pair never
  rests on colour alone.
- List row: the word in the trailing column that was already empty. The
  thumbnail goes back to being a thumbnail.
- Sidebar: nothing at all in the row, which is a 260px rail whose whole purpose
  is the label. It says it in the hover tooltip instead, which gains a second
  line for the purpose.

The words are 'Remote' and 'No source'. Not 'Unavailable': availability.rs
calls that state advisory and never a reason to refuse a fetch, so the honest
claim is that nothing has *claimed* it, not that the content is gone.

Solid rule for Remote, dashed for No source -- a broken outline for the state
whose outline we are not sure of. It rides on the rule and not on a dot because
gpui ties dash length to border width (2x dash, 1x gap), so a dashed ring at
badge size comes out as texture rather than as gaps; at 168px it is
unmistakable.

The two incoming-change banners (notes, podcast queue) stop borrowing the
availability glyph. 'A version arrived from another node' is a different fact
from where a document's bytes live, and they only ever shared a glyph because
both were once a cloud; they get arrow-down-up. Cloud/CloudOff are gone from
the vendor list and the assets.
2026-08-21 14:40:49 -07:00
Greg Shuflin 3de5742336 lib: carry availability as the enum onto note and picture tree items
PictureTreeItem computed document_availability_bulk and then threw it away into
an is_local bool, so Remote and Unavailable were already indistinguishable
before the GUI saw them. NoteTreeNode::Note carried no availability at all,
which is why the notes sidebar hard-coded is_local: true for every note and has
never marked one -- in the agent that has a whole dedicated pane for a body
this node holds only a stub for.

Notes ask the *body* question (artifact_availability over NoteBody), not the
document one: a note also has a NoteFormat artifact, and a note whose format
stub hasn't arrived is perfectly editable. Rolling the two up would report a
locked body for a note whose body is right here.

artifact_availability_in_tx is new so the tree can ask that per row inside the
transaction it already holds, rather than opening a connection per note -- every
store in a Store is on the same database file, so one transaction serves all of
them (which is what document_availability_bulk already relies on).

The enum reaches the FFI (NoteTreeEntry) and the daemon's JSON too, so Android
and the CLI get the three states rather than inheriting a flattened two.
2026-08-21 14:40:37 -07:00
Greg Shuflin a72f04a289 lib: decide export from the availability enum, not a boolean shorthand
document_is_local() collapsed the three availability states to a bool at the
point where the answer was computed, so every caller downstream had already
lost the distinction. Export is the one caller that genuinely needs a yes/no --
it writes bytes out of the local store, and no amount of streaming helps -- but
it can derive that from the enum at the point of use, where the collapse is
visible and documented.

That the wording of the skip report can now say which kind of missing it is:
a blob some node is holding will arrive if the user waits, one nothing has
claimed will not. The old report said 'hasn't synced to this node yet' for
both.
2026-08-21 14:23:20 -07:00
Greg Shuflin 2843b7343b design: rebuild the availability specimen around outside-the-frame marks
Judges the three contexts separately instead of forcing one mark into all of
them: a grid card has no spare pixel that is not artwork, a list row has an
empty trailing column, and a 260px sidebar rail has room for 8px and nothing
else.

Also records two things the first pass got wrong. The cover's frame cannot
carry availability -- media_library.rs already repaints that border with the
accent for hover and for the keyboard cursor, so a card under the cursor would
show no state at all. And gpui-ce does have .border_dashed(), so a broken
outline is drawable rather than needing a hand-drawn element.
2026-08-21 13:48:57 -07:00
Greg Shuflin d3daf8fee1 design: a specimen for the DocumentAvailability marker
Renders every candidate treatment at the app's real badge sizes (12/18/22px),
on the real theme.rs palette, with the real dimming, in the three places the
marker appears with no words beside it -- a grid card corner, a list row
corner, and a sidebar row.

Both icon sets are read from the upstream packages the app actually builds
against, so a name that does not exist raises at generation time. That caught
two of the three candidate pairs the TODO entry had recorded from memory:
Lucide has no 'link-off' (it is link-2/link-2-off) and no 'devices' at all.

Backs the pending decision in TODO.md; the outcome belongs in an ADR.
2026-08-21 13:33:51 -07:00
Greg ShuflinandClaude Opus 5 670f7c10ad comics: carry availability across the FFI whole, and mark it on Android
`ComicNode` was the last hand-written twin, and the only one that lost
information: its `is_local: bool` flattened `DocumentAvailability`'s three states
into two, so Android could not tell a chapter that will download from one with
nowhere to download from. Its own doc comment asked for this — "widen it to
carry the full enum when that UI exists" — and `MusicNode`, which the same
comment named as its sibling, already carried the enum whole.

`comics::ComicTreeItem` derives `uniffi::Record` where it is defined, so the
record and `comic_node_from_tree_item` go and `ComicsFfi::list` returns the
domain type. That empties the last of `ffi/types.rs`'s reasons to import
`comics` or `DocumentAvailability` at all.

Android's `MediaItem` carries `availability` in place of `isLocal`, and the
media library renders it the way the desktop already does: dim to 0.7 and a
`Cloud` glyph for Remote, 0.5 and `CloudOff` in the error colour for
Unavailable. Both axes are needed because dimming alone reads as a matter of
degree, while the distinction is categorical — the same reasoning
`marker_glyph` gives, and the same glyph/tint pair `NoteEditorPane` already
uses for a note body held only as a stub.

Two things fall out of that beyond comics. Android was dimming every non-local
item to 0.5, the desktop's Unavailable level, so Remote content now reads
correctly as merely not-downloaded. And `MusicRepository` was receiving the
full enum and immediately flattening it to a bool; it passes it through now, so
music gets the three states for free and the flattening is gone rather than
moved from Rust into Kotlin.

TODO gains a note to reconsider the cloud metaphor across all seven sites that
use it — a cloud is the centralized service this project is not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjieJeUJBq3CtcmQuPvzVD
2026-08-21 13:17:49 -07:00
Greg ShuflinandClaude Opus 5 d10e0a332b ffi: derive uniffi on four domain types instead of mirroring them
`MusicNode`, `MusicLibraryEntry`, `AttendeeItem` and the FFI's own
`DocumentCursor` were hand-written twins of types the crate already had, and
every field of each already crossed the boundary — the ids and timestamps
through their `custom_type!`, `DocumentAvailability` and `LibraryEntryKind`
whole. So the twins bought nothing but a projection function to keep in step.

`MusicTreeItem`, `LibraryEntry`, `Attendee` and the store's `DocumentCursor`
derive `uniffi::Record` where they are defined instead, and the four records,
three projection functions and the `DocumentCursor as StoreCursor` alias (which
existed only to disambiguate from the mirror) go. `search_page` loses both of
its cursor-mapping closures and `interaction_to_item`'s attendee block becomes
`attendees: summary.attendees`.

The consumer contract the mirrors' doc comments carried moves onto the domain
types rather than being lost: how to group a flat tree by `parent_id`, and
which of the two music tabs each type serves.

Kotlin sees three renames — `MusicNode` -> `MusicTreeItem`,
`MusicLibraryEntry` -> `LibraryEntry` — across MusicAgent, MusicRepository and
MusicScreen. `AttendeeItem` had no hand-written callers and `DocumentCursor`
keeps its name. No field name or Kotlin field type changes: a `DocumentID`
lands as the `DocumentId` typealias, which is still `kotlin.String`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjieJeUJBq3CtcmQuPvzVD
2026-08-21 13:17:49 -07:00
Greg ShuflinandClaude Opus 5 eb0a25dcc7 ffi: split the 5,618-line ffi.rs into one module per exported object
A pure move. Boundaries follow the file's own `// ── ... ──` section banners,
so each module is a contiguous range of the old file and the diff reads as
'these ranges moved'. Two blocks join what they belong with: the trailing
`impl SyncNode` (constructor and the sub-facade accessors) moves up beside the
`SyncNode` struct in node.rs, and `jobs_to_items` beside `JobsFfi` in jobs.rs.

Everything is re-exported from ffi/mod.rs, so `crate::ffi::Foo` resolves the
way it did when this was one file. The split forces three mechanical changes
and nothing else: 17 helpers plus `SyncNodeCore`'s fields and methods and the
`core` field on each `*Ffi` object become `pub(super)`; rustfmt rewraps the
three signatures that `pub(super) ` pushed past 100 columns.

Regenerating the Kotlin bindings changes no API — the generated file differs
only in declaration order and in the uniffi checksum constants, which hash
`FnMetadata::module_path` and so necessarily move when an item changes module.
`generateUniffiBindings` regenerates them alongside the .so, but a stale
untracked synchronicity.kt will now fail its checksum check at launch until it
is regenerated.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjieJeUJBq3CtcmQuPvzVD
2026-08-21 13:17:49 -07:00
Greg Shuflin 965b7da8be TODO: emit the generated uniffi bindings into a build dir, not the source root
The bindings are already gitignored, so nothing generated is version-
controlled. What's left is that uniffi writes synchronicity.kt into a
tracked source root, which is what the three lint exclusions, the
justfile's --no-format, and the file's survival across gradlew clean are
all working around.
2026-08-21 13:17:49 -07:00
Greg Shuflin f36bd1dc57 Some browser extension tweaks 2026-08-21 03:47:25 -07:00
Greg Shuflin f19bb101b1 browser-extension: trim the README to building and running from source
97 lines to 45. The layout table, the discovery walkthrough, and the
what-it-can't-do-yet section were restating ADR 0017, which is the canonical
record for all three — the README now points there instead.

Kept what a reader building or running it from source actually needs: that
there is no build step (syn-daemon's tests/browser_extension.rs cites this
file for that), the zip recipe and its one binary dependency, where the
recipes live, load-unpacked for both browsers, and why Firefox asks for
loopback permission before the popup can answer.
2026-08-21 03:47:25 -07:00
Greg Shuflin 2e4d133d35 justfile: move the extension recipes into browser-extension/justfile
The three extension recipes only ever touched browser-extension/, so they now
live there as a just module: `mod extension 'browser-extension/justfile'` in
the root justfile, reached as `just extension build`/`check`/`dev-path`, or
as bare `just build`/`check`/`dev-path` from inside browser-extension/.

just runs a module's recipes with the working directory set to the module's
own directory, so the recipes drop the repeated `browser-extension/` prefix
and refer to `src/` and `dist/` directly; `../rust` reaches the workspace for
the check recipe's cargo invocation.

The names lose their now-redundant `-extension` suffix, so every reference to
them moves with them: flake.nix, AGENTS.md, the extension README, discovery.js,
and syn-daemon's lib.rs and browser_extension.rs comments.
2026-08-21 03:47:25 -07:00
Greg Shuflin 2a4e22c3a9 browser-extension: replace python3 tooling with zip + a Rust test
The justfile justified its python3 use by claiming python3 was already a hard
requirement of this repo's scripts. It wasn't: the only python in the tree was
scripts/check-extension.py, added in the same commit as that comment. Nothing
else on a build path needs an interpreter, and flake.nix never supplied one —
inside `nix develop`, python3 resolved to the host's /usr/bin/python3, so the
check was quietly non-hermetic.

Packaging now uses `zip`, fed sorted entries from `find` and run from inside
src/ so manifest.json lands at the archive root. flake.nix supplies zip and the
recipe names it if it's missing.

The manifest and port-range checks become tests/browser_extension.rs in
syn-daemon, which owns HTTP_PORT_RANGE_START/_LEN. They run on every
`just unit-tests-rust` instead of only when someone remembers
`just check-extension`; that recipe keeps the optional deno lint.

Verified the drift check fires: pointing discovery.js at 40200 fails
port_range_agrees_with_the_daemon with the ports-never-bound message.
2026-08-21 03:47:25 -07:00
Greg Shuflin bd44cbc63b browser-extension: hello-world companion that reports node connectivity
A new top-level directory holding the MV3 extension from ADR 0017. It
does one thing: probe the loopback port range for a node on this machine
and say whether it found one, listing name, identity, port and version
for each that answered.

No build chain, deliberately. Everything under src/ is what the browser
loads — plain ES modules, plain CSS, one HTML file, no bundler and no
node_modules — so what you debug in the browser is what ships, and
`build-extension` is a zip and nothing else. Current browsers run all of
this natively; a toolchain would buy nothing.

Popup-only, with no background service worker: the only question asked is
asked while the popup is open, so a worker would add a suspension
lifecycle to reason about for no gain. That changes when pairing needs a
connection outliving the popup.

Firefox treats MV3 host_permissions as opt-in where Chrome grants them at
install, so the popup checks the grant explicitly — otherwise a missing
permission is reported as "not connected" and sends the user off to debug
a daemon that is running fine.

`check-extension` covers what breaks silently without a compiler: a
manifest that stopped parsing, and the port range drifting from the
daemon's copy, which would leave the extension probing ports nothing
binds — indistinguishable from no node running. It also runs `deno lint`
for syntax where deno happens to be installed, and skips it otherwise
rather than making the extension depend on a toolchain.
2026-08-21 03:46:40 -07:00
Greg Shuflin 443c69843d daemon: serve /version on a loopback TCP listener for browser extensions
The browser modality of ADR 0017 attaches to a locally-running node, but
`server.rs` only ever bound a Unix socket — which an extension sandbox
cannot open. Bind a loopback TCP listener alongside it (never instead of
it) so a browser has something to reach.

Discovery is a port probe, because an extension has no filesystem to read
a chosen port out of: the daemon takes the first free port in a 64-port
range from a random offset, and the extension scans the range. The range
is not a secret and carries no security weight — it is collision-
avoidance against other local software, and a bound on how long a probe
takes. `/version` gains node_pubkey/node_name so a probe can tell which
node answered rather than trusting whichever port replied first.

The loopback listener serves /version and nothing else. The Unix socket
is bounded by file permissions; a loopback port is reachable by any local
process and by any web page's JavaScript. Exposing /command there needs
ADR 0017's bearer-token pairing to guard it, which doesn't exist yet.

Failing to bind is logged, never fatal — CLI, TUI, GUI and sync need none
of this, and shouldn't lose a daemon over a secondary feature.
2026-08-21 03:46:40 -07:00
Greg Shuflin b6f4e4f57e TODO: relocate the Android-jobs-parity gap to the Jobs section
Delete the now-done presence.rs "Also" note (fixed by the previous
commit) from the ADR 0032 Android entry. Move the Jobs-screen-parity
note there too, out to "Keeping track of long-running jobs" — it
turned out to be the desktop's widgets-reflect-job-state-in-place
pattern (document detail Sync/Push, Ensemble per-peer Sync, import
triggers subscribing to live job progress), not a JobsScreen.kt polish
item, so it belongs with the rest of the Jobs work rather than riding
along with an unrelated visual-harmonization entry. Noted to sequence
after the desktop Jobs screen's current bugs are fixed.
2026-08-21 02:22:19 -07:00
Greg Shuflin 3d5998bf75 ensemble/presence: share the document-coverage projection
Both build_ensemble_status and the desktop Presence view computed
documents_held/total_documents themselves, via the same two store
calls (count_present_by_node, count_documents) — the exact duplication
the ADR 0032 Android TODO flagged once the Ensemble half moved
Rust-side.

ensemble/screen.rs now exposes document_coverage(&Store) ->
Result<DocumentCoverage, ...>, computing both once. build_ensemble_status
calls it and keeps its existing degrade-to-zero-on-error behavior
(coverage is a detail on a membership screen). presence::load calls it
too, propagating a failure instead (coverage *is* the Presence screen's
subject), and threads the resulting held map into load_nodes as a
parameter rather than that function querying it again itself.
2026-08-21 02:15:57 -07:00
Greg Shuflin 1f5b4e0b2f TODO: collapse the ADR 0032 Android entry to what's left
Gaps #1, #2, #3's two publishers, and #5 are done; delete the finished
detail bullets rather than striking them through, matching how the
Music-library TODO entries were closed out. Presence tab (#4) stays,
deliberately deferred pending an affordance decision. Keep the two
Also notes riding along with it, plus a new one surfaced while wiring
gap #3: Android has no incoming-body sync-conflict UI at all, which is
why that gap's Notes publisher went unwired.
2026-08-21 02:07:48 -07:00
Greg Shuflin 0d2d12ecee android: selection icon tint takes onPrimaryContainer, not primary (ADR 0032 gap #5)
NoteTabSidebar, NotebookSidebar, and PicturesScreen's selection sites
already got the saturated primaryContainer block and onPrimaryContainer
text — the TODO's original worry — but each row's icon still tinted
with plain primary (accent) when selected, a mismatch against the
adjacent text and against the block it sits on. The desktop's own
selection.rs settles this: row_text resolves both the label *and* the
glyph colour to text_on_accent on a selected block, never the accent
stroke colour, which is documented as never a surface that carries
text/an icon (ADR 0032 §5). All three now match.
2026-08-21 02:07:03 -07:00
Greg Shuflin 2d8e8447e6 android: SubAppScreen compactTitle for item-specific headers
This is the actual fix for the title-size complaint — the previous
commit (MediaLibrary's compactTitles) only touched the PDF *library*
list, not the header shown once a document is open, which is a
different component entirely.

SubAppScreen's header title is headlineMedium (28sp) everywhere,
whether the title is an agent/category name ("PDFs", "Notes") or the
arbitrary-length name of a specific thing the user opened (a document,
episode, comic, person, node). The former is a masthead and reads
right at that size; the latter is a file/item name among many and
reads as shouting, especially once it's long enough to need the
existing one-line ellipsis.

compactTitle: Boolean = false renders at titleLarge (22sp) instead —
Material 3's own standard app-bar title size, not an arbitrary pick.
Default keeps every category-name screen unchanged. Opted in by every
screen whose title names a specific item: PdfViewerScreen, PicturesScreen
(the open picture), ComicReaderScreen, EpisodePlayerScreen,
PodcastInfoScreen, DocumentDetailScreen, HumanDetailScreen, and
EnsembleScreen's node-detail view.

A stopgap ahead of an Android-specific design pass, same as
compactTitles — noted in both parameter docs.
2026-08-21 01:48:22 -07:00
Greg Shuflin 8ab70e18dc android: MediaLibrary compactTitles toggle for non-gallery lists
MediaLibrary's title sizes (bodyLarge row / bodyMedium card) match
IconButton's home-row agent-name size, which reads right for cover-art
galleries (Comics, Music, Video) but is too loud for a title that names
one file among many in a plainer list — a PDF, or a future document
detail screen. compactTitles: Boolean = false (default preserves every
existing consumer) drops row titles to bodyMedium/labelSmall and card
titles to bodySmall, matching DocumentList's existing pairing.

PdfLibraryScreen opts in. A stopgap ahead of an Android-specific design
pass, not a considered two-tier type scale — noted in the parameter doc.
2026-08-21 01:14:56 -07:00
Greg Shuflin 74a9764778 TODO: mark ADR 0032 Android gaps #1-#3 done
bgMediaCanvas, the reading-surface story, and the live-state slot's two
wired publishers. #4 (Presence tab) and #5 (selection text colours)
remain, plus the newly-surfaced prerequisite: Notes has no incoming-
body-conflict UI on Android yet, so gap #3's third publisher has
nothing to hook into until that exists.
2026-08-21 00:46:21 -07:00
Greg Shuflin 165ecfdf7b android: live-state slot on home rows (ADR 0032 gap #3)
Kotlin counterpart of nav_status.rs/agent_sidebar.rs's right-hand rail
slot, scoped to the two publishers Android already has state for:

- ui/NavStatus.kt: NavSlot/SlotKind plus NavStatus, a process-wide
  SnapshotStateMap<AgentId, NavSlot> — the Compose-idiomatic answer to
  gpui's shared Entity<NavStatus>: any composable that reads
  NavStatus.get(id) during composition recomposes when another screen
  calls set(), with no shared ViewModel scope required. NavSlotView
  renders it (dot + mono text, coloured by kind), mirroring nav_slot.
- ui/IconButton.kt: optional trailing slot, rendered flush right.
- podcast/AudioPlayerManager.kt: PlaybackState gains a `source` tag
  (MUSIC/PODCAST) set by loadUri/loadEpisode respectively, so a reader
  outside Music/Podcasts can tell which agent's row the shared transport
  belongs to — desktop's MediaPlaybackState already carries this; Android's
  PlaybackState didn't need to until something outside Music/Podcasts
  wanted to read it.
- MainActivity.kt's MainScreen: computes a playback slot per row from the
  shared player (Playing/Paused, live-reactive via collectAsState, taking
  priority over a published slot — mirrors playback_slot's precedence)
  and refreshes a Jobs "N running" slot each time the home screen is
  entered — Android's home screen isn't a persistent rail like the
  desktop's, so this is "read on entry" rather than a continuous
  subscription, the same adaptation NotesScreen already makes for
  proseFont/readingSurface.

Not wired: Notes' incoming-body-conflict slot. Android has no incoming-
body sync-conflict UI yet at all (the alert-don't-apply invariant this
would surface), so there is nothing to publish from — a prerequisite of
its own, not part of this gap.
2026-08-21 00:46:21 -07:00
Greg Shuflin 004e14d235 android: reading-surface story (ADR 0032 gap #2)
Gives Android its own Page/on_page counterpart to the desktop's, so the
notes preview can render on paper/white/dark independent of the app's
chrome theme:

- FFI: SettingsFfi::get_reading_surface/set_reading_surface, mirroring
  get_prose_font/set_prose_font.
- SettingsAgent: Kotlin wrapper for the new FFI pair.
- ui/theme/Page.kt: Page (ground/ink/inkAccent/rule/inkMuted/panel) with
  the same three resolved palettes as theme.rs's Page::resolve, plus
  ReadingSurfaceView — the Compose counterpart of on_page, recolouring
  MaterialTheme's slots for a subtree rather than threading a second
  value through every renderer.
- Settings screen: a "Reading Surface" segmented control next to Theme,
  matching the desktop's placement in the System tab (ADR 0032 §5).
- NotesScreen/NoteEditorPane: reading_surface loaded the same way
  proseFont already is (read once on entry, set from the shared Settings
  screen) and threaded down to PreviewBody/SplitBody, which wrap the
  Markdown and plain-text preview in ReadingSurfaceView. Typst notes stay
  on bgMediaCanvas (gap #1) rather than a page, matching
  render_typst_preview staying off cx.page() on the desktop.
2026-08-21 00:46:21 -07:00
Greg Shuflin 643f9fbadc android: wire bgMediaCanvas into the media viewers (ADR 0032 gap #1)
PicturesScreen, ComicReaderScreen, and the shared ZoomableBitmap (used by
both PdfViewer and the Typst preview) now paint their canvas on
SynPalette.bgMediaCanvas instead of the chrome surface, matching the
desktop's pictures.rs/comics.rs/pdf_viewer.rs/zoomable_image.rs — the
canvas frames the media rather than just having it sit on the page.
VideoScreen has no viewer yet (import/browse only), so nothing to wire
there until playback exists.
2026-08-21 00:46:21 -07:00
Greg Shuflin c77be7f562 ensemble/settings: exclude this node from the roster, single-colour coverage meter, flexible hash chip truncation
- Ensemble screen (gpui + Android): the roster is specifically the *other*
  nodes to ping/sync with — this node already appears in Membership's
  "This node" fact, so it no longer gets a second row in the list below.
  Counts are now phrased as total vs. other so it's unambiguous which set
  is being sized.
- Coverage meter: one fill colour instead of a red/amber/green judgment
  layered on top of a bar whose width already carries the value.
- HashChip (gpui + Android): gained truncate_at(chars)/no_truncate/color,
  so a chip can say more than 8 chars (the ensemble key), show the whole
  value (a link meant to be read or compared), or take on an accent
  colour, instead of every chip being identical. rust/lib/src/help.rs's
  truncate_id is now the shared primitive short_id calls.
- Settings: node pubkey and commit hash now render through HashChip
  instead of a bespoke mono value + copy button; assorted width caps
  (CONTENT_MAX_WIDTH, FIELD_WIDE_WIDTH) so rows stop stretching edge to
  edge on a maximized window.
2026-08-21 00:46:21 -07:00
Greg ShuflinandClaude Sonnet 5 1523da6f5f gui: cap podcast card list width so cards don't stretch full pane on wide windows
Subscriptions and Search results lists are flex_col containers whose
flex_row cards stretch to the full cross-axis width by gpui's default
flex stretch behavior, so on a maximized/large-screen window the cards
ran edge-to-edge with cover art and text far apart. Cap both lists at
layout::CONTENT_MAX_WIDTH, the same token ensemble.rs and
documents/detail_view.rs use for capped, left-aligned single-column
content.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01538s4TK1gKp93rvxMafrGm
2026-08-21 00:44:23 -07:00
Greg Shuflin 6b3f59e9e2 TODO/docs: the derived music library now has an Android view
Both browsable modalities carry it; the TUI is what is left, so
music-library.md's status says that rather than 'no GUI/TUI/Android view'.
2026-08-21 00:31:58 -07:00
Greg Shuflin 929a63c3d4 android: Music's Library tab is the Artist/Album view, not a flat track list
Android's Library tab listed every track in one flat list — the Folders tab
already matched the desktop, this was the remaining half. It now drills
artist -> album -> track over `MusicFfi::list_library`, keeping its own path
alongside the Folders one so switching tabs returns the user where they were,
with covers and artist mosaics streaming in row by row.

The header gains a rebuild action, because the Library is derived and nothing
derives it on its own: on a phone-only node there was otherwise no way to turn
imported tracks into an Artist/Album view at all. It runs as a tracked Job and
the screen stays live while it works.

`decodeSampled` moves out of `ComicRepository` — the music covers want the
same in-decoder downscale, and it was never comics-specific.
2026-08-21 00:31:52 -07:00
Greg Shuflin a2fabd3dff ffi: expose the tag-derived music library to Android
`MusicFfi` carried only the folder tree, so Android could answer "where did I
put it" but not "what music do I have" — the Artist -> Album -> Track
hierarchy the desktop's Library tab is built on.

Three methods, mirroring what the desktop's Music screen calls:
`list_library` over `library_entries` (with `MusicLibraryLevel`, the drill
path's level as a uniffi enum), `entry_art` for a row's cover — an album's own
thumbnail, or the portrait/mosaic derived for an artist, encoded as PNG — and
`build_library`, which derives the graph in the first place, through the live
`JobRunner` so it is tracked and cancellable and a second build answers Busy
rather than running twice.

`LibraryEntryKind` and `LibraryBuildSummary` derive uniffi directly rather
than getting a hand-written twin; only the types carrying a `DocumentID` need
projecting.
2026-08-21 00:31:46 -07:00
Greg Shuflin 8b15aaae6c music: compose the artist mosaic in the shared crate, not in gui-app
An artist has no cover art of its own, so the desktop derived a stand-in from
its albums' covers — a 2x2 mosaic, or one representative cover below four —
inside gui-app's `thumbnails`, where it was reachable only from gpui.
Android needs the same image from the same covers, and deriving it a second
time in Kotlin would be two rules to keep in step.

The composition moves to `agents::music` and returns an `RgbaImage`, so each
modality only converts the result into what its own renderer draws;
gui-app's `compose_artist_art` is now that conversion. Along the way the
sub-four fallback picks the first cover that *decoded* rather than the first
one handed in, so a corrupt APIC frame no longer blanks a card with three good
covers behind it.
2026-08-21 00:31:20 -07:00
Greg ShuflinandClaude Opus 5 156ca85089 android: rewrap a MediaLibrary doc line past the 100-column limit
detekt's MaxLineLength caught what ktfmt could not: it reformats code but
leaves comment prose alone, so the KDoc line joined while documenting the
Folders tab stayed 124 columns wide.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H1WvjY15afK2FNXioGo4GX
2026-08-20 22:45:27 -07:00
Greg ShuflinandClaude Opus 5 a756a70ec4 android: Music gets its Folders view, on the shared MediaLibrary
The desktop Music agent browses two ways — the tag-derived Library and
Folders, whatever Collection structure the user's own files came in with
— and Android had neither: one flat track list in a swipe-out sidebar.
A library organised the way its owner organised it was unreachable on
the phone.

The screen is now shaped like the desktop's, where the library is the
whole body above the now-playing bar: MediaLibrary with a Folders tab
and breadcrumb drill-in, the filter bar in SubAppScreen's search slot
like every other list screen, the transport pinned below. MusicSidebar
goes. The first tab is still the flat track list — deriving Artist/Album
needs an FFI surface that doesn't exist yet, and TODO.md now says so.

MediaLibrary grows the tab as an opt-in config, the same shape recentTab
and inProgressTab already had. Two things it can't inherit from them:
Folders is a place to browse, not a finder, so an activation stays on it
instead of bouncing back to Library, and the breadcrumb home crumb names
the hierarchy it roots rather than always reading "Library".

MediaItem splits activatable out of isLocal, mirroring the desktop's own
split. Overloading the two made dimming and inertness the same thing,
which would have left a remote track un-tappable and its streaming
fallback unreachable. Comics passes isLocal for both and is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H1WvjY15afK2FNXioGo4GX
2026-08-20 22:13:46 -07:00
Greg ShuflinandClaude Opus 5 a400d295a7 ffi: expose the music folder tree to Android
MusicFfi::list_tree is build_music_nodes projected into a MusicNode
record — the same flat, unsorted tree ComicsFfi::list hands over, so a
consumer groups by parent_id and sorts each level itself.

It carries DocumentAvailability whole rather than flattening it to an
is_local bool the way ComicNode does. A comic whose pages haven't synced
has nothing to open, but a track that isn't here still plays: the agent
streams it from whichever peer holds it, so the consumer needs the
Remote/Unavailable split to say which of the two it is looking at.

The tag-derived Artist/Album side (library_entries) has no FFI surface
yet; this is the Folders half only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H1WvjY15afK2FNXioGo4GX
2026-08-20 22:13:46 -07:00
Greg Shuflin b19d2c54c8 Remove various overly-verbose placeholder text 2026-08-20 22:07:34 -07:00
Greg Shuflin 508f9ac201 TODO/ADR 0032: the Android structural half is finished
The screen-header item comes off the list — every agent screen is on
SubAppScreen now — leaving five items that are all missing capability
rather than inconsistent chrome.

The ADR gains the one place Android deliberately parts from the desktop:
screen_header names the *screen* there because the rail is always visible
to say which agent you are in, and a phone has no rail, so a viewer's
header is the only chrome left to say what is open.
2026-08-20 19:30:46 -07:00
Greg Shuflin d24a6bf1a4 android: the viewers and Music/Notes take the shared screen header
SubAppScreen's title was already a document's name on three screens
(DocumentDetail, EpisodePlayer, PodcastInfo) — but it had no maxLines, so
a long episode title wrapped headlineMedium over three lines and pushed
the screen down. It is one ellipsised line now, which is what let the
viewers adopt it at all.

Two slots make the bespoke bars expressible: leading, for a sidebar or
drawer toggle that belongs before the title, and subtitle, for a machine
measure of where you are in what is open — the comic reader's page label
is the one caller.

Music, Notes, Pictures, the PDF viewer and the comic reader now use it,
which retires NotesTopBar, PicturesTopBar, MusicTopBar, ReaderTopBar and
PdfToolbar (whose file, now only the zoom/history row, becomes
PdfControls.kt). Three of those screens name the open document rather
than the agent, as they did before.

Notes and the PDF viewer keep their special back behaviour by passing it
as onBack rather than by installing a second BackHandler: in Notes each
pane is its own SubAppScreen, so system back in settings returns to the
notebook, and in the PDF viewer back closes the drawer before it leaves
the document.
2026-08-20 19:30:46 -07:00
Greg Shuflin f34271ab11 Additional TODO.md note 2026-08-20 18:55:56 -07:00
Greg Shuflin d85101df0f TODO.md note 2026-08-20 18:53:02 -07:00
Greg Shuflin a61a6e7974 TODO/ADR 0032: the mechanical half of the Android pass is done
Items 1-3 of the harmonizing entry — SectionHeading everywhere, HashChip
on the last two raw ids, a filter bar on every list screen — are finished,
so they come off the list and the remaining items renumber.

One new item takes their place, surfaced by doing them: the screen header
is still per-screen chrome. Music, Notes and the three viewers roll their
own title row instead of using SubAppScreen. That was not visible from a
grep for heading styles, which is what the old item 1 was written from —
several of the files it named were rendering a document's own title, not
a section heading, and SectionHeading is the wrong tool for those.
2026-08-20 17:54:07 -07:00
Greg Shuflin 0695c429e7 android: every list screen has a filter bar in the header slot (ADR 0032 §5)
Video and the PDF library were the only two screens using SubAppScreen's
search slot. Documents had a filter, but as an OutlinedTextField sitting
in its own content above the type/date dropdowns rather than in the
header; the other five list screens had no way to narrow a list at all.

Documents is a relocation. Comics, Podcasts and Humans are new: each
filters the list it already holds, as the user types, and each answers a
search that matches nothing differently from an empty library — the two
are not the same state and only one of them wants "import something".

The search bar is withheld where it would filter nothing: the podcast
New-episodes tab is a placeholder, and an empty Humans list already says
what to do instead.

Music and Pictures take the bar into their library sidebar rather than
the header, for the reason NotebookSidebar keeps its own: the list being
filtered is sidebar-internal, and a header bar would sit over a viewer
that has nothing to do with it.
2026-08-20 17:54:01 -07:00
Greg Shuflin 8cd398d5ac android: the last two raw ids become HashChips (ADR 0032 §5, ADR 0026)
The Node Key screen printed the whole 64-character key in mono inside a
Card, with its own Copy button and its own "copied!" confirmation card
below it; the Settings About block printed the full commit hash in mono
in a SelectionContainer. Both are the grammar HashChip replaced
everywhere else, kept alive in the two places nobody scrolled to.

Both now render the chip: truncated, tap to copy with the chip saying so,
long-press to read it in full. That deletes the Node Key screen's copy
button, its confirmation card, and the state and clipboard plumbing
behind them — the chip already does all three.

The commit chip passes buildInfo.commitShort rather than paying for
short_id: it is the lib's own 7-character truncation, the one release CI
tags builds with, so a chip and a build tag now read the same.
2026-08-20 17:33:45 -07:00
Greg Shuflin f7165b3bfe android: every section heading is SectionHeading (ADR 0032 §5)
Settings, Sync policy, Notes settings, the Music and Pictures library
sidebars, the PDF drawer's bookmark list, the podcast episode list and
episode summary, and the Human detail screen's Gender/Facts/Contact/
Times-you-met/Mentioned-in blocks each set their own heading style —
bodyLarge here, titleMedium there, labelLarge in Humans. They now all
render the shared accent-bar-title-rule grammar.

Two heading sites gain a trailing count, which is what that slot is for:
the PDF drawer's bookmarks and the podcast episode list (whose count used
to be parenthesised into the title string).

Danger Zone on the Settings screen loses its error-red heading. §4 spends
colour on exceptions, not on labels, and the desktop's Danger Zone section
and Android's own document Detail screen already headed it plain.

Notes settings gets SubAppScreen rather than its hand-rolled back-button
Box, since the heading pass left it as the only thing in that file still
naming a typography style for chrome.

The rest of TODO's list for this item is content, not chrome: a podcast
card's title, a search result, a comic/PDF/picture name in a viewer bar,
the "No people yet" empty state. SectionHeading is the wrong tool for a
document's own title, so those stay as they are.
2026-08-20 17:31:30 -07:00
Greg Shuflin 80eb8526c0 TODO/CLAUDE: awaiting the network is the rule, not an open question
The 'blocking network work must not occupy a UI worker thread' entry is done,
so it leaves TODO.md; what replaces it is a design principle, since the next
agent that reaches the network needs to know the answer before it writes the
call, not after.
2026-08-20 05:40:14 -07:00
Greg Shuflin fe60853b87 gui: every remaining rt.block_on leaves the background executor
Sweeps the rest of the desktop app onto `network_task::run`: the documents
detail screen's pull/push/override/purge-broadcast/eviction actions, the
settings screen's remote sync-config reads and writes, "Run now", the
ensemble screen's ping and per-peer sync, URL import, and onboarding's
ensemble join and P2P start. Each had a network call wrapped in
`Handle::block_on` inside `cx.background_executor().spawn`, so it held one
of gpui's fixed pool of worker threads for the whole round trip; each now
awaits the call on the tokio runtime, with the store reads and writes around
it left on the background executor where they belong.

`player_controls`' `open_stream` already did this by hand — it goes through
the same helper now, so there is one way to do it and one place explaining
why.

Also drops two unit-variant struct patterns clippy flagged in `ffi.rs`.
2026-08-20 05:40:14 -07:00
Greg Shuflin 24ce99fe7d music: the Stream-policy buffering wait is awaited, not blocked on
`open_streaming_track` returned only once START_THRESHOLD_BYTES had landed,
and it waited on the Condvar the `Read` path uses — so selecting a remote
track parked a gpui worker thread for up to STALL_TIMEOUT. The downloader
already ran on tokio; now the threshold wait does too, and `select_track`
splits the work three ways: blob ref and decoder setup on the background
executor, the buffering wait on the runtime via `network_task::run`.
2026-08-20 05:20:56 -07:00
Greg Shuflin 918fab0aa6 gui: PDF and comic page fetches await the network instead of parking a UI thread
gpui's background executor is a fixed pool shared by every screen's data
loading, thumbnail decodes and timers. A blob fetch from another node takes
as long as the peer takes, so a thread parked in `block_on` there is a
thread the rest of the UI can't have — enough concurrent opens and the
window goes dead.

`network_task::run` is the one way to wait on a peer: the future goes to the
tokio runtime the p2p stack already owns, and the gpui task awaits it. The
PDF viewer's render dispatch and the comics reader's page loads now split
along that line — local blob reads and mupdf/image decoding on the
background executor, peer fetches on tokio — and `fetch_pdf_bytes_remote` /
`fetch_comic_page_bytes_remote` are async, with no `rt` parameter to block
on.
2026-08-20 05:19:13 -07:00
Greg Shuflin 9a6e1323bc TODO: note that blocking network work still occupies a gpui worker thread
The PDF freeze fix bounded the symptom — the shared mutex is no longer held
across the byte load, and each peer attempt has a timeout — but the fetch is
still a synchronous blocking call sitting on one of gpui's fixed pool of worker
threads, which is the shape that made the app die in the first place. Records
the constraint, why a tracked Job is explicitly not the answer here, and the
two directions worth weighing.
2026-08-20 04:24:25 -07:00
Greg Shuflin 588ed7b324 pdf: the outline leads the right panel, and a remote PDF no longer stalls the app
Two changes to the PDF viewer.

The right panel's tabs run Outline, Bookmarks, and a freshly opened document
lands on Outline: it is the document's own structure, so it is what a reader
wants on arrival, where bookmarks are empty until they make some.

The second is a freeze. `request_render` held the `loaded_doc_id` mutex across
the whole byte load, and for a document whose content lives on another node
that load pulls the entire file over the network. Every library thumbnail
decode takes the same mutex, and each one occupies a gpui background worker;
gpui's pool is fixed at `available_parallelism()`, so opening one remote PDF
while thumbnails were still decoding parked the whole pool — and with it every
other screen's data loading and the loading-spinner timer, which is what made
the app look frozen behind a permanent "Rendering…".

The load now happens outside the lock, with the check repeated inside it (and
a retry for the one race that re-check can find), so the mutex is only held
across a channel send. Each peer attempt in `fetch_pdf_bytes_remote` is bounded
by `FETCH_TIMEOUT`: `open_blob_stream` timed out the connect but not the
transfer, so a peer that stalled mid-file parked its caller indefinitely. And
the canvas stops claiming to render a document it doesn't have yet — it says
"Fetching from another node…", which is the wait the user is actually in.

The fetch is still not a tracked Job, so it does not yet satisfy the
instant-feedback invariant; it is bounded now rather than unbounded.
2026-08-20 04:24:25 -07:00
Greg ShuflinandClaude Opus 5 6ee8caf544 lib: one rule for what an imported PDF is titled
Both import paths now hand write_pdf_properties the file name exactly as their
picker reported it, and pdf_title decides what of that becomes the title: a
trailing ".pdf" comes off, whatever its case, and anything else is kept.

Deliberately not Path::file_stem, which the desktop path used and which cuts at
the last dot whatever it is — "Q3 report.v2.pdf" is a document called
"Q3 report.v2", not one called "Q3 report". Deliberately not a general extension
strip either: this importer only ever takes PDFs, so ".pdf" is the one suffix
that is noise rather than part of the name. A name that is only the suffix keeps
it, since a blank library row is worse than a literal one.

This settles the divergence flagged when the projections moved: Android's two
callers disagreed, so a PDF picked from DocumentsScreen was titled "foo" and the
same file picked from PdfLibraryScreen was titled "foo.pdf". Neither Kotlin
caller changes — the rule is on this side of the FFI now, so they can't
disagree.

Titling a PDF from its own /Title instead is the better answer and is a
different job; TODO.md has what it would take.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGWhBSRN6rsa732ThkM5JF
2026-08-20 03:56:37 -07:00
Greg ShuflinandClaude Opus 5 1d70af7ed1 lib: the import property projections live with their agents
Running the sweep TODO.md asks for turned up five PropertyKind sites in
ffi.rs and three in syn-daemon — none in gui-app or tui-app, which is where
the rule had been enforced. Each was a second copy of a projection that
already existed in lib/src/agents, and the copies had drifted:

- An MP3 imported on Android reached the library with only a title and a file
  type. The desktop importer reads the file's ID3 tags at import so a track
  carries a real artist and album before any library is built; the FFI copy
  never did, so a phone-imported track had no artist, no album, and no
  tag-scan stamp to say it had been looked at. read_tags is deliberately
  outside the `multimedia` feature — its doc comment says "must work on a
  headless node and on Android" — so the FFI path could always have done this.
- A PDF imported on Android got no FileType property at all.
- An image's file extension was lower-cased on one path and not the other, so
  FileType could be "JPG" or "jpg" depending on which node imported it.

Each agent now owns the projection both importers call: write_pdf_properties,
write_image_properties, write_mp3_properties. The FFI's import_document_with_blob
hands its callback the StoredBlob, since music's scan stamp needs the plaintext
hash. Two more moves in the same spirit: music::list_albums replaces the
daemon's own MusicArtist read, and the daemon's byte-identical copy of
documents::import::create_collection_node is gone — its *walk* is deliberately
its own (it emits per-entry events), the collection-node creation was not.

Also lifts gui-app's "New Album" into pictures::create_album, which was the one
site the rule had a standing exception for. The sweep now comes back empty
outside test fixtures.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGWhBSRN6rsa732ThkM5JF
2026-08-20 03:56:37 -07:00
Greg Shuflin 8972af76ae gui: the command palette becomes a sidebar row under Home
The palette lived in the sidebar header as a magnifying-glass icon button,
which collided with the actual search fields (Icon::Search is the documents
and notes search-bar glyph) and gave a daily-use feature no name. It moves
into the rail directly below Home as a labelled row — Lucide square-terminal,
"Command Palette" — still an action rather than a destination: it never draws
as selected and its tooltip carries Ctrl+P for the collapsed rail.
2026-08-20 03:28:37 -07:00
Greg ShuflinandClaude Opus 5 42e45c76b5 gui: Shift+Enter submits a single-line text input
The last of the modifier gap: a hand still holding Shift from a selection
found Enter did nothing in a text input, the same way it found Backspace did
nothing. Enter means Submit here, so Shift+Enter does too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGWhBSRN6rsa732ThkM5JF
2026-08-20 03:07:48 -07:00
Greg ShuflinandClaude Opus 5 9f6186568c gui: holding Shift no longer swallows a delete
gpui matches a binding's modifiers exactly, so "backspace" does not match a
Backspace pressed with Shift down — the keystroke matched nothing and the
delete was silently dropped. Which is exactly the moment it happens: a
selection is normally made by holding Shift and pressing an arrow, and the
hand that then reaches for Backspace has no reason to have let go first.

Binds the Shift-modified spellings of all four delete keys, in both the shared
multi-line editing set and the single-line text input:

- shift-backspace / shift-delete → Backspace / Delete
- ctrl-shift-backspace / ctrl-shift-delete → DeleteWordLeft / DeleteWordRight,
  for a selection made with Ctrl+Shift+Left/Right, where both modifiers are
  already held

Shift+Enter had the same gap in the form text area, so shift-enter moves out of
bind_prose_keys into bind_editing_keys — a plain line break is not a
prose-editor-only idea, and TextArea's insert_newline already ignores the
distinction. The note editor's bindings are unchanged, since it took both sets
already.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGWhBSRN6rsa732ThkM5JF
2026-08-20 03:00:12 -07:00
Greg ShuflinandClaude Opus 5 31a37c3611 gui: the notes editor and the form text area become one editor
They were the same editor written twice: byte-identical copies of the caret
arithmetic, the mouse handlers, and the whole EntityInputHandler surface, plus
two parallel `actions!` namespaces and two hand-written key-binding lists that
had to be kept in step by eye. What actually differs is chrome and four
methods.

`components/multiline_editing.rs` takes the shared half:

- `MultilineBuffer` holds the `EditableText` and the layout the last paint
  wrote back, because caret movement is geometry as much as string indexing —
  Up/Down and a click all need to know where the soft-wrapped lines landed, so
  the two travel together instead of being four fields on each host.
- `MultilineEditing` is one trait with every action as a default method. An
  implementor supplies its buffer, its placeholder, and how it sizes itself;
  the notes editor additionally overrides `insert_newline` for markdown list
  continuation and `on_click_focus` to grab focus on a click.
- One `actions!` set, and two binding functions rather than one: the keys every
  editor answers to, and the extra keys an editor that owns its whole pane can
  afford (Tab indents rather than moving focus, Shift+Enter, paragraph jumps).
  The difference between the two editors is now a question of which keys each
  binds, not of two element trees. Both bind exactly what they bound before.
- `MultilineTextHost` gets a blanket impl, so painting comes free with editing.
- `EntityInputHandler` gets a macro instead, since the orphan rule rules out
  the blanket impl the delegation obviously wants to be.

`TextAreaEvent` and `NoteEditorEvent` were the same two variants and merge into
`EditorEvent`; its three consumers move over.

`components/text_input.rs` stays out. It shares about twenty of these handlers,
but a single-line field answers "what offset is under this point" from one
`ShapedLine`, means Submit by Enter, and has an `InputEvent` with a third
variant and fifteen consumers — see TODO.md for what folding it in would take.

Net -219 lines.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGWhBSRN6rsa732ThkM5JF
2026-08-20 02:55:48 -07:00
Greg ShuflinandClaude Opus 5 3c1318aa7b gui: the helpers nine screens each rewrote move into components
A sweep for byte-identical free functions across gui-app turned up five
clusters, none of which had any reason to be per-screen:

- `centered_note`/`centered_message`, the single centered line a screen shows
  in place of its content, existed nine times in three shapes and two type
  sizes. The shapes are real — how the note fills its space differs per screen,
  and guessing wrong is a layout bug — so `components/note.rs` keeps all three
  as named placements (`note`, `fill_note`, `overlay_note`) over one look.
  The type size is now font::BODY everywhere; it was font::LARGE in the three
  podcast screens and unset (so, inherited) in ensemble/jobs/documents.
- `bar_button`, the square glyph button on a media control bar, was identical
  in comics, pictures and the PDF viewer.
- `transport_button`, the round play/stop/skip button, was identical in music
  and the player bar.
  Both now sit in `components/button.rs` beside the buttons they are variants of.
- `render_library` — the media library with the screen's last load error banded
  above it — was identical in music, comics and the PDF viewer, and becomes
  `media_library::library_pane`.

Net -132 lines, and the five now have one place each to be fixed in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGWhBSRN6rsa732ThkM5JF
2026-08-19 20:14:31 -07:00
Greg ShuflinandClaude Opus 5 289fd7fa69 gui: the hand-laid-out grids share the table component's column layout
Three grids in the documents screen lay out columns by hand, because their
cells are elements rather than strings and `Table` has no way to hold a
twisty, a Push button or a presence swatch. Each carried its own header
function, its own per-cell width closure, and its own COL_*/PCOL_* constants —
and each had the same latent bug, that a header cell and the body cell under
it name their width in two separate places and can drift apart.

Rather than grow `Table` to take cell elements and per-row click handlers,
which would push interaction into a widget whose model/view split has no way
to type it, the three now share its *layout*: one `Column` list per grid,
`column_headers` for the header strip, `Column::size` for every body cell. The
widths are stated once and both ends of the grid read them from there.

`ColumnWidth` gains `Flex { min, max }` for the one variable-length column each
of these rows has, which is what they were all expressing by hand as
`flex_1().max_w(..)`. `Column::spacer` names the two title-less gutters in the
document table.

One visual change beyond the reshuffle: the sync-to-other-node header was the
only one of the four in font::SMALL, and is now MICRO like the rest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGWhBSRN6rsa732ThkM5JF
2026-08-19 19:57:53 -07:00
Greg ShuflinandClaude Opus 5 1cb8eb73c9 gui: every modal in the app is built on the modal component
The component's doc comment has claimed since it was written that it exists
because "every ad hoc modal in the app was independently hand-rolling this
same backdrop/card shape", but only import_prompt and the documents screen's
two destructive dialogs actually used it. Seven more sites hand-rolled the
backdrop, and each of them fed a raw px() width into render code, so none of
them tracked the UI zoom control.

The two free functions become a `Modal` builder, because the remaining sites
vary in ways the old signature had no room for: the command palette needs the
root element back so it can keep tracking focus and owning the arrow keys, and
the player bar's speed dialog has to escape a container that would clip it.
`warning()` replaces `warning_modal_overlay`, `dense()` carries the palette's
tighter padding, and `render_over_window()` does the deferred/anchored trick.

Four helpers cover what the cards themselves kept repeating — `dialog_card`,
`dialog_title`, `dialog_note`, `dialog_actions`. The card wrapper no longer
sets its own gap, since the one it had was doing nothing behind a single child.

Also swaps the PDF info popup's hard-coded backdrop rgba for theme.modal_overlay;
it was the one dimmed layer not reading the theme.

Net -182 lines. Needs a visual check per site.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGWhBSRN6rsa732ThkM5JF
2026-08-19 19:51:46 -07:00
Greg ShuflinandClaude Opus 5 274d77dc8a docs: the two gui-app reuse gaps the documents split turned up
One TODO item, two findings. The modal-overlay sweep is mechanical and has a
known list of six sites — and each one still carries the raw-`px()` width bug
the component was just fixed for, so they ignore the zoom control. The table
one is not mechanical: four hand-rolled tables sit beside one component because
the component renders a static grid and they all need interaction, so the work
is deciding whether `Table` grows or splits, not deleting duplication.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SGxPiSKunCfd75WXZjpNhr
2026-08-19 19:39:36 -07:00
Greg ShuflinandClaude Opus 5 a4f92ec859 gui: the destructive-action dialogs use the modal component
`components/modal.rs` was added because "every ad hoc modal in the app was
independently hand-rolling this same backdrop/card shape" — and then only the
import prompt was built on it. The documents screen's purge and delete-locally
dialogs each carried their own copy of the backdrop, the occluded card, and the
comment explaining the occlude.

Two things kept them off it. The card was fixed at `border_default`, and a
dialog that asks before something irreversible wants the amber border that
distinguishes it at a glance — so `warning_modal_overlay` is that variant.
And the width was an `f32` the component turned into raw `px()`, which CLAUDE.md
forbids in render code and which silently ignores the UI zoom control; it now
takes `Rems`, which is also what let `DIALOG_NARROW_WIDTH` be passed straight in.

Five more hand-rolled backdrops remain elsewhere (settings, pictures, notes,
human, command palette, player controls); they are not this screen's to fix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SGxPiSKunCfd75WXZjpNhr
2026-08-19 19:36:06 -07:00
Greg ShuflinandClaude Opus 5 1315620703 gui: the documents screen splits into one module per view
The remaining half of the split. Each view module now owns its screen whole —
what opening it does, what its controls do, and how it draws — rather than the
rendering sitting apart from the actions it fires.

`detail_view` takes the detail screen's actions (open, load, property editing,
asset sync, push, purge, delete-locally), `list_view` takes the list's header,
filters, folder-import dialog, and the twisty table with the `visible_rows`
tests that cover it. `mod.rs` keeps what is genuinely shared across all three:
the `DocumentsView` state, its `Render`, the tab bar, filtering, importing, the
row loaders, and the presence vocabulary.

4890 lines to 1468.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SGxPiSKunCfd75WXZjpNhr
2026-08-19 19:33:11 -07:00
Greg ShuflinandClaude Opus 5 8a58a90a0e gui: the documents screen's rendering splits by view
`agents/documents/mod.rs` was 4890 lines because the module had a convention it
only half-followed: each view's `Store` → row mapping got a module
(`document_detail`, `presence`) while every view's *rendering* stayed in
`mod.rs`, so one file held three screens' worth of it.

Finish the convention. `detail_view` takes the detail screen — the metadata
header, the Overview and Sync tabs, the properties and artifacts sections, the
two destructive-action dialogs, and the building blocks under them.
`presence_view` takes the survey grid and its controls. Each sits beside the
data module it renders, and `mod.rs` drops to 2956.

Pure motion: no behavior changes, and the only edits to the moved code are the
imports it now needs and the `pub(super)` on the handful of items that cross
the new boundary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SGxPiSKunCfd75WXZjpNhr
2026-08-19 19:27:35 -07:00
Greg ShuflinandClaude Opus 5 0b85e8cb0f gui: the properties table's shape moves next to its data
`property_columns` lived in the documents view's `mod.rs` while every row it
describes is built in `document_detail.rs`, the module that maps `Store` to
display rows. Move it there.

The cell vectors move with it, as `property_table_rows`. They were built inline
in `load_detail`, and table cells are positional to their columns — keeping the
two in separate files is how a column gets reordered without its cells
following.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SGxPiSKunCfd75WXZjpNhr
2026-08-19 19:16:25 -07:00
Greg ShuflinandClaude Opus 5 3f73792b80 gui: measure a table column against what it actually renders
`ColumnWidth::Auto` shapes every cell to size its column, and three separate
things made that measurement land a hair short — enough that
`music_duration_secs` still wrapped its trailing `s` onto a second line.

The header was shaped at the body weight, but renders semibold, so a column
whose header is its widest string came up short by the weight difference.
`CELL_PADDING` was a hard `px(12.)` standing in for `px_3`, which is rems, so
every zoom level but 100% added the wrong padding to correctly-scaled text.
And the sum went to `w()` as a fractional width with no slack: laid-out bounds
round to whole pixels, and the fraction a column loses there is exactly one
wrapped final character.

Auto cells are also `whitespace_nowrap()` now. That is what the variant means —
the column was measured to hold each cell on one line, and the values it exists
for (a property name, a status word) are unbreakable identifiers that a mid-word
break makes harder to read, not narrower. Measurement decides the width; nowrap
makes a sub-pixel miss impossible to render as a wrap.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SGxPiSKunCfd75WXZjpNhr
2026-08-19 19:16:17 -07:00
Greg Shuflin 0b5c490f6b docs: the remaining Android visual-harmonization work, in one item
Replaces the placeholder fast-follow note with what is actually left, surveyed
rather than guessed. Two of the eight items are gaps rather than migrations and
were not on the earlier list: bg_media_canvas is defined in the palette and used
by no Android viewer, and the reading surface has no Android story at all —
it is not exposed over the FFI in the first place.

Also records that documents/presence.rs still computes its own copy of the
coverage figures that ensemble/screen.rs now owns, so the second half of that
move has somewhere to be remembered.
2026-08-19 17:33:10 -07:00
Greg Shuflin 016e13918c android: the roster shows coverage
Now that the numbers cross the FFI, the Ensemble roster can answer the question
the screen is really for — not just who is in the ensemble, but how much of it
each node actually holds.

A meter, which is one of the two things ADR 0032 §4 permits a gradient to do:
encode a value, as against filling a panel. Same three-way fill rule as the
desktop's coverage_cell — green at full coverage, amber below a fifth, cobalt
between — because a node holding almost nothing is worth noticing and a node
holding everything is worth confirming.
2026-08-19 17:33:10 -07:00
Greg Shuflin 044aa1c532 lib: coverage is a projection, so it belongs in the projection
The desktop counted per-node document coverage itself, in gui-app's ensemble
loader — one grouped count plus a total, both read straight from the store.
That is a projection of the database living in a UI, and the test of whether
that matters is what happened next: Android could not show coverage at all,
because the numbers existed only inside the desktop.

build_ensemble_status computes them now and puts documents_held on each member
with total_documents beside them, so every frontend gets the same figures
without deriving them — the same rule the rest of this projection already
follows for display names and last-seen timestamps.

Behaviour is preserved exactly, including that a counting failure degrades to
zeroes rather than failing the whole status: coverage is a detail on a screen
whose subject is membership, and losing the count is not a reason to be unable
to say who is in the ensemble.

The daemon's JSON round-trip guard gains assertions for both new fields, since
that test exists precisely to catch a field that stops surviving serde.
2026-08-19 17:33:10 -07:00
Greg Shuflin a846716e59 android: the Ensemble screen becomes a roster
The screen opened with a Card filled with colorScheme.primary — a saturated
accent panel carrying six rows of white-on-blue, three of them raw untruncated
keys. ADR 0032 §5 asks for hairlines and gutters instead of tinted panels, and
with the accent just brightened it would have been a wall of cobalt. It is a
Membership fact grid now, mirroring the desktop's.

The expand/collapse toggle went with it. It existed only because the keys were
too long to show at all; HashChip truncates them, so there is nothing left to
hide — and copying, which the toggle used to gate, is now always one tap.

MemberCard becomes MemberRow, and stops privileging the local node. It was a
primaryContainer-filled card while every other node was a plain one, which
asserts a hierarchy this system does not have — the ensemble is a set of
co-equal peers, which is the whole reason ADR 0032 rejected drawing this
screen as a node graph. 'this node' is a dim label now.

Two more §4 corrections: a peer we cannot currently reach takes the amber
connection dot rather than reading as broken, and a gossip-neighbour count of
zero stops being painted in error red. A single-node ensemble has nobody to
talk to yet — that is a legitimate state, not a failure.
2026-08-19 16:59:24 -07:00
Greg Shuflin ab1ad642b4 android: one identity rendering, not two
IdRef predated HashChip and did the same job a different way — name plus a
truncated id, tap to reveal — and its own doc comment nominated the Detail
screen's node rows as the second consumer that would justify keeping it. Those
rows got HashChip instead, which left the app with two grammars for one thing:
exactly the drift ADR 0032 §5 exists to stop.

IdRef stays as the entry point for 'an id with a name in front of it', because
that reads better at a call site than a name parameter on a chip would, but it
now composes HashChip rather than duplicating it. The Jobs screen gains
tap-to-copy on its ids as a side effect, which is what people wanted from them
anyway.
2026-08-19 16:59:24 -07:00
Greg Shuflin 6f3b061cfd docs: note Android's Music agent has no Folders view
Raised while looking at the ADR 0032 Android build; unrelated to visual design.
The desktop has Library and Folders tabs, Android only the derived Library, so
a collection organised the way its owner organised it is unreachable on the
phone. The data is already loaded either way — it is a UI gap, not a missing
capability — and Comics already does the equivalent drill-in via MediaLibrary's
breadcrumbs.
2026-08-19 16:14:01 -07:00
Greg Shuflin 48ddccc5b2 android: centre the placeholder text that wraps
MediaLibrary's CenteredNote centred the text *block* but never set textAlign,
so a message short enough to fit one line looked centred and a message long
enough to wrap did not — the second line hugged the left edge. Comics is where
it showed, its empty message being the longest of the four, but the fix belongs
in the shared component rather than in that screen.
2026-08-19 16:14:01 -07:00
Greg Shuflin efbeaca7e4 design: the Charcoal cobalt gets brighter
Seen on a phone, #2d6cff against the Charcoal ground did not read as
*energised* — the quality the whole direction is calibrated on — so much as
merely blue. It moves to #4585ff, taking the text-selection highlight with it:
4.21:1 to 5.41:1 against bg_window, and 3.83:1 to 4.94:1 against bg_card,
which is the number that matters for a mark sitting on a card.

Saturation is untouched. The blue channel was already pinned at ff, so raising
red and green together lifts lightness without washing the hue out; it stays
cobalt rather than drifting to periwinkle.

accent_fill deliberately does not follow. It is the surface that carries white
text, white on it is already only 5.17:1, and spending that margin buys nothing
— a large saturated selection block has never had trouble being seen. The two
tokens diverging further is exactly what the ADR's 'one accent value cannot
serve both roles' predicted.

Both modalities move together, since Charcoal is one palette. Slate is
untouched: on a light ground the failure mode is the opposite one.
2026-08-19 16:14:01 -07:00
Greg Shuflin 63f631fc8e design: ADR 0032 §10 — Android takes the same palette, without Material You
Records the decisions the phone forced that the desktop never had to answer:
why dynamic colour goes, how the palette projects onto Material's slots, why
containers are hard-edged but buttons stay pills, and the three places Android
differs in execution rather than in intention.

Updates the status, the implementation notes, and the consequences, which all
said Android was unstarted. TODO.md picks up the structural half that was
deliberately scoped out — the live-state slot, the remaining screens'
migration onto the shared grammars, and a Presence tab.
2026-08-19 15:39:51 -07:00
Greg Shuflin b83e3888b4 android: the home screen learns the shelves, the header learns to search
The home screen grouped agents by AgentType — Activity above the divider,
Control below — and sorted alphabetically inside each, which put 'Comics &
Manga' next to 'Code' and told the reader nothing about either. It now reads
AgentGroup from the shared registry like the desktop rail does.

SubAppScreen gains a search slot. ADR 0032 §5 puts the per-agent search 'in the
top row, immediately after the title'; on a phone that row is already carrying
a title and a back affordance, so the bar takes its own line directly beneath —
the same position in the reading order, at a width a thumb can use. Video and
the PDF library move their bars into it, which is where the four different
search placements across five screens start collapsing into one.
2026-08-19 15:39:51 -07:00
Greg Shuflin d5a4ebfd35 android: the Detail screen stops calling absence an error
It painted both 'Absent' and 'Removed' in colorScheme.error — a red dot for a
document whose content simply lives on another node. That contradicted the
project's own stated principle rather than being a taste call, and it is the
same finding ADR 0032 §4 recorded against the desktop.

While here, the screen adopts the three new grammars: five Text+HorizontalDivider
pairs become SectionHeading (two of them carrying their count in the trailing
slot, where it reads as a machine value rather than as part of the title), and
the four places that printed a full 64-character hash become HashChip.
2026-08-19 15:39:41 -07:00
Greg Shuflin 2a2eda097d android: one heading, one chip, one word for absence
The Kotlin counterparts of components::section, components::hash_chip, and
the Documents agent's PresenceLook — the three grammars ADR 0032 §5 asks to
be the same wherever they appear.

Two of them differ from the desktop in execution, on purpose. The heading gets
real letter-spacing, because Compose has the property gpui lacks and had to
approximate with size and weight; the Android heading is therefore the
specimen's version rather than the desktop's compromise. The chip answers to
two gestures instead of a hover: tap copies and the chip says so, long-press
expands in place.

What matters most about PresenceLook is what is missing from it. There is no
error state, because a copy living on another node is a state to render, not a
failure — 'absence is not an error' — so NOT_HERE is an empty outlined dot and
the words 'Not here'. The outline carries 'nothing is wrong, there is simply
nothing here' without spending any colour, which is what leaves the palette
free to mark the exceptions.
2026-08-19 15:39:41 -07:00
Greg Shuflin 208bbcbd98 android: two grounds, and no Material You
Color.kt was still the pre-ADR palette — Material 3's seed purple and the
neighbours picked up one call site at a time — and dynamicColor defaulted to
true, so on Android 12+ none of it was reached anyway: the scheme came from
the user's wallpaper.

Dropping dynamic colour is the substantive decision here, and ADR 0032 §10
carries the argument. The short form: this palette assigns meaning by hue, and
a wallpaper-derived primary reassigns the hue without reassigning the meaning.
A green wallpaper makes 'selected' and 'present' the same colour. The app had
already noticed once — LocalSuccessColor existed specifically to survive the
dynamic path — and doing this pass on top of it would have needed four more
escape hatches, at which point every semantic colour is overridden and the
result is neither coherent with the desktop nor honestly Material You.

The palette becomes a role table with two instances rather than thirty loose
vals, mirroring theme.rs, so a value that moves there has an obvious
counterpart here. Every Material slot is filled, including the *Fixed family,
which otherwise falls back to the baseline purple. The tonal families collapse
onto one accent because no colour encodes a category; errorContainer is a
plain card rather than a red-washed panel; surfaceTint is transparent so
elevation cannot reintroduce the accent as a wash.

SynShapes mirrors sizing::shape and flattens Material's ramp onto the same
2-4dp band. Buttons stay pills — Material resolves CornerFull to a hard-coded
CircleShape, not to a theme value — which is kept rather than fought: the
containers are this app's, the controls are the platform's.
2026-08-19 15:39:28 -07:00
Greg Shuflin ff926c1f04 android: ktfmt reflow in JobsAgent
Drive-by from running the formatter; unrelated to the visual pass.
2026-08-19 15:39:28 -07:00
Greg Shuflin a2ea7952d8 lib: the navigation groups and short_id cross the FFI
AgentGroup already existed on the shared registry for the desktop rail; it
just never crossed to Kotlin, so Android's home screen was still grouping by
AgentType and sorting alphabetically inside each half. Export the enum, carry
it on AgentInfo, and add get_agent_groups() so the headings and their order
stay Rust-side and the two navigations cannot drift.

short_id goes with it for the same reason: ADR 0026 says every frontend
truncates identically, which only holds if they all call the same function.
2026-08-19 15:39:15 -07:00
Greg ShuflinandClaude Opus 5 d1eaf3e695 gui: Documents — measured property columns, a capped Detail, clearer Presence controls
Takes up the two tokens from the previous commit and fixes the Presence
controls.

- **Property and Sync become measured columns.** They hold unbreakable
  identifiers, which is exactly what `ColumnWidth::Auto` is for; nothing wraps
  mid-word now.
- **The Detail tabs take `CONTENT_MAX_WIDTH`** and stay left-aligned. The
  document table and the presence grid stay uncapped, because there the width
  is the information.
- **Presence drops its "Where everything is" heading** — the screen is called
  Presence and the grid is right there — leaving the counts as a dim mono line
  beside the controls.
- **The two Presence controls now look like what they mean.** The row filter
  is one choice among three, so it is a segmented control: one frame, one
  answer. The node columns are independent toggles, so each chip carries *a
  swatch of its own cell* — filled when the column is shown, an empty outline
  when hidden, the same grammar the grid uses two lines below. The control is
  a miniature of what it controls, and the label dims to match. No checkbox
  needed: the grid teaches the grammar on the next line.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 8006631de4 gui: give the table a column that measures itself
`ColumnWidth::Fixed` makes the author guess a width, and a guess that comes up
short wraps a value mid-word — `music_duration_secs` broke onto two lines on
the Document Detail screen while the window had three hundred spare pixels
beside the table. `Content` is not the answer either: it sizes each *cell*
independently, so the column stops being a column.

`ColumnWidth::Auto { min, max }` measures the real text — every cell plus the
header, through gpui's own text system — takes the widest, clamps it, and
gives the whole column that answer. Measured once per row-set rather than per
frame, since it only changes when the rows do; shaping a line per cell every
frame would be a real cost on a long table.

Also adds `layout::CONTENT_MAX_WIDTH`: how wide a column of *reading* content
is allowed to get. gpui screens fill their window, and a label/value screen
filling a 2560px window puts its rightmost column half a metre from its
leftmost, so the eye has to travel the whole width to associate a value with
its label. Both are consumed in the next commit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 9f32741180 gui: the ensemble roster lines up
One row sat offset from the others. Two causes, same shape: the name cell was
`flex_1`, so anything after it that varied in width changed how much slack the
name absorbed, and then no two rows agreed on where their columns started.
The "(this node)" marker was one such thing — present on exactly one row — and
the trailing sync message ("Last synced: Aug 13, 07:51", "Not synced", a
spinner, nothing) was another.

Now every cell after the name is fixed-width and the name is the only thing
allowed to take the slack. "(this node)" moves inside the name cell where it
cannot push anything. The two timestamps get a column each — last seen and
last synced, previously one column and one inline hint of varying length —
and the transient ping/sync feedback gets one fixed slot shared by both
actions, truncated, with the full text on hover. This node's row renders the
action block as empty space rather than omitting it, so its other columns
still line up.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 bf191be781 gui: put the command palette back where you can see it
ADR 0032 §6 removed Command Palette as a nav *destination*, and it should
stay removed: it is an action sitting in a list of places. But it went away
entirely, and a feature reachable only by a shortcut nobody told you about
does not exist.

It comes back as a search-glyph button in the rail header, beside the
collapse toggle — chrome, not a destination — with the shortcut in its
tooltip. Icon-only is defensible here by §5's own test: an icon-only control
is fine for something used daily, and Ctrl+P is.

Home loses "Pick an agent to begin" too. One word left.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 610aee399d gui: a copy says so — hash chips answer for the clipboard
A copy is invisible by nature: the clipboard is somewhere else. Clicking the
chip did nothing you could see, which made it read as a link that had failed
rather than a button that had worked.

For a moment after a click the chip now says **Copied** in the success colour
with a tick where the copy glyph was, and its border picks that colour up,
then it goes back to itself. HashChip becomes a RenderOnce component to hold
that state — keyed on the chip's own id via use_keyed_state, so two chips in
one row remember their own state and a scrolled-away chip forgets it.

Adds a lucide check.svg alongside the copy glyph it swaps with.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 b766596ad8 gui: the Ensemble screen becomes a roster of co-equal peers
DIRECTION.md §8.5 and ADR 0032's Rejected alternatives. A stack of bordered
member cards made four nodes look like four unrelated things, gave each one
its own chrome, and did not scale past about six. A roster is what a set of
co-equal peers looks like drawn: every node the same row, in one weight, with
no node styled as a centre or a source. This node is first and carries a
badge, because the reader has to find themselves; it is not otherwise
different.

Each row carries the node's name, its id as a hash chip rather than 64
characters of hex, coverage as a meter plus the fraction behind it, last seen
in mono, and its actions. Coverage is the number that says what a node is
*for*: a phone holding 96 of 1 284 documents is doing its job, a backup
server holding 96 is not. It comes from one grouped count, so the roster stays
cheap as the ensemble grows.

Reachability becomes a dot rather than a bordered word — a column of
amber-outlined pills makes every ordinary state shout — and unreachable is
amber, not red. A phone in a pocket is not a fault (ADR 0032 §4).

The status card becomes a Membership fact grid, with every key a hash chip.

**The reachability matrix is not built**, and the reason is data rather than
design: a node knows only its own gossip neighbours, so an N×N matrix drawn
today would have one real row, one real column, and (N-1)² cells reading "not
known from here" — a broken-looking widget rather than a legible absence, and
it would not make the argument the matrix exists to make. The prerequisite is
each node gossiping its own neighbour set; ADR 0032 and TODO.md both carry it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 cf72112908 gui: the Presence tab — where everything is, across the ensemble
ADR 0032 §7. The main document list answers "is this here"; this answers
"where is everything", which is a question asked occasionally and
deliberately. Putting it in the list charged every row, forever, for it —
and cost O(N) width in a system whose premise is arbitrarily many nodes.

Given a whole screen the column problem goes away. Node names appear in full,
never abbreviated: shortening a name the user chose is not the app's call, and
having the room not to is the reason this view exists. Which nodes are shown
is a control rather than a layout constraint. Two filters answer what people
actually arrive with — *missing somewhere* and *only one copy left* — beside
a Copies fraction that turns amber at one, since that is the case where the
next disk failure loses the document.

Cells follow §4: present is the quiet state, because a saturated fill on the
state most of the grid is in spends the whole grid's colour budget saying
nothing. What the eye catches is an empty outline where a copy is missing and
cobalt where one is on its way. (The specimen hatches the arriving cell; gpui
has no repeating gradient, and cobalt already means "in flight", so it is a
solid fill.)

Documents gains a real tab bar — All documents / Presence / Imports. Imports
was reached by a header button and a back link, which is a tab wearing a
disguise. The search field sits above all three, so a filter applies to the
survey too; the survey loads on arrival rather than being kept warm, since it
is the heavier query and most sessions never open it.

Store side: list_nodes_for_documents and count_present_by_node are batched
reads, one statement each, so the survey does not scale a query per row or
per node. count_documents gives the coverage meters an honest denominator —
a figure about the library, not about the page on screen, which is also why
the view says so when the library exceeds one page.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 c0a6dd5f84 gui: re-space the Charcoal surface ramp so the rail is visible
The rail sat three units below the window — #080b10 against #0a0d13 — which
on a real screen made it indistinguishable from the content pane. Slate was
fine; it has room in both directions.

Darkening the rail cannot fix it. At that luminance the range below the ground
is spent: pure black is only a 1.08 contrast step under #0a0d13, and three
units per channel is under the threshold a display reliably shows. So the
ground lifts a hair to #0d1219 and every surface above it takes a step of
about ten units per channel, which is where a difference becomes visible on a
dark panel. The rail still sits below the ground, which was the point.

The rail also gains the hairline it should have had where it meets the
content — the specimen has both the line and the fill difference, and on a
dark ground the line does at least as much of the work.

Measured against the new bg_window: text_primary 14.7:1, text_secondary
6.2:1, text_tertiary 4.2:1 (still the restricted tier), accent 4.3:1 against
the 3:1 non-text components need. ADR 0032 carries the new table plus an
Amendments section with the old values and why they failed, and records the
bg_media_canvas decision it was previously silent on.

Two TODO.md entries for things deliberately left: the rail edge treatment,
and hand-tuning the Charcoal values once more of the app exists.

Also corrects components::section on why the heading is not letterspaced —
gpui has no letter-spacing, and interleaving thin spaces would corrupt the
string rather than its presentation. (Text selection is a separate gap in
gpui, not the reason.)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 7d5a542e98 design: ADR 0032 status — accepted, with what is and is not built
Records the GUI implementation against each section of the decision, and
names the three things not yet built: the Presence tab on Documents, the
Ensemble roster and reachability matrix, and the Android/TUI passes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 032215dadc gui: bigger icons, terser copy, captions that ellipsize
The smaller consequences of ADR 0032, together.

Icon glyph sizes move up a step (MD 16→18px, LG 20→22px, SM 14→15, XS 11→12).
§5, from the most consistent thread in the review: icons in this class of app
are routinely too small to identify at a glance, so the ones that appear are
drawn larger and given room — and an icon-only control is only defensible for
something used daily, which the app already holds to (the gear and the
settings back arrow are its only two).

Microcopy: "Welcome to Synchronicity / Select an option from the sidebar to
get started" was unedited boilerplate the ADR calls out by name. An instrument
panel does not greet you or explain that a sidebar is clickable. Likewise
"Coming soon…" → "Not built yet.", and two Documents empty states.

Media captions truncate with an ellipsis instead of being cut off mid-glyph —
the one media-grid finding DIRECTION.md §8.2 left standing after it withdrew
the "covers should float" reading.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 527a85c859 gui: one selection grammar, and presence on the document list
Two pieces of ADR 0032 that both come down to "say the same thing the same
way everywhere".

components::selection carries the selection treatment §5 settles — a
saturated full-bleed block, a brighter left edge, text_on_accent on it — and
the navigation rail, the hierarchical sidebar, the command palette, the
combo box and the tag input all draw it from there. The shipped app used two
unrelated hues for one concept (purple in the rail, blue in the Notes list,
both visible at once) and two weights (a loud filled pill against a
barely-there grey): CRITIQUE.md finding 1, at both the colour and the shape
level. The focused/unfocused distinction in list cursors predates this and is
kept — an unfocused selection still falls back to the hover fill, so a stale
selection reads as stale.

The document list gains the presence indicator §7 asks for: one column, for
*this node only* — Here, Arriving, Not here. Where everything is across the
ensemble is a different question, asked occasionally and deliberately, and it
gets its own view rather than charging every row forever for it.
rows_present_locally answers here/not-here in one statement per page plus a
blob existence check; "Arriving" is read live off the job stream, since a
transfer starts and finishes without the row being reloaded. A parent row
answers for itself, not its subtree — rolling a subtree up would make a
collection read "not here" because one chapter of it is missing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 a5dc1fcba2 gui: one header grammar across every agent screen
DIRECTION.md §1 counted four header grammars in five screens: a title in the
content area over three toolbar rows (Documents), a back link and a prefixed
title (Detail), a title sized to sit *over the sidebar column* with search in
the pane beside it (Notes), a centred tab strip (Comics), and no title at all
(Settings, Jobs). Same app, five conventions.

components::screen_header is the one row now: title, optional crumb, the
per-agent search field taking the free width, then actions — with a tab bar
directly below where a screen has one. Everything but the title is optional,
so a screen with neither search nor actions still gets the same bar at the
same height.

Applied to Documents, Detail, Imports, Notes, Comics, PDF Viewer, Music,
Pictures, Podcasts, Humans, Jobs, Settings and Ensemble; Jobs and Settings
gain a title they never had. The Documents header collapses from three rows
to one — the URL import field that was baked into the button row moves below
it, being a rarely-used entry point, and the search field moves up out of
the filter block into the header where every other agent now has one. The
Detail title stops being "Document Details: <title>": the back button already
says where you are, and the prefix cost the actual subject its room.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 05f05d7005 gui: Charcoal by default, and the page becomes its own setting
ADR 0032 §2 and §5.

ThemeMode::default moves from System to Dark. The design is calibrated on the
charcoal ground; following the OS meant most users met the app on the ground
it was not designed against. The Settings control is relabelled Charcoal /
Slate / Follow system — the variants keep their Light/Dark names internally,
since renaming them would be a refactor with no user-visible effect.

The reading surface becomes a separate choice from the chrome. ReadingSurface
(Paper / White / Dark, defaulting to warm paper) is persisted beside the theme
mode, and theme::Page resolves it to a ground, ink, rule, and an ink-blue
accent — the same hue as the chrome cobalt, darkened for a light page. The
desk metaphor is the point: dark tools, light page, and a reader who wants a
white page should not have to move the whole app to get it.

Theme::on_page recolours a palette onto a page rather than threading a second
value through the twenty-odd functions of the prose renderer. It also swaps
the syntax set for whichever palette matches the page lightness, since a code
fence on warm paper needs the light theme colours even when the chrome around
it is charcoal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 04910c3d78 gui: Detail screen — hash chips, absence without red, unequal danger
The three CRITIQUE.md findings that are closest to bug fixes against the
project's own conventions, plus the presence-vocabulary correction ADR 0032 §4
makes.

- **Finding 4, hashes.** components::hash_chip is the one way a hash or id is
  drawn: dim mono, bordered, truncated, click to copy, hover to reveal — ADR
  0026's rule given the visual form ADR 0032 §5 specifies. The Detail screen
  was printing full 64-character node ids and blake3 hashes inline. A blob
  row's hash moves out of the  summary string into its own
  ItemRow field, so it can be a chip rather than a substring.
- **Finding 5, danger.** Purge is irreversible and broadcasts a delete intent
  to every node; Delete local copy frees space here and can be fetched back.
  They were two identical amber buttons. danger_button is now a filled red —
  red is faults and destructive actions per §4 — and the new ghost_button is
  the demoted half of such a pair. The copy says what each one costs.
- **Finding 3, dim interactive text.** "Load more" was a caption-contrast
  grey that was hard to find at normal viewing size; it is an accent-coloured
  control now, and the other interactive elements sitting in a text tier
  below text_primary come up with it. §8's rule: the dim tiers are for text
  that is inert.

Presence stops being painted in color_error. A copy that is not on a node is
an empty outlined dot and the words "Not here" — CLAUDE.md's own "absence is
not an error", which the shipped screen contradicted. Green is here, amber is
haven't-been-told, red is now only a fault. The node-status rows become a real
tabular list with the id in a chip and observed-at right-aligned in mono, and
section_label gives way to components::section — one heading grammar, with
"Nodes" carrying "3 of 4 here" in its count slot.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 090a759c51 gui: grouped nav rail with block selection and a live-state slot
ADR 0032 §§5-6. Three changes to the rail, all of which the ADR argues are
one change: it should say what is happening, and it should stop looking like
a generic web sidebar.

- **Grouped, not alphabetical.** AgentGroup (Library / Workspace / Tools /
  System) lands on the shared registry rather than in this component, since
  which shelf an agent lives on is product information Android will want
  too. Headings use components::section, the app's one section-heading
  grammar — the rail no longer has a heading style of its own.
- **Selection is a full-bleed saturated block** with a brighter left edge and
  text_on_accent on it. The rail loses its horizontal padding so rows can run
  edge to edge; the inset rounded pill was the tell.
- **The right-hand slot carries live state, not a count.** nav_status is a
  small shared entity agents publish into: Jobs posts its running count,
  Notes posts a waiting decision when a body has arrived from another node,
  and the rail derives the playing agent's slot from MediaSession directly,
  since playback is app-wide and no agent needs to announce it. Empty is the
  normal value.

Command Palette stops being a nav destination — it is an action, and Ctrl-P
already opens it. accent_fill picks up its call sites at the same time: every
accent surface that carries text now uses it, and bg_selected is derived from
it rather than repeating the literal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00
Greg ShuflinandClaude Opus 5 d80b4fb91c gui: ADR 0032 token layer — Charcoal/Slate palette, text_tertiary, accent_fill, sizing::shape
Replaces the accumulated Material-3-seed palette with the values ADR 0032 §3
settles: a charcoal ground with a trace of the accent in it, saturated cobalt
reserved for state, and hairlines rather than tinted panels. Both grounds are
kept — Charcoal and Slate in the UI, Theme::dark()/light() internally.

Token changes that fall out of §8, all mechanical at the call sites:

- text_tertiary added as a third text tier, with the rule about what may be
  written in it on the field.
- accent_fill added: cobalt bright enough to read as energised on charcoal
  reaches only 4.47:1 under white text, so accent surfaces that carry text
  need their own darker value. accent stays the stroke/mark colour.
- bg_nav_sidebar_selected and bg_sidebar_selected collapse to one bg_selected,
  which is the ADR's 'one selection colour everywhere' (CRITIQUE.md finding 1).
  bg_*_hover likewise collapse to bg_hover, which was already being used for
  hover well outside any sidebar.
- bg_raised added for meter troughs and inert cells; the progress-bar groove
  moves onto it from border_card, which is a border colour.
- text_sidebar_collection and text_init were tiers wearing role names; folded
  into text_secondary. color_info's three call sites all meant 'in flight',
  which is now accent's job.

sizing::shape adds CARD/CONTROL/DIALOG/PILL per CRITIQUE.md finding 2, and
every one of the ~100 rounded_*() call sites is audited onto one of them.
The values are tighter than gpui's Tailwind steps because the direction is
flat and hard-edged: containers are near-rectangles, only controls round.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpTejroeYiCmrgMQss89vR
2026-08-19 14:47:49 -07:00