docs(agents): record why app metrics prints raw tokens where the web humanises them - #192
Merged
Merged
Conversation
…b humanises them civitai/civitai#3574 humanises the two analytics "top N" rollups on the web (`analytics-bucket-labels.ts`), so the same data now reads as `Generations` / `AI workflow submits` there and `workflow:submit` / `ai:write:budgeted` in `app metrics`. Recording that as a DELIBERATE non-mirror rather than leaving the next reader to find a divergence and "fix" it. The reasoning, so it can be re-litigated on evidence rather than re-derived: mirroring the labels adds a THIRD vendored mapping to keep in lockstep with the server (alongside `schema/` and the slot registry), and unlike those two it buys no correctness — a raw token is accurate, just terse, and #3561 already bounded the values so they aggregate readably. Raw is also arguably better for the CLI's scripting audience, and `--json` must keep emitting raw tokens either way. Also records the costs, since a deliberate decision should carry them: two vocabularies across the two surfaces, and a legacy pre-bounding row that reads `workflow:submit:<id>` here vs `Generations (<id>)` on the web. Plus the trap for whoever closes the gap — `pending` in a legacy endpoint tail is a "no id captured" sentinel, NOT a status, which is a bug #3574 shipped and then fixed. Verified before writing: `app_metrics.go:255,263` print `safeTerm(s.Scope)` and `safeTerm(e.Endpoint)` under the `Top scopes` / `Top endpoints` headings, i.e. raw. Docs-only; `make ci` green. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
civitai/civitai#3574 humanises the two analytics "top N" rollups on the web (
analytics-bucket-labels.ts), so the same data now reads asGenerations/AI workflow submitsthere andworkflow:submit/ai:write:budgetedincivitai app metrics.This records that as a deliberate non-mirror (AGENTS.md item 8) rather than leaving the next reader to find the divergence and "fix" it.
The reasoning, written down so it can be re-litigated on evidence
Mirroring the labels would add a third vendored mapping to keep in lockstep with the server — alongside
schema/and the slot registry — and unlike those two it buys no correctness. A raw token is accurate, just terse, and #3561 already bounded the values so they aggregate readably. Raw is also arguably the better choice for the CLI's scripting audience, and--jsonmust keep emitting raw tokens regardless.The costs, since a deliberate decision should carry them
workflow:submit:<id>here vsGenerations (<id>)on the web.pendingin a legacy endpoint tail is a "no id captured" sentinel, not a status — that was a real bug #3574 shipped and then fixed, and hand-rolling labels here would reproduce it.If the gap is closed later, the note says to mirror
analytics-bucket-labels.tswholesale and add a drift check against the server'srecordScopeInvocationcall sites, rather than hand-rolling.Verification
Confirmed against the code before writing the claim:
internal/cmd/app_metrics.go:255,263printsafeTerm(s.Scope)andsafeTerm(e.Endpoint)under theTop scopes/Top endpointsheadings — i.e. raw. Docs-only change;make cigreen.🤖 Generated with Claude Code