From c3f50f49a2264da68c43cd2b60a7a4a540a56925 Mon Sep 17 00:00:00 2001 From: Nanako Tsai Date: Tue, 28 Jul 2026 18:07:19 +0800 Subject: [PATCH] fix(core): sync platform-scoped test helpers Sync TokenBar 729dc3ad into the Windows vendored core so the Copilot Desktop mtime helper import follows its Unix-only test and the four Kiro globalStorage fixture helpers follow their macOS-only tests. Keep the Windows shared-tree local patch table empty and update SYNC.md to pin the exact Native merge commit, describe the test-only behavior, and record the reproduced parity and verification boundary. Cargo.lock, runtime code, parser output, cache formats, C ABI, and fixtures remain unchanged. Verified with byte-and-mode parity across crates and shared vendor paths, matching C header and provider-v3 fixtures, Rust 1.96.1 strict core Clippy, the full scripts/check.sh gate, native Windows x64 strict Clippy evidence, and a fresh verifier. The full gate passed 319 FFI tests, 1290 core tests with one ignored, integrations 10/1/3/1, release build, .NET build with zero warnings/errors, 287 Core tests, and P/Invoke smoke. --- vendor/README.md | 1 + vendor/tokscale-core/SYNC.md | 22 ++++++++++++---------- vendor/tokscale-core/src/lib.rs | 14 ++++++++++---- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/vendor/README.md b/vendor/README.md index ae4ff02..07c71b8 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -397,6 +397,7 @@ these are upstream fixes a sync will *gain*.) | Patch | Files | Status upstream | |---|---|---| | Grok usage-row accessor naming: `ParsedUsage::token_breakdown(&self)` avoids Rust 1.96.1's `clippy::wrong_self_convention` rejection of the former borrowed `into_*` name. This is a private-method rename only; parsed output, cache schema, and runtime behavior are unchanged. | `src/sessions/grok.rs` | TokenBar-local maintenance for the local `turn_completed.usage` path | +| Cross-platform test cfg hygiene: the Copilot Desktop mtime helper import now follows its existing Unix-only test, while four Kiro globalStorage fixture helpers follow their existing macOS-only tests. This removes Windows Rust 1.96.1 strict-Clippy unused/dead-code failures without changing tests or runtime behavior. | `src/lib.rs` (tests) | Candidate for upstream test-only cleanup | | PR #2 (perf, partially retired by M26-A): `LocalParseOptions.modified_after` mtime pruning and `latest_source_mtime_ms()` change probing remain active. M26-A removes `HASH_MEMO` because path/size/mtime memoization can bypass bounded sample validation, and removes monolith-only `STORE_MEMO` because shard dirty tracking owns persistence | `src/message_cache.rs`, `src/lib.rs` | Remaining mtime/pruning seam not yet forwarded; retired memos must not be re-applied | | PR #3 (perf): streaming per-file aggregation replaces materialize-then-aggregate for the graph/model/monthly/hourly reports — `StreamingAggregator` + `SessionizeAccumulator` folded by `scan_messages_streaming` in one cache-aware pass (no full-history `Vec`). Each client lane owns its dedup set (follow-up `0752e35`: prevents cross-client `dedup_key` collisions). | `src/aggregator.rs`, `src/lib.rs`, `src/sessionize.rs`, `tests/streaming_snapshot.rs` | not yet forwarded to junhoyeo/tokscale | | #6 (fix): the **agents report** now folds over `scan_messages_streaming` too — new `get_agents_report` (mirrors `get_model_report`, `resolve_report_clients` + a single streaming pass into `AgentAccumulator`), so it shares the one deduped/per-client-gated/priced stream as every other report (resolves the issue #6 divergence: agents no longer over-counts copilot/codebuff/kimi/cursor/warp/… duplicate `dedup_key`s, and scans the same client set). `parse_local_unified_messages` survives as public API only (footgun-documented, no in-repo callers). `crates/tb_core_ffi/src/agents_report.rs` is now a thin mapper like `model_report.rs` (no longer byte-identical to the archived Tauri original — accepted). | `src/lib.rs`, `crates/tb_core_ffi/src/agents_report.rs` | not yet forwarded to junhoyeo/tokscale | diff --git a/vendor/tokscale-core/SYNC.md b/vendor/tokscale-core/SYNC.md index c3ad1e2..fb35ea3 100644 --- a/vendor/tokscale-core/SYNC.md +++ b/vendor/tokscale-core/SYNC.md @@ -3,14 +3,15 @@ | Field | Value | |---|---| | Source repo | [Nanako0129/TokenBar](https://github.com/Nanako0129/TokenBar) | -| Copied commit | [`1d874cdf1c6db97225d4703a25214be75bc33e7b`](https://github.com/Nanako0129/TokenBar/commit/1d874cdf1c6db97225d4703a25214be75bc33e7b) | +| Copied commit | [`729dc3adf21cc31e16ef0b8b742f0244197d7058`](https://github.com/Nanako0129/TokenBar/commit/729dc3adf21cc31e16ef0b8b742f0244197d7058) | | Copied on | 2026-07-28 | -`1d874cdf1c6db97225d4703a25214be75bc33e7b` is the final rebase-merged Native -PR #112 commit on `main`. It preserves the issue-107 filter-parity diagnostic -and renames the private Grok `ParsedUsage` accessor to `token_breakdown(&self)` -so Rust 1.96.1 strict Clippy accepts its borrowed receiver. Parsing, cache -schema, C ABI, and runtime output are unchanged. +`729dc3adf21cc31e16ef0b8b742f0244197d7058` is the final rebase-merged Native +PR #113 commit on `main`. It keeps the Copilot Desktop mtime helper import on +its existing Unix-only test and keeps four Kiro globalStorage fixture helpers +on their existing macOS-only tests. Windows Rust 1.96.1 strict Clippy therefore +does not compile unused test declarations. Test bodies, parsing, cache schema, +C ABI, and runtime output are unchanged. The active cache is format 2 at `source-message-cache-v2`; format-1 shards are stale and rebuild cold under format 2. The legacy schema-32 monolith @@ -28,14 +29,15 @@ cross-check copy are byte-identical to the same Native fixture. The macOS-side downstream gate passed against this exact sync: -- `crates/` is byte-identical to Native `1d874cdf`; `vendor/` is +- `crates/` is byte-identical to Native `729dc3ad`; `vendor/` is byte-identical after excluding Native-only `vendor/AGENTS.md` and this Windows-only `SYNC.md`; the C header and both provider-v3 fixture copies also match byte-for-byte. - `Cargo.lock` is unchanged, `git diff --check` passes, and the exact shared tree was not reformatted. -- Rust 1.96.1 strict Clippy passes for `tokscale-core`; focused Grok tests pass - 49/49. +- Rust 1.96.1 strict Clippy passes for `tokscale-core`. Before this exact sync, + the same cfg repair also passed native Windows x64 strict Clippy with the + standalone candidate lock unchanged. - `scripts/check.sh` passes with locked dependencies: workspace check, all Rust tests (including 319 FFI and 1,290 vendor unit tests), release build, locked .NET restore, solution build with zero warnings/errors, all 287 Core tests, @@ -56,7 +58,7 @@ then update its commit, date, and verification fields before committing: ```bash : "${TOKENBAR_NATIVE:?set TOKENBAR_NATIVE to a clean Native checkout}" -source_commit=1d874cdf1c6db97225d4703a25214be75bc33e7b +source_commit=729dc3adf21cc31e16ef0b8b742f0244197d7058 stage="$(mktemp -d)" sync_record="$(mktemp)" trap 'rm -rf "$stage"; rm -f "$sync_record"' EXIT diff --git a/vendor/tokscale-core/src/lib.rs b/vendor/tokscale-core/src/lib.rs index 464f1d0..4ac71bf 100644 --- a/vendor/tokscale-core/src/lib.rs +++ b/vendor/tokscale-core/src/lib.rs @@ -5163,12 +5163,14 @@ pub fn parsed_to_unified(msg: &ParsedMessage, cost: f64) -> UnifiedMessage { #[cfg(test)] mod tests { + #[cfg(unix)] + use super::copilot_desktop_source_mtime_ms; use super::{ agent_bucket_key, aggregate_model_usage_entries, apply_pricing_if_available, - canonical_model_id, clear_model_aliases, copilot_desktop_source_mtime_ms, - dedupe_latest_trae_messages, fold_messages_streaming, get_agents_report, get_hourly_report, - get_model_report, get_monthly_report, latest_source_mtime_ms, local_source_change_token, - message_cache, model_alias_generation, normalize_model_for_grouping, normalize_syntactic, + canonical_model_id, clear_model_aliases, dedupe_latest_trae_messages, + fold_messages_streaming, get_agents_report, get_hourly_report, get_model_report, + get_monthly_report, latest_source_mtime_ms, local_source_change_token, message_cache, + model_alias_generation, normalize_model_for_grouping, normalize_syntactic, opencode_authoritative_sources, opencode_identity_group, parse_all_messages_with_pricing_with_env_strategy, parse_local_clients, parse_local_unified_messages, parsed_to_unified, pricing, prune_scan_result_by_mtime, @@ -15404,10 +15406,12 @@ mod tests { assert_eq!(total_cache_read, i64::MAX); } + #[cfg(target_os = "macos")] fn m15a_global_root(home: &Path) -> PathBuf { home.join("Library/Application Support/Kiro/User/globalStorage/kiro.kiroagent") } + #[cfg(target_os = "macos")] fn write_m15a_snapshot(home: &Path, body: &str) -> PathBuf { let path = m15a_global_root(home).join("workspace-a/conversation.chat"); std::fs::create_dir_all(path.parent().unwrap()).unwrap(); @@ -15415,6 +15419,7 @@ mod tests { m15a_global_root(home).join("workspace-a/conversation.chat") } + #[cfg(target_os = "macos")] fn write_m15a_execution(home: &Path, status: &str, start_time: &str) -> PathBuf { let path = m15a_global_root(home).join("workspace-a/execution-store/execution"); std::fs::create_dir_all(path.parent().unwrap()).unwrap(); @@ -15437,6 +15442,7 @@ mod tests { path } + #[cfg(target_os = "macos")] fn m15a_snapshot_body(execution_id: &str, prompt: &str, response: &str) -> String { format!( r#"{{