From 2d59003f8eefff125b9ad7746797416839e64ab3 Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 25 Oct 2026 14:38:06 +0800 Subject: [PATCH] zcode: the team seat's request test uses a key of its own start.test.mjs's "a team seat's request goes as the agent sent it" used key "team.secret", the same as team-gift.test.mjs. In one bun test process the two files share index.mjs's routes cache (key + jwt), and when both jwts were built in the same second the seat test read team-gift's cached route, skipped the billing/balance read and saw 1 request where it expects 2. That kept publish.yml red since ba343b8, so zcode 0.1.28 (and every other package) never published. Run: with both files' jwt exp pinned to one value, `bun test ./team-gift.test.mjs ./start.test.mjs` fails the seat test on the old key and passes 19/19 with "seat.secret". Whole-repo `bun test` (HOME under TMPDIR, as CI): zcode all pass; the 20 reds are gcp-ai's, which another session is fixing. `bun scripts/check.mjs` ok. --- packages/zcode/start.test.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/zcode/start.test.mjs b/packages/zcode/start.test.mjs index 634ab73..a6ac802 100644 --- a/packages/zcode/start.test.mjs +++ b/packages/zcode/start.test.mjs @@ -383,13 +383,13 @@ test("a GLM Coding Plan key's request goes as the agent sent it", async () => { }) test("a team seat's request goes as the agent sent it, ZCode's token or not", async () => { - const s = { site: "zai", base: "https://api.z.ai/api/anthropic", key: "team.secret", token: "tok", org: "o1", project: "p1", jwt, device: DEVICE } + const s = { site: "zai", base: "https://api.z.ai/api/anthropic", key: "seat.secret", token: "tok", org: "o1", project: "p1", jwt, device: DEVICE } const auth = { type: "oauth", access: s.key, refresh: JSON.stringify(s), expires: 0 } - sentAsIs(await send(auth, agentText, { requests: 2 }), "team.secret", "/api.z.ai/api/anthropic/v1/messages") + sentAsIs(await send(auth, agentText, { requests: 2 }), "seat.secret", "/api.z.ai/api/anthropic/v1/messages") expect(got.filter((r) => r.path.endsWith("/billing/balance"))).toHaveLength(1) expect(got.filter((r) => r.path.endsWith("/subscription/list"))).toHaveLength(0) got.length = 0 - sentAsIs(await send({ ...auth, refresh: JSON.stringify({ ...s, jwt: "" }) }, agentText), "team.secret", "/api.z.ai/api/anthropic/v1/messages") + sentAsIs(await send({ ...auth, refresh: JSON.stringify({ ...s, jwt: "" }) }, agentText), "seat.secret", "/api.z.ai/api/anthropic/v1/messages") expect(got).toHaveLength(1) })