fix: harden Pi management readiness

This commit is contained in:
2026-08-05 06:20:25 +02:00
parent 7a8bcacbfe
commit 7df21b5f21
24 changed files with 577 additions and 274 deletions
@@ -43,14 +43,14 @@ const diagnosticsBranchConflict: WorkspaceConflict = {
};
beforeEach(() => {
server.use(http.post("http://localhost:8787/workspaces/validate", () => HttpResponse.json({ workspace, contract: {} })));
server.use(http.post("/api/workspaces/validate", () => HttpResponse.json({ workspace, contract: {} })));
});
test("validates a draft and requires a separate confirmation before publishing", async () => {
const user = userEvent.setup();
const published = vi.fn();
let publishCalls = 0;
server.use(http.post("http://localhost:8787/workspaces/publish", () => {
server.use(http.post("/api/workspaces/publish", () => {
publishCalls += 1;
return HttpResponse.json({ revision: { id: "psd-clinical", commit: "c".repeat(40), blob: "d".repeat(40), snapshotPath: "/safe", state: "operational" } });
}));
@@ -71,7 +71,7 @@ test("validates a draft and requires a separate confirmation before publishing",
test("shows a field-level conflict and never overwrites the remote workspace", async () => {
const user = userEvent.setup();
let published = false;
server.use(http.post("http://localhost:8787/workspaces/publish", () => {
server.use(http.post("/api/workspaces/publish", () => {
published = true;
return HttpResponse.json({ ...conflict, message: "Workspace changed in the registry." }, { status: 409 });
}));
@@ -94,7 +94,7 @@ test("saves explicit local choices as a rebased draft and does not republish it"
const user = userEvent.setup();
const saved = vi.fn();
let publishCalls = 0;
server.use(http.post("http://localhost:8787/workspaces/publish", () => {
server.use(http.post("/api/workspaces/publish", () => {
publishCalls += 1;
return HttpResponse.json({ ...conflict, message: "Workspace changed in the registry." }, { status: 409 });
}));
@@ -116,7 +116,7 @@ test("saves explicit local choices as a rebased draft and does not republish it"
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({
server.use(http.post("/api/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()} />);
@@ -135,7 +135,7 @@ test("rebases a selected optional diagnostics branch into the revised draft", as
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({
server.use(http.post("/api/workspaces/publish", () => HttpResponse.json({
...conflict, message: "Workspace changed in the registry.",
}, { status: 409 })));
render(<WorkspacePublishDialog open request={request} onOpenChange={vi.fn()} onPublished={vi.fn()} onResolved={vi.fn()} onPull={vi.fn().mockRejectedValue(new Error("token=secret"))} onReload={vi.fn()} />);