fix(core): authorize patch move destinations (#38133)

This commit is contained in:
Aiden Cline 2026-07-21 12:18:23 -05:00 committed by GitHub
commit dbfbb13ccc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 58 additions and 4 deletions

View file

@ -351,6 +351,28 @@ describe("PatchTool", () => {
),
)
it.live("includes the move destination in edit permission resources", () =>
withTempTool((directory, registry) =>
Effect.gen(function* () {
const source = path.join(directory, "old", "name.txt")
yield* Effect.promise(() => fs.mkdir(path.dirname(source), { recursive: true }))
yield* Effect.promise(() => fs.writeFile(source, "old content\n"))
yield* executeTool(
registry,
call(
"*** Begin Patch\n*** Update File: old/name.txt\n*** Move to: renamed/dir/name.txt\n@@\n-old content\n+new content\n*** End Patch",
),
)
expect(assertions).toMatchObject([
{
action: "edit",
resources: ["old/name.txt", "renamed/dir/name.txt"],
},
])
}),
),
)
it.live("inserts lines with an insert-only hunk", () =>
withTempTool((directory, registry) =>
Effect.gen(function* () {