Skip to content

History and sessions take a time window - #74

Merged
fylorn merged 2 commits into
mainfrom
feat/history-and-sessions-take-a-range
Sep 21, 2026
Merged

fylorn merged 2 commits into
mainfrom
feat/history-and-sessions-take-a-range

Conversation

@fylorn

@fylorn fylorn commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

The two list endpoints only took a limit, so the desktop app's traffic page could only ever show "the last 200" while its overview offers live / 24h / 7d / 30d. "What happened last Tuesday" was not a question the traffic page could be asked.

The window is optional, and its absence does not mean today. The aggregating endpoints default to midnight because "how much did I spend" needs a period and today is the right one. A list does not: "the most recent N" is already a complete answer, and defaulting to today would empty the table at midnight while the user did nothing.

Sessions filter by session, not by turn. Filtering turns and then grouping would report fewer turns and less cost for a task that straddles the boundary, and "what did that refactor cost" asks about the whole task, not the slice of it inside some window. The aggregate is computed over everything and a session is kept when any of its turns falls inside.

Tests cover both, plus a case going through a real query string — the note on Window records the time that flattening made every windowed request 400 while unwindowed ones were fine, which a unit test cannot see.

🤖 Generated with Claude Code

fylorn and others added 2 commits September 21, 2026 16:50
The two list endpoints only took a limit, so the desktop app's traffic
page could only ever say "the last 200" while its overview offers live
/ 24h / 7d / 30d. "What happened last Tuesday" was not a question the
traffic page could be asked.

The window is optional, and its absence does not mean today. The
aggregating endpoints default to midnight because "how much did I
spend" needs a period and today is the right one; a list does not —
"the most recent N" is already a complete answer, and defaulting to
today would empty the table at midnight while the user did nothing.

Sessions filter by session, not by turn. Filtering turns and then
grouping would report fewer turns and less cost for a task that
straddles the boundary, and "what did that refactor cost" asks about
the whole task, not the slice of it inside some window. So the
aggregate is computed over everything and a session is kept when any
of its turns falls inside.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fylorn fylorn mentioned this pull request Sep 21, 2026
@fylorn
fylorn merged commit 508b781 into main Sep 21, 2026
1 check passed
@fylorn
fylorn deleted the feat/history-and-sessions-take-a-range branch September 21, 2026 09:03
@fylorn fylorn mentioned this pull request Sep 21, 2026
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