fix(tui): confine group-by scope and pin canonical model identity - #165
Conversation
- pin Daily/Period top-model rankings to bare canonical model IDs - add explicit model_id/workspace fields to daily/hourly model info - show workspace as its own column in Workspace+Model grouping - gate the group-by picker to tabs that consume grouped projections - decouple session refresh from group-by reloads - make model shade resolution grouping-invariant - make TUI export self-describing (groupBy, workspaceKey/workspaceLabel) - record the view-scope contract in ADR 0026
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough本次变更建立显式的 Changes分组身份与工作区投影
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cbb267f6b0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/tokscale-cli/src/tui/ui/models.rs`:
- Around line 22-24: Update workspace_label to fall back from
model.workspace_label to model.workspace_key when the label is missing, while
preserving the existing Unknown workspace fallback when both are absent. Reuse
the existing workspace_label_or_unknown helper and align the behavior with the
label-to-key fallback used by Daily/Period details.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ec3f0d7b-1a84-452c-9e1e-a19ca6d210c7
📒 Files selected for processing (20)
crates/tokscale-cli/src/tui/app.rscrates/tokscale-cli/src/tui/cache.rscrates/tokscale-cli/src/tui/colors.rscrates/tokscale-cli/src/tui/data/mod.rscrates/tokscale-cli/src/tui/export.rscrates/tokscale-cli/src/tui/mod.rscrates/tokscale-cli/src/tui/ui/daily.rscrates/tokscale-cli/src/tui/ui/footer.rscrates/tokscale-cli/src/tui/ui/hourly.rscrates/tokscale-cli/src/tui/ui/model_usage_layout.rscrates/tokscale-cli/src/tui/ui/models.rscrates/tokscale-cli/src/tui/ui/overview.rscrates/tokscale-cli/src/tui/ui/overview_snapshot.rscrates/tokscale-cli/src/tui/ui/period.rscrates/tokscale-cli/src/tui/ui/stats.rscrates/tokscale-cli/src/tui/ui/widgets.rscrates/tokscale-core/src/aggregate/parity_tests.rscrates/tokscale-core/src/aggregate/tui.rscrates/tokscale-core/src/usage_views.rsdocs/adr/0026-group-by-view-scope-contract.md
- fall back to workspace_key in the Models workspace column - retry sessions when a health-forced reload rides a group switch - label exports with the grouping of the loaded projection - reject current-schema cache entries missing modelId
Bot review 处置结果(commit
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/tokscale-cli/src/tui/cache.rs`:
- Around line 2076-2096: 更新 write_identity_cache_without_model_id 中的回归夹具,使用当前的
CACHE_SCHEMA_VERSION 动态生成 schemaVersion,而不是硬编码 38。保留其余 JSON 内容和
cached_models_missing_identity 测试行为不变。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3ebfd982-82df-459b-8e08-7f5cf1e63113
📒 Files selected for processing (4)
crates/tokscale-cli/src/tui/app.rscrates/tokscale-cli/src/tui/cache.rscrates/tokscale-cli/src/tui/mod.rscrates/tokscale-cli/src/tui/ui/models.rs
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/tokscale-cli/src/tui/app.rs
- crates/tokscale-cli/src/tui/ui/models.rs
概要
按 #161 影响矩阵中已确认的决策,实施 Group By 作用范围清理(最小修复 + 契约固化;不含廉价再投影的结构优化)。
核心变化:Group By 收敛为「Models 类表格的展示投影」——所有 "Top Model" 排名钉死 bare canonical model ID,canonical 身份由显式
model_id字段承担,workspace 维度以独立列/字段呈现,不再拼进标签字符串。变更
model_id跨 source 合并,胜者/标签不再随分组翻转(等价 Statsrank_canonical_models语义)DailyModelInfo/HourlyModelInfo新增model_id(bare canonical)与workspace_key/workspace_label;display_name恒为裸模型名;color_key回归纯着色;删除model_color_key的_group_by/_provider_id占位参数与 map_key 身份回退死分支g键守卫:仅 Models / Daily / Monthly / Weekly 可打开分组选择器,其余 Tab 不再触发无谓的阻塞全量重载r与文件变更行为不变groupBy+ 行级workspaceKey/workspaceLabel(对齐 models CLI 习惯)测试
新增回归:4 种分组下 Top Model 排名一致、Workspace 列渲染(Models 表 + 详情)、
g守卫(4 可用 / 6 不可用 Tab)、Hourly 4 分组渲染逐字节不变、ClientProviderModel 投影等价、session_reload_force、着色分组不变、导出自描述、缓存 legacy-miss。cargo test -p tokscale-core -p tokscale-cli全绿(1454 + 691 + 140 + 10 + 3 + 2 + 1 passed);cargo fmt --check与cargo clippy --all-targets干净。未做(后续 PR)
Refs #161
Summary by CodeRabbit
groupBy与工作区字段。g快捷键仅在适用页面打开 Group By;切换分组触发更精细的会话刷新策略。