Skip to content

fix(report): scope-aware usage reporting for project vs user#118

Merged
jeff-r2026 merged 3 commits into
mainfrom
worktree-fix-digest-i18n
Jul 2, 2026
Merged

fix(report): scope-aware usage reporting for project vs user#118
jeff-r2026 merged 3 commits into
mainfrom
worktree-fix-digest-i18n

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Summary

  • Project scope 只上报 cwd 在 projectRoot 下的 session(token/prompt/intervention)
  • User scope 排除已归属 project scope 的 session,避免重复计数
  • Snapshot 写入改为合并模式,各 scope 独立维护 idempotency 状态

Test plan

  • 新增 scope-filter.test.ts 覆盖 filterEventsByScope 各种边界
  • 已有 team-push-interventions.test.tsconversation-token-metrics.test.ts 无回归
  • npx tsc --noEmit 通过
  • 实际运行 teamai pull 验证 project repo 和 user repo 分别只收到各自 scope 的数据

🤖 Generated with Claude Code

jeff-r2026 and others added 3 commits July 2, 2026 15:33
The digest command now defaults to English for all labels and removes
individual user rankings to avoid exposing personal metrics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pull command already outputs English but the E2E assertion still
expected the old Chinese string.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…roject repo

Previously reportUsageToTeam pushed all dashboard sessions to every
active scope indiscriminately. Now project scope only receives sessions
whose cwd is under projectRoot, and user scope excludes those sessions.
Snapshot writes are merged (not overwritten) so each scope's idempotency
state is preserved independently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jeff-r2026 jeff-r2026 merged commit bdc56c7 into main Jul 2, 2026
7 checks passed
@hsuchifeng hsuchifeng mentioned this pull request Jul 3, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant