fix(stats): await the async dashboard scope filter (#795) - #806
Merged
jeff-r2026 merged 2 commits intoSep 24, 2026
Merged
Conversation
Tencent#795 made filterEventsByScope async and changed its argument from a projectRoot/excludeProjectRoots filter to the scope config, while Tencent#771 still called it synchronously with the old filter. On main, tsc fails in stats.ts and every stats-scope test throws "events is not iterable"; `teamai stats` crashes once there are dashboard events. stats now awaits the filter and passes the scope config, the call pull makes, which is what Tencent#771 set out to do: show what the report sends. The cwd-based project-root resolution is gone with the old argument. The user-scope test followed pull's rule before Tencent#795 (keep events that carry no dataHome); it now follows the current one: the user scope never reports them, so it does not count them.
Since Tencent#795 each scope reports against its own reported-*.json under its data home, and the shared ~/.teamai/dashboard files are no longer written. stats still subtracted the shared files, so after the upgrade every session reported since counted twice in the headline. stats reads the snapshots through team-push's readers with the scope config, including the one-time seed from the shared file.
Collaborator
Author
|
@jeff-r2026 heads-up: Each PR was green on its own; the break only shows once both are on The other open #752 PRs, once rebased onto |
|
No findings. The PR description provides sufficient testing evidence, including a representative real-CLI end-to-end run for the runtime behavior change. |
jeff-r2026
approved these changes
Sep 24, 2026
This was referenced Sep 24, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #795 and #771: main is red since 352cfc4
Summary
#771 and #795 each passed review alone, but together they break
teamai stats. #795 changed the scope filter's contract and moved the reported snapshots, and #771's call sites instats.tsstill use the old ones.dataHomeare never reported by the user scope, so they are not counted either. fix(report): each scope reports its own dashboard sessions once, against its own snapshots (#785, #786) #791 is still open and changes that rule again (legacy events whose cwd resolves to the user scope), so fix(report): each scope reports its own dashboard sessions once, against its own snapshots (#785, #786) #791 owns flipping that test.Evidence
origin/mainnpx tsc --noEmitsrc/stats.tsnpx vitest runstats-scope.test.ts:events is not iterable)expected 2 to be 1npm run buildReal CLI, sandbox HOME, run from the project: project scope (http), team file holds 1 session, events hold sess-1 (reported) and sess-2 (new) in this scope plus sess-3 from another scope, shared snapshot
{}, project snapshot has sess-1.Covered one agent-independent path (
statsreads local files only); no provider × agent matrix.Merge Danger
Door: two-way
Local read path only; nothing written to the team repo. A stats run seeds the scope snapshot from the shared file once, the same seed the next pull would write.
Blast Radius:
teamai statsHeadline and
--by-repo/--by-timefor the user scope no longer count events recorded before events carried a data home, matching what pull reports.