Diff-state consumer (part 2): RemoteDiffStateModel backend + Remote enum variant - #63
Merged
Merged
Conversation
…iant
Second half of the diff-state consumer split: the SSH-remote backend that the
DiffStateModel enum dispatches to for remote repositories.
RemoteDiffStateModel (app/src/code_review/diff_state_remote.rs):
- On construction issues an initial GetDiffState subscription RPC to the host's
daemon (via RemoteServerManager::client_for_host) and stores the returned
snapshot; subscribes to the manager push channel so later
DiffState{Snapshot,MetadataUpdate,FileDelta}Received events fold into the
stored state (filtered by host + repo_path + mode). Reconnect re-subscribes.
- Presents the same read API as LocalDiffStateModel (mirrors its
metadata/mode-based accessors exactly) and emits the same DiffStateModelEvents
(NewDiffsComputed with the base-content payload, DiffMetadataChanged,
CurrentBranchChanged), so the enum wrapper and the code-review view are
backend-agnostic.
- Mutations: set_diff_mode unsubscribes the old (repo, mode) and subscribes the
new; load_diffs re-requests; discard/refresh are daemon-owned no-ops for now
(DiscardFiles RPC is a later increment); is_git_operation_blocked is always
false (the daemon owns working-tree state).
Wiring:
- diff_state.rs: DiffStateModel gains a `Remote(ModelHandle<RemoteDiffStateModel>)`
variant + `new_remote`, and every forwarder gains a Self::Remote arm. The
Remote parts are `#[cfg(not(target_family = "wasm"))]` (native-only — the
manager is native), so wasm keeps the Local-only shape.
- diff_state_proto.rs: pub(crate) decode API for the consumer
(decode_snapshot / decode_metadata_update / decode_file_delta /
proto_to_git_diff_with_base_content / encode_diff_mode) — the model lives in
code_review and can't use the pub(super) converters. Base content
(proto content_at_base) is preserved onto FileDiffAndContent.content_at_head.
The Remote backend is not yet constructed anywhere — the remote-repo pane wiring
(working_directories keying by host/LocalOrRemotePath) is increment 5c, which
carries a design decision and is left for the maintainer.
Verified: warp lib compiles (gui,tui,local_fs,test-util); diff_state_proto
25/0 (4 new decode tests); 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.
Part 2 of the code-review diff-state consumer split (oracle-style). Adds the SSH-remote backend the
DiffStateModelenum dispatches to for remote repositories, adapted to the fork's per-host-client transport.What changed
RemoteDiffStateModel(app/src/code_review/diff_state_remote.rs)GetDiffStatesubscription RPC to the host's daemon (RemoteServerManager::client_for_host) and stores the returned snapshot; subscribes to the manager push channel so laterDiffState{Snapshot,MetadataUpdate,FileDelta}Receivedevents fold into the stored state (filtered by host + repo_path + mode). Reconnect (HostConnected) re-subscribes.LocalDiffStateModel(mirrors its metadata/mode accessors exactly) and emits the sameDiffStateModelEvents, so the enum wrapper and the code-review view are backend-agnostic.set_diff_modeunsubscribes the old(repo, mode)and subscribes the new;load_diffsre-requests; discard/refresh are daemon-owned no-ops for now (the DiscardFiles RPC is a later increment);is_git_operation_blockedis always false.Enum wiring (
diff_state.rs)DiffStateModelgainsRemote(ModelHandle<RemoteDiffStateModel>)+new_remote, and every forwarder gains aSelf::Remotearm. The Remote parts are#[cfg(not(target_family = "wasm"))](native-only — the manager is native), so wasm keeps the Local-only shape.Decode API (
diff_state_proto.rs)pub(crate)decode_snapshot/decode_metadata_update/decode_file_delta/proto_to_git_diff_with_base_content/encode_diff_modefor the consumer (it lives incode_reviewand can't use thepub(super)converters). Base content (protocontent_at_base) is preserved ontoFileDiffAndContent::content_at_head.The Remote backend is not yet constructed anywhere — the remote-repo pane wiring (
working_directorieskeying by host /LocalOrRemotePath) is increment 5c, which carries a design decision and is left for the maintainer.Verification
warplib compiles (gui,tui,local_fs,test-util)remote_server::diff_state_proto25/0 (4 new decode tests)code_review76/0🤖 Generated with Claude Code