Parent
#752 (item 3)
What to build
usage.jsonl stops growing in scopes that never report: http sources, usageReport: false, or a remote that rejects every push. Dropping events when they are written would empty teamai stats for those scopes, since the local file is their only source. So pull caps the file instead, keeping the newest 5,000 events.
Where the cap runs is the whole design. The report deletes the first N lines, N being how many events it read. A cap applied in between would shift those lines, and the report would delete events it never sent (the #750 failure):
pull, scope S, holding S's sync lock
events = read usage.jsonl
report(events)? ← only for scopes that report
truncate first N lines ← N = events reported
cap to newest 5,000 ← after the truncate, never between read and truncate
A hook never compacts. pull runs at every session start, including for the scopes that never report, so the cap reaches them all.
Acceptance criteria
Blocked by
None (can start immediately).
Parent
#752 (item 3)
What to build
usage.jsonlstops growing in scopes that never report: http sources,usageReport: false, or a remote that rejects every push. Dropping events when they are written would emptyteamai statsfor those scopes, since the local file is their only source. Sopullcaps the file instead, keeping the newest 5,000 events.Where the cap runs is the whole design. The report deletes the first N lines, N being how many events it read. A cap applied in between would shift those lines, and the report would delete events it never sent (the #750 failure):
A hook never compacts.
pullruns at every session start, including for the scopes that never report, so the cap reaches them all.Acceptance criteria
usageReport: falsescope with more than 5,000 events hold 5,000 after a pull, andteamai statsstill shows their newest usage.gitprovider); usage guide section on usage reporting (both languages) and CHANGELOG updated.Blocked by
None (can start immediately).