fix: report nested workspace conflicts
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user