Repository navigation
feat: custom analytics period, sortable Sessions & Runs with date filters - #445
Merged
Merged
Conversation
The picker only offered fixed presets, so a two-week window — the most common question after a sprint — could not be asked at all. "Custom range" opens a date range picker and reloads once both days are picked. AnalyticsPeriod now resolves a request to a Window (preset or custom, both ends inclusive) and every analytics service filters on its range instead of an open-ended `since..`. A custom range buckets like the preset of about its length; an unreadable one falls back to the default preset. It applies to project and company analytics, Profile -> Usage and a member's page. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
Finding the most expensive or the longest run meant scrolling the whole feed. The Tokens, Cost, Duration and Started headers now sort the project feed and the company list (highest first, a second click flips it), and both lists gain a date-range filter; the project feed adds a Workflow filter and the company list a Project filter. Sort and dates travel as a ransack `q` (`q[s]`, `q[created_from]`, `q[created_until]`). A run sorts by what its step sessions add up to, via ransackers on WorkflowRun; a live session or run counts its duration up to now. SessionListSort applies the order itself rather than ransack's sort: rows without a duration must sink in both directions, and the project feed orders a UNION of two tables by one column. The existing status, agent, search and user filters stay as they were — each spans both state machines or the prompt-visibility rule, which a single ransack predicate cannot. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
Merged
artempartos
added a commit
that referenced
this pull request
Oct 8, 2026
Adds the entries #441, #445 and #447 merged without, then moves [Unreleased] into 1.1.0. Minor, not patch: the release carries new features (comment editing, custom analytics range, Sessions & Runs sorting and date filters, /changelog, Managed by Aixle). Signed-off-by: Artem Petrov <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Why
Two asks from the team:
What changes
Custom period in analytics
AnalyticsPeriod.windowturns a request into aWindow(a preset orcustom, both ends inclusive). Every analytics service now filters onwindow.rangeinstead of an open-endedsince...30d, and the picker shows the window the charts actually used.period=custom&from=YYYY-MM-DD&to=YYYY-MM-DD. Days are UTC, like the rest of analytics.Sorting and filters on Sessions & Runs (project feed and company list)
The Tokens / Cost / Duration / Started headers sort the list. The first click sorts highest first; a second click reverses it.
New filters:
Sort and dates travel as a ransack
q:q[s]=cost_cents desc,q[created_from],q[created_until].TerminalSession/WorkflowRunallowlist the new attributes and gaincreated_from/created_untilscopes.WorkflowRungive a run's cost and tokens as the sum over its step sessions, each counted once. Both models get a duration ransacker, and a live session or run counts its duration up to now.SessionListSortapplies the order itself instead of ransack's sort, for two reasons:Leaving ransack's global
fields_sort_optionalone keeps the members list and the board-tasks API sorting exactly as before. The count query leaves out the sort value, because for a run that value is a subquery per row.The existing status / agent / search / user filters stay as top-level params. Each one either covers two state machines, goes through a run's steps, or follows the prompt-visibility rule, and none of that fits a single ransack condition.
Docs:
analytics.mdandsessions-and-runs.mdare updated.Verification
AnalyticsPeriod, the custom range in the session/workflow cost services and in all four controllers, and in the feed (cost and tokens sorting across the union, duration with NULLs last and live rows, inclusive date range on both sides, workflow filter, unknown sort falling back). There are also controller tests forqon both lists, including aqthat is not a hash. Every affected test file passes locally (≈320 runs).shared/and every affected page.tsc,eslint, steiger (FSD),rubocopandbrakemanare clean.check_alllocally; CI is the gate for that.Notes
🤖 Generated with Claude Code