Hook DiffStateModel to remote server#10470
Conversation
DiffStateModel to remote server
6d72bb7 to
56a3a62
Compare
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds server-side diff-state models, proto conversions, subscriptions, and remote-client event forwarding for diff-state snapshots and deltas.
Concerns
- New
GetDiffStaterequests can be left pending forever when repo detection does not produce aLocalDiffStateModelevent. - Immediate snapshots for already-loaded models drop
content_at_head, so later subscribers do not receive the same renderable diff data as the initial async load.
Security
DiscardFilesforwards client-supplied file paths into destructive git restore/clean/stash behavior without validating that every path is repo-relative and contained by the requested repo.
Verdict
Found: 0 critical, 3 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
d837ed7 to
04a8618
Compare
d72a06a to
faad40b
Compare
1f57582 to
7e9e78e
Compare
faad40b to
527e04a
Compare
7e9e78e to
f4013d8
Compare
527e04a to
672bfdb
Compare
5b7dab4 to
f90b9ce
Compare
|
/oz-review |
|
I'm re-reviewing this pull request in response to a review request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds server-side diff-state subscriptions, proto conversions, and discard-files handling for remote environments.
Concerns
DiscardFilesResponsereports success before the async git operation completes, so failures are only logged and the client can present a false success state.- Client-controlled discard inputs need stronger validation before they reach destructive git operations.
- Manual testing is required for changes that can be manually tested. Please include screenshots or a screen recording that show the remote diff/discard flow working end to end, or justify why manual testing is not possible.
Security
- Renamed-file
old_pathandbranch_nameare accepted from the client without enough validation before being passed into git restore/checkout paths.
Verdict
Found: 0 critical, 3 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| m.discard_files(file_infos, msg.should_stash, msg.branch_name, ctx); | ||
| }); | ||
|
|
||
| HandlerOutcome::Sync(server_message::Message::DiscardFilesResponse( |
There was a problem hiding this comment.
discard_files only logs failures, so clients can report a successful discard while files remain unchanged. Keep the request pending until the git result and return an error on failure.
There was a problem hiding this comment.
The current request and response set up is closer to an ack than an actual success - this follows the local model which currently also doesn't handle success or errors. Alternatively, can update this to a fire and forget client message - don't have a strong opinion for this
| conn_id: ConnectionId, | ||
| ctx: &mut ModelContext<Self>, | ||
| ) -> HandlerOutcome { | ||
| let Some(mode_proto) = &msg.mode else { |
There was a problem hiding this comment.
Mode should never be empty no? Should we enforce that in the proto schema?
| .iter() | ||
| .filter(|(_, conns)| conns.contains(&conn_id)) | ||
| .map(|(key, _)| key.clone()) | ||
| .collect_vec(); |
There was a problem hiding this comment.
Do we need to collect here?
b518a57 to
440c76e
Compare
## Description * Built on #10428 * Adds the server-side changes to support `DiffStateModel` and git states on remote environments * Adds type conversions * Adds a `GlobalDiffStateModel` to track each `LocalDiffStateModel` per `repo_path`, `diff_mode` * Adds subscription to repositories to send server messages * Adds handlers for client messages ## Linked Issue [APP-4355](https://linear.app/warpdotdev/issue/APP-4355/hook-up-diffstatemodel-to-remote-server) ## Testing No-op ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
## Description * Built on #10428 * Adds the server-side changes to support `DiffStateModel` and git states on remote environments * Adds type conversions * Adds a `GlobalDiffStateModel` to track each `LocalDiffStateModel` per `repo_path`, `diff_mode` * Adds subscription to repositories to send server messages * Adds handlers for client messages ## Linked Issue [APP-4355](https://linear.app/warpdotdev/issue/APP-4355/hook-up-diffstatemodel-to-remote-server) ## Testing No-op ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
## Description * Built on #10470 * Adds client-side wiring to support git states and the code review view in remote environments * Moves shared types out of `LocalDiffStateModel` * Updates `RemoteDiffStateModel` with real logic to handle and emit the server events * Update `RemoteServerManager` to handle server events and send client events * Note: UI for reconnection is still tbd ## Linked Issue [APP-4356](https://linear.app/warpdotdev/issue/APP-4356/create-remotediffstatemodel-for-the-client) ## Testing Should be no-op. Confirmed all unit tests are passing as expected. - [x] I have manually tested my changes locally with `./script/run` ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
Description
DiffStateModel#10428DiffStateModeland git states on remote environmentsGlobalDiffStateModelto track eachLocalDiffStateModelperrepo_path,diff_modeLinked Issue
APP-4355
Testing
No-op
Agent Mode