Skip to content

Index: settled threads are read by page, not carried in the snapshot - #1205

Merged
Tryanks merged 1 commit into
mainfrom
claude/index-settled-pages
Nov 28, 2026
Merged

Tryanks merged 1 commit into
mainfrom
claude/index-settled-pages

Conversation

@Tryanks

@Tryanks Tryanks commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Summary

The index snapshot carried every unarchived thread. It now carries the threads that descend from no settled thread; the rest are read when shown.

 subscribe(Index)
-  snapshot: every unarchived thread, activity of each
+  snapshot: threads whose lead is not settled, activity of those
+  summary: settled_counts and outside_updated_at per project
 open Settled shelf
-  first 10 of the rows already held; Show more reveals 25
+  Query::SettledSessions { scope, before, limit }   # 10, then 25 per Show more
 open a thread the index does not carry
+  Query::ThreadFamily { session_id }                # its lead and what that started
 palette / composer @ over thread titles
+  Query::FindSettledSessions { query, limit }
 reconnect
-  fingerprint of everything held
+  fingerprint of what the index carries; shelves and open threads read again

After the snapshot the topic still carries every thread's changes, so a thread that settles stays held and one that reopens enters the index.

crates/core/src/thread_sort.rs      lead, in_index, settled_rank: the one rule both ends use
crates/core/src/fuzzy.rs            moved from ui, so the host scores titles as the client does
crates/protocol                     SettledScope, SettledCursor, SessionPage, three queries
crates/runtime/src/app/snapshots.rs index_baseline, settled pages, families; summary changes go
                                    thread by thread, the rest trimmed to the index
crates/ui/src/store/settled.rs      shelves' pages, families, what is kept across a new index
crates/ui/src/sidebar               shelves show what their pages reach, with the host's count

Evidence

  • Before: on a clone of a real profile (8742 threads, 6369 unarchived, 1975 of 1990 listed threads settled) the snapshot line was 6,227,352 bytes with 6369 threads.
    After: 221,049 bytes with 246 threads; a page of 25 settled threads is 26,876 bytes.
  • cargo fmt --all --check, cargo clippy --workspace --all-targets --locked -- -D warnings, cargo nextest run --workspace --locked: 1547 passed.
  • Not run locally: the iOS, Android and Web checks, cargo machete. Not looked at in the running app.

New tests:

  • the_index_leaves_settled_threads_to_pages_and_families (runtime): the snapshot's threads, activity and count; a page, the page after a cursor, a family.
  • settled_pages_are_held_beside_the_index (ui store): after reading a page the reconnect fingerprint is still the index's, and a new index keeps the page. It fails if the fingerprint covers what is held from outside the index.

Tests whose driver changed, assertions kept. Each read a settled thread out of the snapshot; a client now reads it by page or family, so the driver does:

  • runtime TestEntity::subscribe(Topic::Index) reads the settled threads and their families as a client with every shelf open does (settled by step 1 of the process: the driver did not behave as the app).
  • cold_lifecycle_migrates_legacy_settlement_and_ages_from_events_after_rename, an_old_profiles_activity_backfills_and_updates_the_index, and move_tests' listed, which read the raw snapshot, also read the settled page.
  • settled_shelf_pages_without_expanding_for_selection_and_navigation_matches_rows, the_threads_list_keeps_its_offset_across_the_shelf_and_selection, the_project_view_keeps_a_settled_shelf_per_project: their scripted host answers the page and family queries (host_index, answer_outside_index), and a click waits for the answer.
  • a_settled_row_swipes_back_to_active waits for the shelf's page from its real host.

A failure these exposed and the change fixes: an open thread the new index does not carry was closed as gone. It now stays until the host answers for it.

docs/remote.md said a conversation opens on its latest 200 records; BASELINE_RECORDS is 400.

Merge Danger

Door: two-way

The store is untouched; reverting restores the old snapshot.

Blast Radius: wire

The wire changes under PROTOCOL_VERSION 34, noted under Unreleased. A v0.5.2 client on a host built from this shows empty Settled shelves; a client built from this cannot decode a v0.5.2 host's index summary. A thread settled a moment ago shows on its shelf one round trip after the shelf opens. The phone's Arrange threads page lists the settled threads its shelf has read.

The index snapshot carried every unarchived thread. On a machine with
6369 of them, 1975 of 1990 listed threads settled and the rest what
they started, that was a 6.2 MB line on every connect, and a phone
reconnects on every return to the foreground.

The snapshot now carries the threads that descend from no settled
thread. The summary counts each project's settled threads and dates
each project by the threads left out. A Settled shelf reads its rows
from the host, ten when it opens and twenty-five for each Show more;
opening a thread outside the index reads it with what it started; the
palette and the composer's @ menu ask the host for the settled threads
a title names. After the snapshot the topic still carries every
thread's changes. A client holds what it read beside the index, reads
it again after a reconnect, and fingerprints only what the index
carries, so an unchanged index is still answered as unchanged.

On that machine's data the snapshot is 221 KB and 246 threads.

docs/remote.md said a conversation opens on its latest 200 records;
the code reads 400.
@Tryanks
Tryanks merged commit 2626dc5 into main Nov 28, 2026
13 checks passed
@Tryanks
Tryanks deleted the claude/index-settled-pages branch November 28, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant