Diff-state over SSH: live push on repository change - #64
Merged
Conversation
Completes the daemon side of code-review diff-state over SSH: after the initial subscribe snapshot, the daemon now pushes fresh snapshots as the repository changes, so a remote code-review view stays live. - ServerModel gains a per-connection subscription registry (diff_state_subscriptions: conn -> Vec<DiffStateSubscription>). Each subscription stores the canonicalized repo path (matched against repository change events) and the exact wire path string the client sent (echoed in pushed snapshots so the client's RemoteDiffStateModel keys on it). - handle_get_diff_state registers the subscription after computing the initial snapshot; handle_unsubscribe_diff_state removes it; deregister_connection drops all of a connection's subscriptions on teardown. - On RepoMetadataEvent::RepositoryUpdated (the daemon already subscribes to it), push_diff_state_for_repo recomputes and pushes a DiffStateSnapshot (no request_id — an unsolicited push, handled by the client's push_message_to_event) to every connection subscribed to that repo. - The subscribe reply and the live push share snapshot_from_parts (in diff_state_proto) so the Loaded/Error/NotInRepository decision is identical. MetadataUpdate / FileDelta (finer-grained, debounced) pushes remain available on the wire for a future optimization; RepositoryUpdated-driven full snapshots are the correct, debounce-free baseline. Verified: warp lib compiles (gui,tui,local_fs,test-util); remote_server 46/0 (incl. new snapshot_from_parts test), code_review 76/0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012gDYSHa4oDvQbfungWwG1h
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.
Completes the daemon side of code-review diff-state over SSH. After the initial subscribe snapshot (PR #61), the daemon now pushes fresh snapshots as the repository changes, so a remote code-review view stays live.
What changed
ServerModelgains a per-connection subscription registry (diff_state_subscriptions: conn -> Vec<DiffStateSubscription>). Each subscription stores the canonicalized repo path (matched against repository-change events) and the exact wire path string the client sent (echoed in pushed snapshots so the client'sRemoteDiffStateModelkeys on it).handle_get_diff_stateregisters the subscription after computing the initial snapshot;handle_unsubscribe_diff_stateremoves it;deregister_connectiondrops all of a connection's subscriptions on teardown.RepoMetadataEvent::RepositoryUpdated(the daemon already subscribes to it),push_diff_state_for_reporecomputes and pushes aDiffStateSnapshot(norequest_id— an unsolicited push, handled by the client'spush_message_to_event) to every connection subscribed to that repo.snapshot_from_partsso the Loaded/Error/NotInRepository decision is identical.MetadataUpdate/FileDelta(finer-grained, debounced) pushes remain available on the wire for a future optimization;RepositoryUpdated-driven full snapshots are the correct, debounce-free baseline.Verification
warplib compiles (gui,tui,local_fs,test-util)remote_server46/0 (incl. newsnapshot_from_partstest)code_review76/0Note
This makes the manager
DiffState*Receivedpush events (wired in PR #61) live end-to-end once the remote consumer is constructed. The remaining piece — wiring remote repos into the code-review pane (increment 5c) — carries a design decision and is left for the maintainer.🤖 Generated with Claude Code