Repository navigation
feat(native): bounded thread snapshots, history paging, conformance drift alarm, session harness - #16
Merged
Merged
Conversation
Subscribe threads with acceptBoundedSnapshot, acceptCompactTurnItems, acceptCompactIds and acceptDedupedBodies, and undo each exactly while decoding off the UI thread (withRecordIdTable, boundedSnapshotProjection, restoreSnapshotBodies, live body restore). ThreadState carries the web's history meta: a window is partial only while it has more history, and applied turn items raise the watermark. The reducer now leaves activity untouched for dropped partial updates and orders equal ordinals with localeCompare collation. History merge and the load-earlier state machine port threadHistoryMerge.ts and the loadEarlier loop.
ClientHandle fetches GET /api/orchestration/threads/:id/history with bearer auth, the protocol header and compact IDs, decoding on the network runtime (threadHistoryHttp.ts). AppState::load_older_history drives the loadEarlier loop for the open thread, paging on while a page holds no user turn. ThreadView asks for it when scrolling reaches the top rows; prepended rows splice at 0, which keeps the scroll anchored. The probe gains --history to page from the command line.
conformance/generate.ts builds synthetic scenarios, encodes them with the real server wire code (bounded snapshots, live body dedupe, ID tables, history pages), runs the real client-runtime reducers, shell reducer and history merge on what a client decodes, and writes one case per line to crates/core/tests/conformance/*.jsonl. conformance.rs replays every case through the Rust reducers and compares rows, order, positions, bodies, records, history meta and the shell. --check exits 1 when the fixtures are stale, which is the drift alarm for upstream reducer changes.
The conformance harness found that project.updated deltas and authoritative shell snapshots dropped a repository identity enrichment had already resolved, which splits multi-environment grouping until the next enrichment. Port retainRepositoryIdentity from shellReducer.ts: keep the prior identity when the update has none and the workspace root is unchanged.
An in-process server answers the ticket POST and speaks Effect RPC JSON frames over /ws on one port. Tests cover batched frames, acks that wait for room in the consumer queue, interrupt on stream drop, Defect failing every pending call, ping timeout, and reconnect resuming the shell and threads from the last delivered sequence. Fixes what it found: a Defect or protocol error now fails pending calls with the server's message instead of a bare 'connection closed', and a dropped stream releases its entry so late chunks are not buffered until the server exits it.
Intake regenerates the fixtures when --check fails and files parity:wire issues for cases that diverge. TV-HISTORY is partial with the data side and paging in place.
This was referenced Nov 2, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening a thread pulled its whole projection over the socket. On real data the largest pruned thread was a 7.8 MB snapshot (33 ms to decode in release builds), and the developer's 31 GB install has far larger ones. Nothing paged older history, nothing checked that the Rust reducers still match the web's, and the session's flow control had no tests.
Approach
Bounded snapshots (
#9, TV-HISTORY). Threads subscribe withacceptBoundedSnapshot,acceptCompactTurnItems,acceptCompactIdsandacceptDedupedBodies, asthreads.tsdoes when it can page.thread::decode_thread_stream_itemundoes each one exactly on the network runtime:withRecordIdTable)boundedSnapshotProjection), so a row and its turn item share oneArcorchestrationV2DedupedBodies.ts)acceptDeferredWorkis not adopted: collapsed work needs a transcript control the app does not have yet.History paging.
crates/core/src/history.rsportsthreadHistoryMerge.tsand theloadEarlierloop as a pure state machine: begin, merge a page, keep paging while a page holds no user turn, fail, stale.ClientHandle::history_pagefetchesGET /api/orchestration/threads/:id/history(bearer auth, protocol header, compact IDs) and decodes the page off the UI thread.AppState::load_older_history()drives the loop. Its state isstate.thread.history(has_more_history,loading,error,expanded).thread_view.rsgets a 7-line scroll hook. Prepended rows reach the list assplice(0..0, n), and that keeps the scroll anchored.Drift alarm.
apps/native/conformance/generate.tsbuilds synthetic scenarios fromorchestrationV2TestFixtures.ts, the cases inorchestrationV2Projection.test.tsandshellReducer.test.ts, id-collation ties, and 20 seeded fuzz runs. It encodes them with the real server wire code:buildBoundedThreadStreamSnapshot,makeLiveBodyDeduper, history page selection, and the contract codecs. Then it runs the real client reducers, shell reducer and history merge, and writes one case per line tocrates/core/tests/conformance/*.jsonl.crates/core/tests/conformance.rsreplays every case through the Rust code and compares rows, order, positions, bodies, records, history meta and the shell.--checkexits 1 when the fixtures are stale. Intake now runs it (native-sync skill), and it is a factory gate.Session hardening (CN-SESSION).
crates/client/src/test_server.rsis an in-process fake server: the ticket POST and Effect RPC frames over/ws, on one port. Tests cover:afterSequenceDivergences found and fixed
project.updatedand authoritative snapshots dropped a resolved repository identity (retainRepositoryIdentity)updatedAtlocaleCompare(_,-, and case all differ)hasMoreHistory: false) was treated as a partial window, so events below it were droppedReverting any of the four reducer/stream fixes makes the named conformance case fail.
Ledger
todo->partial, nativecrates/core/src/history.rs, issue#9partial. Gaps below.partial(relay, tunnel and wakeup resubscribe are not covered)Verification
cargo test -p t3-core -p t3-client,cargo clippy --workspace --all-targets -- -D warnings,node scripts/gen-theme.ts --check,node --test parity/sync.test.ts,node conformance/generate.ts --check,cargo build -p t3-native, repo lint onapps/native/conformanceReal-data server (14700, read-only):
decode_sweepdecodes all 59 threads through the bounded path, with 0 errors. Largest threads, full vs bounded snapshot (release decode):Paging walks two of them back to exactly their full counts: 1855 rows in 4 pages, 1258 rows in 3, at 18–115 ms per page.
Smoke server (14658), probe transcript on a 14-turn devReplay thread:
Gaps
MessagesTimeline.tsxTimelineHistoryControl). That rendering belongs to the transcript owner. The state is exposed instate.thread.history.acceptDeferredWork,view=work) andthroughEntryIdtargeting (find, citations) are not requested.thread.deletedstill replaces the thread instead of clearing it asthreads.tsdoes. That needs a deleted state in the view.Model: Opus 5.5 (Claude Code), worker W4.