fix(usage): drop cache_write metric, keep hit-rate trend line continuous - #2534
Closed
chaos-cl wants to merge 3 commits into
Closed
fix(usage): drop cache_write metric, keep hit-rate trend line continuous#2534chaos-cl wants to merge 3 commits into
chaos-cl wants to merge 3 commits into
Conversation
added 3 commits
August 27, 2026 11:08
The trend chart's cache hit-rate polyline dropped null buckets and joined the remaining points into one polyline, so an idle stretch (all token counters at zero, no cache telemetry) was visually bridged by a high dashed line connecting the buckets on either side - the chart implied a ~97% hit rate over hours where the tooltip correctly showed no data. - split the hit-rate series into contiguous segments that stop at buckets without telemetry; an isolated point renders as a dot - add hover marker dots for every series so small values stay visible on a zero-baseline token axis (e.g. 276K next to a 20M peak reads as flat zero without an anchor) - format the tooltip hit rate with formatHitRate (two-decimal truncate) instead of Math.round for consistency with the summary cards
Splitting the hit-rate series at buckets without telemetry left isolated dots and blank stretches, which read as a broken chart. Idle buckets already draw every token series at zero, so plot the hit rate at 0% there too and keep one continuous dashed line; the tooltip mirrors the line with 0.00% instead of an en dash.
1688mengdie
pushed a commit
to BitFun-SIG/taiji-plugin-library
that referenced
this pull request
Aug 27, 2026
usage hit-rate semantics Adopted-from: GCWing#2534 (fix/usage-stat-chart-hit-rate, head 89c939f) Scope: drop cache_write metric from statistics pipeline + chart, keep hit-rate trend line continuous (gaps plot at 0%). Conflict resolution per commander directive: - cache_write display/aggregation tug-of-war with GCWing#2548 resolved in favor of GCWing#2534 in CHART PIPELINE (series dropped) while backend telemetry fields retained per GCWing#2548 data-retention (api types + test fixtures keep cacheWriteTokens). - Rate rendering merged: rateFor(number|null) + unconditional hover dot + tooltip value hoveredHitRate ?? 0 to mirror rendered line. Verification: cargo check -p bitfun-services-core --jobs 4 0e0w + pnpm type-check (recorded in sync-record-2534-adopt-20260827.md)
1688mengdie
pushed a commit
to BitFun-SIG/taiji-plugin-library
that referenced
this pull request
Aug 27, 2026
…re-existing on baseline, surfaced by type-check during GCWing#2534 adoption)
1688mengdie
pushed a commit
to BitFun-SIG/taiji-plugin-library
that referenced
this pull request
Aug 27, 2026
…rate visualization (Adopted-from: GCWing#2534)
1688mengdie
pushed a commit
to BitFun-SIG/taiji-plugin-library
that referenced
this pull request
Aug 27, 2026
…828 B2 serial merge Merge taiji dev full-baseline HEAD 2923d0c (B1 two upstream rounds + GCWing#2534 adoption + anthropic.rs denominator fix): - dev-only: sealed pre-commit baseline, GCWing#2534 usage hit-rate visualization (token_usage/web-ui UsageStatisticsConfig/AssistantDefaultsPage/i18n) - anthropic.rs usage denominator semantics for non-native backends (8 files) - local customs retained: SessionControl compact/Rename chain, agent-runtime facade git feature, tool-provider-groups four tools, AgentsScene test suite, DEFAULT_MAX_ROUNDS=50, window_state struct init fix 6 conflicts resolved per the four principles (see sync-record-20260828-B2.md).
1688mengdie
pushed a commit
to BitFun-SIG/taiji-plugin-library
that referenced
this pull request
Aug 27, 2026
…n usage stats test (TESTFIX-USAGE-0828) Adopted-from GCWing#2534 pre-existing defect: the original PR commit (ab8a543) asserted data-cache-hit-rate-segment line/point attributes that its own chart implementation never rendered. The later adopted-baseline commit (3adf7be, upstream/main and full-baseline@2923d0cd4) rewrote the hit-rate rendering to a single continuous dashed polyline, but carried the stale segment/tooltip superset assertions forward, leaving the file red everywhere. Qualification: category 1 - upstream test defective against its own implementation; fix = align assertions with the adopted rendering behavior. Implementation is untouched. Changes (test file only): - Remove the two data-cache-hit-rate-segment querySelectorAll assertions. - Assert the adopted continuous-line shape instead: 3 token polylines + 1 dashed hit-rate polyline under .bitfun-usage-stats__trend-svg. - Align the tooltip expectation to the rendered semantics: an active telemetry gap resolves to 0.00% (line plots gaps at zero), not the stale '–'. - Rename the case to match the actual continuous-line contract. Evidence chain: upstream/main contains ab8a543..3adf7be as linear history (git merge-base --is-ancestor = 0); identical red reproduced at full-baseline@ 2923d0c; sync-record-20260828-B2.md section 7.7. Verified: vitest run of UsageStatisticsConfig.test.tsx + tokenUsageStatisticsApi.test.ts -> 11 passed.
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.
Summary
Three follow-up fixes for the usage statistics page (continuation of the
review work in #2353, rebased onto current
main):creation/write counts are provider-internal telemetry that local
clients generally never receive; the field was always 0 and only added
noise. Removed end-to-end (Rust types + aggregation + integration
tests + TS API mirror + chart series + legend i18n).
small values stay visible on a zero-baseline token axis (e.g. 276K
next to a 20M peak previously rendered as flat zero with no anchor).
telemetry now sit at 0% like the token series do, keeping the dashed
line continuous instead of breaking it into orphan dots and blank
stretches. The tooltip mirrors the line with
0.00%.formatHitRatetruncation semantics are preserved: no rounding up,100% only for an exact full hit.
Verification
Also validated end-to-end in a nightly desktop build against real
multi-provider data (智谱AI / OpenRouter): idle stretches now draw a
continuous hit-rate line through 0%, and small-value hover points are
visible.