Fix: stop misattributing undated usage to 'Today'#262
Conversation
Cursor bubble rows without createdAt were being assigned the current time, which shifted historical usage into whichever day report ran. Require createdAt for bubble parsing and add a regression test that verifies missing timestamps are skipped. Co-authored-by: Cursor <cursoragent@cursor.com>
agentKv sessions were always assigned the current timestamp, which inflated today's usage even when events came from earlier days. Parse timestamp candidates from agent content and skip undated sessions, with regression coverage for both paths. Co-authored-by: Cursor <cursoragent@cursor.com>
Clean up conflict residue from rebase by restoring the split bubble query template and removing stale agentKv mtime fallback code so the branch remains conflict-free and preserves correct timestamp bucketing. Co-authored-by: Cursor <cursoragent@cursor.com>
|
This PR is intended as a follow-up/complement to the recent Cursor provider fixes (including #257 and related work), focusing on one remaining day-bucketing edge case: undated records can still be assigned synthetic timestamps and drift into Today buckets. What this PR tightens: bubble rows: do not bucket rows without real createdAt into the current day prevents moving most-active-day behavior |
|
Nice catch on the undated bucketing - tested locally and the fix is solid. Two small things before we merge:
Happy to merge once those are cleaned up. |
Apply maintainer-requested cleanup by removing an unused helper and matching the parser invocation to the current function signature. Co-authored-by: Cursor <cursoragent@cursor.com>
|
All done and tested |
Bubble rows without createdAt were defaulting to new Date(), which misattributed historical or undated usage to Today and inflated the daily chart. Now filtered at the SQL level and skipped in application code. Based on the bubble-side fix from #262 by @darthrevanyunka.
|
Thanks for tracking this down @darthrevanyunka -- the root cause analysis was spot on, and the bubble-side fix is exactly what we needed. We cherry-picked the bubble half of your fix into #321 (now merged). The two changes from your PR that landed:
We left the agentKv changes out for now because Cursor stores agentKv content as binary protobuf blobs, not JSON with timestamp fields. The existing file mtime fallback is currently the most reliable timestamp source for those rows. We validated this against a live Cursor database with ~15k agentKv rows -- none of them had parseable timestamp fields in their content. Appreciate the thorough work on this. If you notice any edge cases we missed, feel free to open a follow-up. |
What this fixes
Codeburn was misreporting Cursor usage by assigning undated records to the current day. This made Today appear artificially high, and the "most active day" could shift depending on when reports or menubar refreshes were run.
Root cause
Two parser paths generated synthetic "now" timestamps when source records were undated:
createdAtagentKvsessions with no timestamp metadataThat rebucketed historical/undated usage into the runtime date.
Why this is important
Changes
createdAtfor bubble day bucketing (skip undated bubble rows)agentKvtimestamps to current timeagentKvcontent (timestamp,createdAt, andtime*variants)agentKvsessions when no reliable timestamp existsVerification
npm test -- tests/providers/cursor.test.tsnpm run buildMade with Cursor