From f980f9a489b2462b8291989c312d912aaff26417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Br=C3=A4mer?= <22003767+robinbraemer@users.noreply.github.com> Date: Mon, 14 Sep 2026 14:02:58 +0200 Subject: [PATCH] test(cli): cover custom-method path regressions Rationale: The system-level URL template fix is already on main, but Product Quality found that the released CLI still crashes specifically on operations.wait. Pin the exact action path and its nested counterpart so a future generated-client or Effect patch cannot reinterpret literal custom-method suffixes as parameters.\n\nRejected: Changing generated code again would duplicate the already-merged path compiler correction.\n\nTested: bun run test -- test/generated-command.test.ts --testNamePattern='operations\.wait|refreshCapabilities'; mise run check; git diff --check. --- test/generated-command.test.ts | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/generated-command.test.ts b/test/generated-command.test.ts index 296860e..9827d90 100644 --- a/test/generated-command.test.ts +++ b/test/generated-command.test.ts @@ -229,6 +229,54 @@ describe("generated public commands", () => { expect(result.data).toEqual(quotas); }); + test("operations.wait preserves its literal custom method suffix", async () => { + let received: Request | undefined; + const operation = clusterOperation(); + const result = await runGenerated( + "operations.wait", + ["--input", "-"], + JSON.stringify({ path: { id: "op:123" }, query: { timeout: 60 } }), + (input, init) => { + received = new Request(input, init); + return Promise.resolve(Response.json(operation)); + }, + ); + + expect(result.data).toEqual(operation); + expect(received?.method).toBe("POST"); + expect(received?.url).toBe( + "https://api.akua.dev/v1/operations/op%3A123:wait?timeout=60", + ); + }); + + test("clusters.refreshCapabilities preserves a nested literal custom method suffix", async () => { + let received: Request | undefined; + const operation = clusterOperation(); + const result = await runGenerated( + "clusters.refreshCapabilities", + ["--input", "-"], + JSON.stringify({ + path: { id: "clu:123" }, + headers: { + "akua-context": "ws_123", + "idempotency-key": "refresh-once", + }, + }), + (input, init) => { + received = new Request(input, init); + return Promise.resolve(Response.json(operation, { status: 202 })); + }, + ); + + expect(result.data).toEqual(operation); + expect(received?.method).toBe("POST"); + expect(received?.url).toBe( + "https://api.akua.dev/v1/clusters/clu%3A123/capabilities:refresh", + ); + expect(received?.headers.get("akua-context")).toBe("ws_123"); + expect(received?.headers.get("idempotency-key")).toBe("refresh-once"); + }); + test("clusters.resume builds the literal :action-suffixed request path", async () => { let received: Request | undefined; const operation = clusterOperation();