Repository navigation
fix(native): controller-level deletion, per-op conformance, off-thread history merge - #21
Merged
Merged
Conversation
thread.deleted now does what threads.ts does: the projection and history clear, later events and pages are ignored, and a new snapshot revives the thread. The app treats a deleted open thread as missing and deselects it, as the web goes home, instead of showing the stale transcript. A history page merges on the background executor: the UI thread checks the projection out, the merge runs off-thread, and one update swaps it back and replays events that arrived meanwhile, in order. A snapshot or deletion during the merge drops it. The merge indexes the page, not the transcript, and never clones transcript ids. ThreadState::history_control and AppEvent::History expose the load-earlier control's state for the transcript view.
The oracle models deletion at the controller level, as threads.ts does, including a page that lands after the delete. Every case records the TypeScript state after each operation, interned per case, and the replay serializes the Rust state after each one and compares every field the Rust types model (now Serialize). A modeled field no fixture sends fails the run, so a misnamed or unexercised field cannot pass as null == null.
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.
Follow-up to #16, fixing the four findings from the independent review.
1. Deletion modeled at the controller level (P2)
Problem. The oracle fed
thread.deletedthrough the projection reducer. The real controller (threads.tsapplyEvent/setDeleted, and theloadEarlierpage check) intercepts it instead.Fix.
beginreturns nothing, and a new snapshot revives the thread (setThreaddoesn't checkdeleted).ThreadStatedoes the same in Rust (deleted,EventBody::ThreadDeleted).resolveThreadRouteRenderStatereturnsmissingand the route goes home. The stale transcript is no longer shown.2. Compare after every operation, every modeled field
Problem. Only final states were compared, and only a hand-picked subset of fields.
Fix.
Serialize) and compares every field the Rust types model. That includesnodeId,messageId,inputIntent, threadmodelSelection, and all item bodies and records.null == null. RenamingsenderThreadIdin Rust makes the run fail.richbuilders).shell.ts's own invariant.3. History merges off the UI thread
Problem. Pages were merged inside
this.updateon the UI thread, and the merge indexed the whole transcript and cloned ids on every page.Fix.
ThreadState::begin_history_mergechecks the projection out (a move, O(1)) and applies the history meta at that moment, as the web's single update does.HistoryMerge::runruns on the background executor.finish_history_mergeswaps the result back in one update and replays, in order, the live events that arrived meanwhile. These events arrived after the merge point in TypeScript terms too, so the ordering is exact.ThreadViewkeeps its rows:syncreturns early and the loading placeholder is suppressed. These are the onlythread_view.rsedits, 4 lines.4. History control state for the transcript (for W1)
state.thread.history_control() -> Option<HistoryControl { has_more, loading, error }>mirrorsTimelineHistoryControl:Nonehides the control. It stays up and loading while the last page is still merging, so the spinner never ends before the rows land.AppState::load_older_history()is both the click and the retry (loadEarlierclears the error).AppEvent::Historyfires on meta-only changes (begin, failure, merge start).AppEvent::Threadstill fires when rows change.Verification
cargo test -p t3-core -p t3-client,cargo clippy --workspace --all-targets -- -D warnings,node conformance/generate.ts --check,node scripts/gen-theme.ts --check,node --test parity/sync.test.ts, repo lint onapps/native/conformance,cargo build -p t3-native. Rebased onto feat(native): drive agents from the composer: new threads, pickers, approvals #20 (one additive conflict inapp_state.rs).Gaps
Model: Opus 5.5 (Claude Code), worker W4.