Skip to content

git: give a deleted file's PATCH_FILE record no new path - #131

Open
jsegaran wants to merge 1 commit into
yas-run:mainfrom
indent-com:fix/git-patch-deleted-file-path
Open

jsegaran wants to merge 1 commit into
yas-run:mainfrom
indent-com:fix/git-patch-deleted-file-path

Conversation

@jsegaran

Copy link
Copy Markdown
Collaborator

A structured PATCH (no PATCH_TEXT) that contains a deleted file ends the client's native session. The server logs reliable frame handler failed: class=Request family=49 kind=4 and the client gets EOF. Any left endpoint with a file the right side lacks triggers it: commit→EMPTY, INDEX→commit, WORKTREE→INDEX after an rm, and so on.

Cause: the engine's PATCH_FILE record takes new_path from change_new_path, which is the change's path whether or not a new side exists. A deletion therefore arrives as DELETED with both paths set. PatchFileRecord::validate requires new_path to be absent for DELETED, so encode_typed() fails in query_git (crates/server/src/yas.rs) and its map_err(|_| ())? ends the session.

record_new_path mirrors record_old_path: no new side, no new path. Additions and modifications are unchanged.

structured_patch_of_a_deletion_encodes (server adapter) takes an INDEX→WORKTREE patch of a removed file. It expects DELETED with only old_path, and checks that each record encodes as query_git would. Before this change it fails because new_path is Some("gone.txt").

Found by differential fuzzing of the Git family over a native session.

cargo test -p yas-server --lib, cargo test -p yas-git --test engine, cargo clippy -p yas-git -p yas-server --all-targets -- -D warnings and cargo fmt --check pass.

View in Indent
Tag @indent to continue the conversation here.

@ultimator-ai ultimator-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimator's review of a60ddf2

Approved at a60ddf2: deleted files now emit an absent PATCH_FILE new path, matching the typed wire validator without changing content-read paths or records for files with a new side. The regression covers INDEX→WORKTREE deletion and typed encoding of the returned records; no issues found. Exact-head CI is not yet verified: package-crates is running and the other ten checks are queued; no local checks were run.

No issues found.

Reviewed in 1m 39s · Session · @ultimator-ai review reviews again · @ultimator-ai fix fixes the open issues

@indent
indent Bot force-pushed the fix/git-patch-deleted-file-path branch from de24760 to 6bfef1e Compare October 25, 2026 20:47

This branch has not been deployed

No deployments
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