Compare commits

...
1 Commits
Author SHA1 Message Date
Brendan Allan 73896b78fc fix(app): route review diffs through workspace 2026-08-10 16:46:13 +08:00
3 changed files with 28 additions and 3 deletions
+13 -3
View File
@@ -676,9 +676,16 @@ export default function Page() {
const mode = reviewMode()
if (mode === "git" || mode === "branch") return mode
})
const vcsWorkspace = createMemo(() => info()?.workspaceID)
const vcsKey = createMemo(
() =>
["session-vcs", sdk().directory, sync().data.vcs?.branch ?? "", sync().data.vcs?.default_branch ?? ""] as const,
[
"session-vcs",
sdk().directory,
vcsWorkspace() ?? "",
sync().data.vcs?.branch ?? "",
sync().data.vcs?.default_branch ?? "",
] as const,
)
const vcsQuery = createQuery(() => {
const mode = vcsMode()
@@ -690,7 +697,10 @@ export default function Page() {
queryFn: mode
? () =>
sdk()
.api.vcs.diff({ location: { directory: sdk().directory }, mode: mode === "git" ? "working" : mode })
.api.vcs.diff({
location: { directory: sdk().directory, workspace: vcsWorkspace() },
mode: mode === "git" ? "working" : mode,
})
.then((result) => result.data)
.catch((error) => {
console.debug("[session-review] failed to load vcs diff", { mode, error })
@@ -739,7 +749,7 @@ export default function Page() {
queryFn: () =>
sdk()
.api.vcs.diff({
location: { directory: scope },
location: { directory: scope, workspace: vcsWorkspace() },
mode: mode === "git" ? "working" : mode,
context,
})
@@ -184,6 +184,20 @@ describe("createCompatibleApi", () => {
expect(url.searchParams.get("limit")).toBe("20")
})
test("routes V1 diffs through the requested workspace", async () => {
const { api, requests } = setup("v1")
await api.vcs.diff({
location: { directory: "/repo", workspace: "workspace-1" },
mode: "working",
})
const url = new URL(requests[0]!.url)
expect(url.pathname).toBe("/vcs/diff")
expect(url.searchParams.get("directory")).toBe("/repo")
expect(url.searchParams.get("workspace")).toBe("workspace-1")
expect(url.searchParams.get("mode")).toBe("git")
})
test("routes V1 permission replies through the requested directory", async () => {
const { api, requests } = setup("v1")
await api.permission.reply({
+1
View File
@@ -344,6 +344,7 @@ function createV1Api(input: CompatibleInput): CompatibleApi {
const result = await legacy(value.location).vcs.diff({
mode: value.mode === "working" ? "git" : value.mode,
context: value.context,
workspace: value.location?.workspace,
})
return located(
(result.data ?? []).map((file) => ({