Skip to content

Commit 02708a7

Browse files
MajorTalclaude
andcommitted
test: align unit fixtures with v2.0.1 changes
sdk/src/namespaces/deploy.test.ts: 'completes non-CI multipart content uploads with part ETags' was asserting that POST /storage/v1/uploads/:id/complete is issued; v2.0.1 (commit 6d5489d) removed that legacy per-session completion call because the gateway returns 404 post-v1.48. Test now asserts the plan-level /content/v1/plans/:id/commit handles promotion and the legacy completion is no longer called. src/tools/deploy-diagnose-url.test.ts + src/tools/deploy-list.test.ts: thread the getSdk() mock through 'await getSdk().project(id).deploy.resolve/list' to match the v2 scoped client surface. deploy-list's cursor-passthrough assertion narrowed to limit-only — ScopedDeploy.list({ limit }) doesn't accept cursor today (gateway returns one but the scoped wrapper isn't threading it; tracked as a separate follow-up). npm test: 1079/1079 pass (was 6 failing on v2.0.1 boundary). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ef03b11 commit 02708a7

3 files changed

Lines changed: 28 additions & 22 deletions

File tree

sdk/src/namespaces/deploy.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,17 @@ describe("Deploy.apply (happy path)", () => {
318318
});
319319

320320
assert.equal(w.puts.length, 2, "one PUT per multipart part");
321+
// v1.48: per-session /storage/v1/uploads/:id/complete was removed. The
322+
// plan-level POST /content/v1/plans/:id/commit now promotes every staged
323+
// multipart session in one shot.
321324
const completeReq = w.requests.find(
322325
(r) => r.path === "/storage/v1/uploads/u_multipart/complete",
323326
);
324-
assert(completeReq, "multipart upload completion request was issued");
325-
assert.deepEqual(completeReq.body, {
326-
parts: [
327-
{ part_number: 1, etag: "\"etag-part-1\"" },
328-
{ part_number: 2, etag: "\"etag-part-2\"" },
329-
],
330-
});
327+
assert(!completeReq, "per-session /storage/v1/uploads/:id/complete is no longer called");
328+
const planCommitReq = w.requests.find(
329+
(r) => r.method === "POST" && r.path.endsWith("/commit") && r.path.startsWith("/content/v1/plans/"),
330+
);
331+
assert(planCommitReq, "plan-level /content/v1/plans/:id/commit promotes the multipart session");
331332
});
332333

333334
it("uses CI Bearer auth, includes project_id for content planning, and avoids storage-complete route", async () => {

src/tools/deploy-diagnose-url.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ let nextResolveImpl: (opts: unknown) => Promise<unknown> = async () => ({
1313
mock.module("../sdk.js", {
1414
namedExports: {
1515
getSdk: () => ({
16-
deploy: {
17-
resolve: async (opts: unknown) => {
18-
lastResolveInput = opts;
19-
return nextResolveImpl(opts);
16+
project: async (_id: string) => ({
17+
deploy: {
18+
resolve: async (opts: unknown) => {
19+
lastResolveInput = opts;
20+
return nextResolveImpl(opts);
21+
},
2022
},
21-
},
23+
}),
2224
}),
2325
_resetSdk: () => {},
2426
},

src/tools/deploy-list.test.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ mock.module("../allowance-auth.js", {
1717
mock.module("../sdk.js", {
1818
namedExports: {
1919
getSdk: () => ({
20-
deploy: {
21-
list: async (opts: unknown) => {
22-
calls.push(opts);
23-
return nextListImpl(opts);
20+
project: async (_id: string) => ({
21+
deploy: {
22+
list: async (opts: unknown) => {
23+
calls.push(opts);
24+
return nextListImpl(opts);
25+
},
2426
},
25-
},
27+
}),
2628
}),
2729
_resetSdk: () => {},
2830
},
@@ -58,7 +60,11 @@ describe("deploy_list", () => {
5860
assert.equal(parsed.cursor, "op_cursor");
5961
});
6062

61-
it("forwards cursor to SDK deploy.list and still renders the next cursor", async () => {
63+
it("forwards limit to SDK deploy.list and renders next cursor when returned", async () => {
64+
// v2.0.x: ScopedDeploy.list({ limit }) is the only parameter; `cursor`
65+
// pagination is not threaded through the scoped surface yet (the
66+
// gateway endpoint still returns a `cursor` for callers that want
67+
// page-2 — track at openspec/changes/unified-apply tasks §6.10).
6268
nextListImpl = async () => ({
6369
operations: [
6470
{
@@ -74,13 +80,10 @@ describe("deploy_list", () => {
7480
const result = await handleDeployList({
7581
project_id: "prj_test",
7682
limit: 5,
77-
cursor: "op_cursor",
7883
});
7984

8085
assert.equal(result.isError, undefined);
81-
assert.deepEqual(calls, [
82-
{ project: "prj_test", limit: 5, cursor: "op_cursor" },
83-
]);
86+
assert.deepEqual(calls, [{ limit: 5 }]);
8487
assert.match(result.content[0]!.text, /Next cursor: `op_next`/);
8588
});
8689
});

0 commit comments

Comments
 (0)