fix: report nested workspace conflicts

This commit is contained in:
2026-08-04 07:05:51 +02:00
parent 234b40e7cf
commit 8effdc6c89
6 changed files with 225 additions and 2 deletions
@@ -30,6 +30,18 @@ const conflict: WorkspaceConflict = {
remote: { ...workspace, semantic_index: { ...workspace.semantic_index, embedding: { ...workspace.semantic_index.embedding, model: "remote-model" } } },
};
const diagnosticsBranchConflict: WorkspaceConflict = {
...conflict,
fields: ["diagnostics.dwh_rest"],
base: workspace,
remote: workspace,
local: {
...workspace,
dwh: { ...workspace.dwh, supported_transports: ["postgres_direct", "rest_api"] },
diagnostics: { dwh_rest: { method: "GET", path: "/health", auth: "none", response: { database: "database", schema: "schema" } } },
},
};
beforeEach(() => {
server.use(http.post("http://localhost:8787/workspaces/validate", () => HttpResponse.json({ workspace, contract: {} })));
});
@@ -101,6 +113,26 @@ test("saves explicit local choices as a rebased draft and does not republish it"
expect(publishCalls).toBe(1);
});
test("rebases a selected optional diagnostics branch into the revised draft", async () => {
const user = userEvent.setup();
const saved = vi.fn();
server.use(http.post("http://localhost:8787/workspaces/publish", () => HttpResponse.json({
...diagnosticsBranchConflict, message: "Workspace changed in the registry.",
}, { status: 409 })));
render(<WorkspacePublishDialog open request={request} onOpenChange={vi.fn()} onPublished={vi.fn()} onResolved={saved} onPull={vi.fn()} onReload={vi.fn()} />);
await user.click(screen.getByRole("button", { name: "Validate draft" }));
await user.click(await screen.findByRole("button", { name: "Publish" }));
await user.click(screen.getByRole("button", { name: "Confirm publish" }));
await user.click(await screen.findByRole("radio", { name: "Use your draft for diagnostics.dwh_rest" }));
await user.click(screen.getByRole("button", { name: "Save revised draft" }));
expect(saved).toHaveBeenCalledWith(expect.objectContaining({
baseCommit: "c".repeat(40), baseBlob: "d".repeat(40),
workspace: expect.objectContaining({ diagnostics: diagnosticsBranchConflict.local.diagnostics }),
}));
});
test("keeps a conflict open and redacts a failed registry pull", async () => {
const user = userEvent.setup();
server.use(http.post("http://localhost:8787/workspaces/publish", () => HttpResponse.json({