Repository navigation
[PR] fix(web): refresh cached disk summaries when prices change - #7292
ranxianglei merged 1 commit into
Conversation
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 #7291 (source issue) 是本 PR 的立项单。相近条目逐一比对: #7290 (select freshest disk session summaries) 同一子系统 (sessions-data.ts disk index) 但机制不同——它修的是多文件同 session 时的 summary 选择 (byId winner vs last-visited overwrite), 本 PR 修的是 price cache invalidation; #7276/#7279/#7280 是 billing lookup 性能 (cost table 重建), 不同失败域; #7238 是 savings 用的 rate 语义 (billed avg vs list price), 不同机制。无重复, 无并行 PR 修同一问题。 Independent review (read the diff at head Fix mechanism. Verification performed.
Regression review (existing behaviors touched):
Test validity (④): both gate directions asserted, exact-value assertions, legacy+shadow parametrization covers both disk paths, and the async-boundary test has teeth (it mocks the file read to edit prices mid-decode, asserts the edit was consumed, and asserts the rollback is reflected — catches the stale-memo-stamp defect class). Deterministic: temp dirs, env saved/restored in Code quality (⑤b) / diff (⑤): clean naming, why-comments where the logic is non-obvious, no dead code, style-consistent, no new dependencies; 2 files, every line on-purpose. No small mechanical flaws found → no drive-by fixes needed. CI (live-verified 2026-11-19T10:48Z, sha Note: Labeling limitation (reported, not dropped): I attempted to apply triage labels ( 八问 (Chinese, for reviewers):
Verdict: mergeable — pending CI test shards go green (static gates already green, 0 failures so far). I won't merge (human-only). |
Fixes #7291
Problem
Dollar fields are documented as a view of current prices, but unchanged disk files reuse a fully priced summary indefinitely. A price edit updates live sessions while disk-only sessions retain old spend estimates, fold savings, payback and displayed rates. Removing or adding registry prices has the same stale-cache behavior.
Change
Include the resolved input/output/cache-read/cache-write rates in each disk summary's cache validity. A warm refresh resolves each distinct model/origin once. Equal prices reuse the existing summary; changed prices rebuild only the affected rows. Fresh shadow-index rows continue to avoid envelope decoding. Legacy files are decoded sequentially and their full records are immediately discarded, preserving the bounded summary index. Rebuilt rows receive a fresh synchronous price stamp, so a config reload during an asynchronous file read cannot mislabel their derived amounts.
The original persisted spend ledger still wins over estimates. The cache stores only a small price key; it does not retain session payloads or ledgers. Persisted formats, configuration and model-facing wire behavior are unchanged.
Validation
git diff --checkpass. Independent source review included the asynchronous price-change boundary.Tradeoff: changing resolved rates requires one new summary extraction for affected legacy files; it does not re-read unrelated models. Warm refreshes add one synchronous price lookup per distinct model/origin.
Validated on Linux / Node.js 24.22.3, based on
04ecbb42dd38543e9c407bd40eb773ae5ec8b60b. The repository-wide regression verdict remains the upstream CI result on the published head.