refactor(core): remove parsed message pipeline - #103
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
makoMakoGo
left a comment
There was a problem hiding this comment.
我看了 #93 的决策记录和这次 diff。删除 ParsedMessage / ParsedMessages、parse_local_clients、parsed_to_unified / unified_to_parsed / filter_parsed_messages 的方向是对的,也符合 #93 的范围:统一到 UnifiedMessage,不再保留第二套消息形态。
但 ready 前有一个需要处理的问题:#103 依赖 #101,而 #101 当前 head 后续新增了 client_count_bucket,把 cc-mirror/* 归到 ClientId::Claude,并加了 test_client_count_sink_attributes_cc_mirror_variants_to_claude。#103 当前分支里的 ClientCountSink 仍然直接走 ClientId::from_str(&message.client),这会让 cc-mirror/* 的本地 client count 被丢掉,相当于回退 #101 的修复。
建议先 rebase/merge #101 当前 head,然后保留 client_count_bucket 和对应测试。除此之外,我没有看到删除 ParsedMessage 管线本身的问题。
2181f2d to
fd5be33
Compare
makoMakoGo
left a comment
There was a problem hiding this comment.
重新看过当前 head fd5be33e,上次指出的问题已处理。
确认点:
- #103 现在基于 #101 最新 head
7011c325,只 ahead 1 commit。 client_count_bucket已保留,cc-mirror/*会归到ClientId::Claude。ClientCountSink已恢复通过client_count_bucket计数。- headless Codex count 也已按 folded
message_count.max(0)计数。 test_client_count_sink_attributes_cc_mirror_variants_to_claude和 folded headless Codex count 测试都在。- ParsedMessage 管线删除方向保持干净,没有看到新的回归点。
LGTM from code review. 当前 workflow 还在 in_progress,合并前等 CI 结果即可。
|
/juya review |
e4a1ed3
into
codex/issue-92-cache-wrapped-clients
Summary
ParsedMessage/ParsedMessagesstructs and conversion helpers.parse_local_clientspath now that local consumers use unified-message folds from P1: wrapped 与 clients 走一次解析和缓存路径 #92.UnifiedMessagepluscount_local_client_messages.parse_all_messages_with_pricingtest-only while runtime paths use the cached unified fold.Closes #93
Depends on #101.
Validation
rg -n "ParsedMessage|ParsedMessages|parse_local_clients|parsed_to_unified|unified_to_parsed|filter_parsed_messages" crates --glob '*.rs'returns no matchescargo fmt --all --checkcargo clippy --workspace --all-targetscargo test -p tokscale-corecargo test --workspacecargo build --release -p tokscale-cliLocal memory check
Measured on WSL2 Ubuntu 24.04 with live local client data. Base is the previously installed local
tokscalebinary before replacement; PR istarget/release/tokscalefrom this branch. Each command had one warmup run, then 3 measured runs with/usr/bin/time -f "%M,%e"; RSS values are%M / 1024.tokscale --no-spinner clients --jsontokscale wrapped --year 2026 --agents --no-spinner --output ...tokscale wrapped --year 2026 --clients --no-spinner --output ...The wrapped commands exited successfully and produced non-empty PNG output. This PR removes the legacy parsed-message API path; local runtime RSS is effectively unchanged against the #101 cached-fold baseline.
Summary by cubic
Removed the legacy parsed-message pipeline in
tokscale-core. Local loading now uses the cached unified message fold and consolidates onUnifiedMessage.Refactors
ParsedMessage,ParsedMessages, and helpers (unified_to_parsed,parsed_to_unified,filter_parsed_messages).parse_local_clients; tests now load via the unified fold pluscount_local_client_messages.parse_all_messages_with_pricingas test-only (#[cfg(test)]).UnifiedMessage(includingtokens.*fields) and renamed them to “local message loader” cases.Migration
parse_local_clientsandParsedMessagewith:UnifiedMessagefor data.count_local_client_messagesfor per-client counts.load_usage_dataorload_aggregated_views_with_pricing(both use the cached unified fold).Written for commit fd5be33. Summary will update on new commits.