fix: keep approval batching internal
CI / Client installer (macos-latest) (push) Canceled after 0s
CI / Client installer (ubuntu-latest) (push) Canceled after 0s
CI / Client installer (windows-latest) (push) Canceled after 0s
CI / test (22) (push) Canceled after 0s
CI / test (24) (push) Canceled after 0s
CI / release-smoke (push) Canceled after 0s
CI / Client installer (macos-latest) (push) Canceled after 0s
CI / Client installer (ubuntu-latest) (push) Canceled after 0s
CI / Client installer (windows-latest) (push) Canceled after 0s
CI / test (22) (push) Canceled after 0s
CI / test (24) (push) Canceled after 0s
CI / release-smoke (push) Canceled after 0s
This commit is contained in:
+11
-9
@@ -209,7 +209,7 @@ test("selectionId processes exactly the confirmed live result set and rejects dr
|
||||
assert.equal(writes, 2);
|
||||
});
|
||||
|
||||
test("todo lists explicitly describe the fixed 20-item batch policy", async () => {
|
||||
test("todo lists keep transport batch policy internal", async () => {
|
||||
const user = { userId: "user-1" };
|
||||
const manyDing = {
|
||||
async listMyTodos() {
|
||||
@@ -219,21 +219,23 @@ test("todo lists explicitly describe the fixed 20-item batch policy", async () =
|
||||
},
|
||||
} as unknown as ApprovalService;
|
||||
const overflow = await new UnifiedApprovalService({ ...config(), batchLimit: 99 }, manyDing).listTodos(user, "dingtalk", 30);
|
||||
assert.deepEqual(overflow.batchPolicy, {
|
||||
maxItemsPerCall: 20,
|
||||
selectionAvailable: false,
|
||||
selectionUnavailableReason: "result_exceeds_batch_limit",
|
||||
overflowGuidance: "一次最多处理 20 条。超过时可从同一次列表结果中选取 approvalId 分组提交;每组仍须经用户明确授权。",
|
||||
});
|
||||
assert.equal(overflow.returned, 21);
|
||||
assert.equal("selectionId" in overflow, false);
|
||||
assert.equal("selectionUnavailableReason" in overflow, false);
|
||||
assert.equal("selectionHint" in overflow, false);
|
||||
assert.equal("batchPolicy" in overflow, false);
|
||||
|
||||
const emptyDing = { async listMyTodos() { return { items: [] }; } } as unknown as ApprovalService;
|
||||
const empty = await new UnifiedApprovalService(config(), emptyDing).listTodos(user, "dingtalk", 10);
|
||||
assert.equal(empty.batchPolicy.selectionUnavailableReason, "empty_result");
|
||||
assert.equal("selectionId" in empty, false);
|
||||
assert.equal("selectionUnavailableReason" in empty, false);
|
||||
assert.equal("batchPolicy" in empty, false);
|
||||
|
||||
const xftUnavailable = { async listMyTodos() { throw new Error("XFT unavailable"); } };
|
||||
const partial = await new UnifiedApprovalService(config(), manyDing, xftUnavailable as never).listTodos(user, "all", 1);
|
||||
assert.equal(partial.batchPolicy.selectionUnavailableReason, "requested_source_unhealthy");
|
||||
assert.equal("selectionId" in partial, false);
|
||||
assert.equal("selectionUnavailableReason" in partial, false);
|
||||
assert.equal("batchPolicy" in partial, false);
|
||||
});
|
||||
|
||||
test("combined todo lists are deterministic regardless of source response timing", async () => {
|
||||
|
||||
Reference in New Issue
Block a user