routing: a prepaid wallet's row tells only its total, not the windows that expire first
TL;DR
After #3950 a prepaid wallet can be one balance window, and a plugin can add aside detail windows (today's / timed / permanent). The Usage card shows those, but the Routing page's account row shows only the total: Weighed carries one Balance/Unit and no window detail. For SuperMagic the row reads 剩余 6,291 积分 while 185 of it expires at 23:59 today; a user routing by “who has what left” cannot see the daily batch at all.
Where the data stops today
- The plugin sends
积分余额(balance,unit) plus今日 / 限时 / 永久asasidedisplay rows;magpie-magicrew-authcommitdaca18edoes this. quotaOfPlugin(internal/provider/plugin_usage.go) keeps each window'sDisplay,Balance,RunsOutAt,RunsOut.allowanceOf(internal/provider/routing.go) skipsAside/Textwindows whole, so the detail rows never becomeprovider.Limit.weighRouted(internal/gateway/routing.go) stores onlyleft.bal,left.balUnit,left.balInfromAllowance.Left(model), which is the least balance of windows that tell one.Weighed(internal/gateway/trace.go) carries only oneBalance/Unit; the Routing UI has nothing else to render.- Result: Usage card shows all four rows; Routing row shows only the total.
Suggested shape
Minimal, without changing routing semantics:
provider.Limit: keep the window'sDisplay(andRunsOut/RunsOutAt) when it is the balance window.provider.Allowance: expose aBalanceDetail(or a small[]Limitof the aside detail rows) besideLeft;allowanceOfmust not drop those rows for display.gateway.left: carrybalDetailalongsidebal/balUnit.trace.Weighed: addBalanceDetail(orNotes []string) to the JSON.internal/gui/assets/plugins/routing/client.js: append it to the balance row/tooltip — at least the earliest expiring balance + date, e.g.剩余 6,291 积分 · 185 今日 23:59 到期; ideally the full今日 / 限时 / 永久lines when space allows.
The plugin side is ready; this is the host-side surface that was missing from #3950.
Test plan
- Go: a plugin usage with one balance + three aside rows round-trips into
QuotaWindow/Allowance/Weighedwith the detail preserved; a wallet with no aside rows still reads as before. - GUI: a Routing fixture with a wallet balance and detail rows shows the total and the earliest expiry (and/or the three lines) on the account row; a share account is unchanged.
- The existing
routing-wallet-balanceandusage-wallet-balancetests stay green.
v0.1.1817(5ced5b1aa)已修:
- 路由页上钱包类账号那一行,现在除了总余额,还会写出最先到期的那部分,和用量页卡片一样。用你插件的数据就是「剩余 6,291 积分 · 185 积分 将于 23:59 过期」。
- 另外说明一下:在这之前,路由页其实已经显示了今日 / 限时 / 永久这几行,鼠标停在那一行上的提示里有,账号列表里每个账号下面的小字里也有,用的都是用量页同一份数据。之前缺的只是那一行本身的文字。
- 路由的权重还是只看总余额。今日 / 限时 / 永久这几行只用来显示。
我们没有 SuperMagic 账号,测试用的是你插件(daca18e)发出的窗口数据。更新后如果还有哪里和用量页对不上,请在这里说一声,这个 issue 先开着。
Confirmed on magpie 0.1.1969 (Windows), on both halves — the data and the code.
The data still arrives in the shape this issue assumed. Read live from /v1/magpie/quotas on this machine, the SuperMagic account that matters here is:
{"name":"积分余额","balance":1682,"unit":"积分","runsOut":184,
"runsOutAt":"2026-10-29T15:59:59Z","display":"1,682 积分"}
{"name":"今日积分","unit":"积分","text":true,"display":"184 / 200 积分 · 今日 23:59 到期"}
{"name":"限时积分","unit":"积分","text":true,"display":"498 积分 · 最早 2026-11-27 到期"}
{"name":"永久积分","unit":"积分","text":true,"display":"1,000 积分"}
(The plugin is 0.3.42 now, not the daca18e I filed against; the window shape has not changed.)
5ced5b1aa reads as you describe. quota() calls lapses(w) for a wallet seat, which looks up cardOf(w).windows for the window whose balance and unit match the seat, then appends runsOutText. Routing still weighs the total only, exactly what I asked for.
What I did not verify: the window itself. This is a Windows WebView2 build and I have no screenshot of the Routing page with those four rows. My confirmation is the code path plus the data it reads, not the pixels. If you want a screenshot before closing, say so; otherwise treat this as confirmed as far as I can check it here.
One observation rather than a complaint: lapses() returns nothing when the page is showing a kept day (const ws = day ? [] : …). That matches winsOf — a kept day's figures were read earlier and are not live — so the row loses the lapse text in the history view only. I read that as intended.
关门依据:5ced5b1aa 已在 0.1.1969 上核过——quota() 对钱包座位调 lapses(w),按 cardOf(w).windows 匹配 balance+unit 后追加 runsOutText;同一台机器的 /v1/magpie/quotas 仍按四行送(积分余额 / 今日积分 / 限时积分 / 永久积分)。窗口像素没截图,按代码路径+活数据确认。