zcode 0.1.34: a gift plan that starts later is named with its start, and gift buckets beside a Coding Plan carry their plan's name
windy (Discord): "添加zcode供应商的时候,好像无法区分Coding Plan 和Start Plan的额度?
例如今天23点要生效的Start Plan就没显示".
- A plan on /billing/balance whose starts_at is still to come serves
nothing yet: startPlan no longer routes to it (an "active" plan with a
future start would have been), and its buckets don't count. The card
names it in an aside line "ZCode gift plan not started yet", display
"<plan> · <start in local time>", soonest first.
- A coding account with a ZCode session reads the gift on every card
read, not only while a gift is live, so a coming plan shows beside the
Coding Plan. The route cache is read again when the coming plan starts.
- A gift-only account whose only plan starts later gets a card with that
line instead of "ended or never started".
- Beside a Coding Plan, every gift bucket is prefixed with its plan's
name ("Start Plan · GLM-5.1-Trial"), one plan or several.
Not known: which status ZCode gives a plan that hasn't started. The
fixtures use starts_at as the real balance/preview replies carry it
(Unix seconds) and try both "active" and an unknown status word; any
status but "expired" with a future starts_at is taken as coming. No
real account with a pending plan was read.
Run on mote: HOME=$(mktemp -d) bun test in packages/zcode, 142 pass
0 fail; pending.test.mjs under TZ=UTC, Pacific/Kiritimati and
America/Los_Angeles, 7 pass each; bun scripts/check.mjs, every package
ok. Broken by hand: with the old index.mjs, 6 of pending.test.mjs's 7
tests fail (the 7th, a plan whose start has come, passes on both).
This commit is contained in:
@@ -467,7 +467,7 @@ test("a coding account's line goes after its coding and gift windows", async ()
|
||||
const auth = oauth({ site: "zai", key: "k", jwt: token, device: "d" })
|
||||
const u = await usage(auth)
|
||||
expect(u.plan).toBe("GLM Coding Pro")
|
||||
expect(u.windows.map((w) => w.name)).toEqual(["5 hours", "GLM-5.1-Trial", "Gift plans to claim in the ZCode app"])
|
||||
expect(u.windows.map((w) => w.name)).toEqual(["5 hours", "Start Plan · GLM-5.1-Trial", "Gift plans to claim in the ZCode app"])
|
||||
expect(u.windows.at(-1)).toEqual(TRUST_BUILD)
|
||||
expect(calls.filter((c) => c.url.pathname.endsWith("/preview"))).toHaveLength(1)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user