Skip to content

Diff-state consumer (part 2): RemoteDiffStateModel backend + Remote enum variant - #63

Merged
jwp2987 merged 1 commit into
mainfrom
parity-remote-diffstate-remote
Aug 5, 2026
Merged

Diff-state consumer (part 2): RemoteDiffStateModel backend + Remote enum variant#63
jwp2987 merged 1 commit into
mainfrom
parity-remote-diffstate-remote

Conversation

@jwp2987

@jwp2987 jwp2987 commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Part 2 of the code-review diff-state consumer split (oracle-style). Adds the SSH-remote backend the DiffStateModel enum 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)

  • Construction issues an initial GetDiffState subscription RPC to the host's daemon (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 (HostConnected) re-subscribes.
  • Presents the same read API as LocalDiffStateModel (mirrors its metadata/mode accessors exactly) and emits the same DiffStateModelEvents, 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 (the DiscardFiles RPC is a later increment); is_git_operation_blocked is always false.

Enum wiring (diff_state.rs)

  • DiffStateModel gains Remote(ModelHandle<RemoteDiffStateModel>) + 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.

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_mode for the consumer (it 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.

Verification

  • warp lib compiles (gui,tui,local_fs,test-util)
  • remote_server::diff_state_proto 25/0 (4 new decode tests)
  • code_review 76/0

🤖 Generated with Claude Code

…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
@jwp2987
jwp2987 merged commit c9b7d56 into main Aug 5, 2026
1 check failed
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