Repository navigation
fix(rpc): refuse move_session copy ids the parser let through (#5930) - #6217
Open
surlymochan wants to merge 2 commits into
Open
surlymochan wants to merge 2 commits into
surlymochan wants to merge 2 commits into
Conversation
…5930) - parseCopy now applies the same id rule forkFrom applies, so an id ending in '.', '_' or '-' is refused with invalid_move_request before anything is written instead of failing as move_failed. - forkFrom validates the id before creating the target folder, so a rejected fork no longer leaves an empty folder behind. - copySessionAs refuses any id named by a session_id of an ownership entry the source inherited, so copying a copy back under an older id no longer answers success for a copy that refuses every write. - docs/rpc.md copy paragraph updated in the same increment. fixes code-yeongyu#5930
Owner
|
Thanks @surlymochan, approved. One note for later, not blocking: |
This branch has not been deployed
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.
Follow-up to #5920 (part 2 of #5889,
move_sessionopcopy). Fixes #5930 — both review LOWs recorded there instead of folded after the CLEAR.What changed
session-move-request.ts(parseCopy): the copysessionIdnow passes the same ruleforkFromapplies (assertValidSessionId), in addition toisPlainId. An id ending in.,_or-(e.g.copy-,a.) is refused withinvalid_move_requestbefore anything is written, instead of passing the parser and failing asmove_failedafter the target folder was created.session-manager.ts(forkFrom): the id is validated before the target folder is created, so a rejected fork no longer leaves an empty folder behind.session-move/copy.ts+ newownershipSessionIdshelper inownership.ts: copying a copy back under an id named by asession_idof an ownership entry the source inherited is refused withinvalid_move_request. Previously only the source's own header id was refused, so the copy answeredsuccess: truebut refused every write.docs/rpc.mdcopy paragraph updated in the same increment.Tests (RED → GREEN)
New regression tests, all failing on the pre-fix code for the intended reason and passing after:
test/suite/rpc-move-session-copy.test.ts: trailing-separator idscopy-/a.added to the refusal table (pre-fix:move_failed); new copy-back test — copy a revoked import undercopy-5889, then copy that copy under the older inherited id (pre-fix:success: true).test/session-manager/custom-session-id.test.ts:forkFromwith idcopy-into a not-yet-created folder throws and the folder stays uncreated (pre-fix: folder created).bun run --cwd packages/coding-agent test test/suite/rpc-move-session-copy.test.ts test/session-manager/custom-session-id.test.ts: 21/21 passed (pre-fix: 17 passed, 4 failed).bun run check: exit 0 (lint, fmt, tsc, install-lock).Fixes #5930
Summary by cubic
Fixes three gaps in the
move_sessioncopy operation (#5930): invalid IDs ending in.,_, or-are now refused before anything is written, a rejected fork no longer leaves an empty folder behind, and copying a copy back under an older inherited ownership ID is refused instead of answeringsuccess: truefor a copy that would refuse every write.Bug Fixes
parseCopynow applies the same ID rule asforkFrom, refusing trailing-separator IDs withinvalid_move_requestinstead of failing asmove_failedafter the target folder was created.forkFromvalidates the ID before creating the target folder.copySessionAsrefuses a copy ID named by an ownership entry the source inherited.Written for commit 21ff547. Summary will update on new commits.