e7fbbaab9f3cd87f6ca6250f1978006bc4fd3fc7
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
396e0e4638 |
usage: a deleted provider's requests merged into another, or named, from the Requests filter
CyberCaius on Discord: a deleted provider's requests sat under its old id
("<date> 已删除"), and the only way to put them under a provider they
have was renaming that provider onto the old id. Now, with a deleted
provider picked in Usage › Requests' Provider filter, a "…" beside it
offers Merge into… (an app menu of the providers there are now) and
Rename… (the filter's button turns into a name field; Enter or leaving
it saves, Escape keeps it). With the merged-into provider picked, the
same "…" lists Separate <name> for each, the undo.
Nothing in the log is rewritten. Both live on the deletion's own record
in providers.json (Deleted.Into/MergedAt, Deleted.Label), so a provider
added later under the old id inherits neither: it is a different
provider, and its record of its own is what it has. Renaming the target
carries the merge (Rename rewrites Into); deleting the target ends it.
Renames.Both(id, time) gives the id a call is shown under and the one it
was made to (Own). Listing, filtering, the summary and vias go by the
shown id; pricing (Record.priceID, block_price's as), window holds and
the gateway's loggedAnswers go by the own one, so a merge moves no cost
or token, only whose name they sit under. The target's face lists what
was merged into it (Named.Merged). Routes: GET /api/usage/deleted/into,
POST /api/usage/deleted {id, into?, name?}; a field not sent stays.
Run (mote, at this tree on
|
||
|
|
3e22123c9c |
usage: a deleted provider's calls stay apart from a new one under its id
cybercaius (Discord): after deleting a provider and adding a new one
that took the same id, the old provider's usage showed under the new one.
Delete now records the provider in providers.json ("deleted": id, name,
icon, when, its Was and Gave). UsageRenames gives a deleted id to
<id>~<when> only once something reuses it (a live provider, a later
deleted record, or a later Was), so a deleted provider nobody replaced
keeps its raw id and the existing probe/usage tests stay as they were.
/api/usage's provider faces name a deleted id from its record and set
Named.deleted; the Usage provider picker notes "Deleted {date}" (zh, zh-TW,
ja, de translated). Old deletes, made before this, have no record and
stay merged: nothing tells their calls apart now.
Run (mote): go test -tags nogui -run 'Deleted|Rename|NotSetUp|Probe'
./internal/usage ./internal/usageapi ./internal/provider ok; gofmt -l
clean; go vet -tags nogui ok.
Broken by hand: dropping the f.Deleted append turns
TestDeletedProviderKeepsItsCallsFromOneAddedUnderItsID and
TestDeletedProviderListedApartAndMarked red; restored, green.
Not tried: a real delete-and-re-add in the GUI app.
|
||
|
|
6d19988416 |
usage: a provider the log names but that isn't set up now goes by its name, "Claude Code", not "claude" (@ByronVon1 on X)
The Requests page's Provider filter listed "claude" between named providers. The usage log keeps the id of every provider a call went to, and usageapi named those only from provider.All(). The Claude Code subscription is in that list only while its account is discovered, so after a sign-out, with account discovery off, or for a preset provider removed since, the bare id showed. This happened in the filter, each row's Provider column, the split-by-provider and model-at-provider legends, the Account filter's provider notes, and the summary's model and account subtitles (stateOf had its own copy of the same lookup). - provider.KnownFace(id): the name and icon magpie knows an id by while it isn't set up. It covers the built-in subscriptions' card faces (accountCard: Claude Code, Codex, Copilot, Gemini, Antigravity, moved ones) and then the presets. A custom provider removed since stays its id, since nothing else knows its name. - usageapi.providerFaces: one lookup for LedgerPage and stateOf, in order: the provider set up, "Local session" for session-unknown, then KnownFace, then the id. Run: - TestProvidersNotSetUpAreNamed (new, internal/usageapi). Fails on the old code with 13 errors across the filter, rows, both splits, the Account filter and the summary; passes with the fix. - gofmt -l: clean. go vet for usageapi, provider, gateway, gui on darwin, and usageapi, provider on GOOS=linux and windows: clean. - go test ./internal/usageapi ./internal/usage: ok. - go test ./internal/provider ./internal/gateway ran at load average ~300 with other sessions' suites. Three timing tests went red, and each passes 3/3 alone (-count=3 -run): TestCopilotSecretToolUsername (#1627, commented), TestOTelFastRequestTranscriptDiscovery (#1811), and TestTranslatedStreamKeepsClientAlive (filed as #2169). TestUsageOverGateway and the gateway's TestUsage* pass. - GUI: usage-ledger.test.cjs and usage-ledger-chart.test.cjs in chromium and webkit, 52/52 (playwright 1.62.0). app.js is unchanged, since the page already shows the name the API sends. Not tried: the real GUI with a signed-out Claude account. |