payload: spend by pull request and by branch; desktop Pull requests tab#788
Merged
Conversation
Part 1 (src): expose two add-only, optional aggregations on the menubar payload's `current`, computed on the unscoped all-provider path from the surviving-session parse (carried history cannot contribute, as expected). - current.pullRequests: aggregateByPr rows (top 20 by cost) plus the multi-link-safe distinctCost/distinctSessions. Rows are by-reference, so they are never summed. - current.byBranch: new aggregateByBranch, per-branch spend (top 15 by cost) that carries each session's last-seen git branch forward across its turns. The cache stores a turn's branch only when it changes, so the parser now resolves the branch at reconstruction (before the date slice) and records SessionSummary.everHadBranch from the full transcript. That lets the report keep a branch-bearing session's pre-branch spend in an explicit null row even when the range clipped the anchor turn, while a provider that never captures a branch still contributes nothing. Part 2 (app): new "Pull requests" sidebar entry between Sessions and Spend (shortcuts reflow to number 8 for Plans). It renders the pullRequests rows as a refined table with the PR label linking out via openExternal, cost, sessions, calls and an active-date span, plus a footnote stating the distinct total and the by-reference attribution. A quiet explanatory line shows when no PR links exist, never a fake table. Tests: aggregateByBranch unit tests (carry-forward, null bucket, clipped anchor, by-reference session counts) and the Pull requests component tests (table, external link, footnote, both empty states). Nav-reflow assertions in Sidebar and App tests updated.
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.
Phase 2 data features plus the app's Pull requests tab.
Payload gains two optional all-provider blocks: current.pullRequests (the #780 aggregation as rows top-20 by cost plus distinctCost/distinctSessions) and current.byBranch (per-branch spend with correct carry-forward semantics: a branch is stored per turn only when it changes, so reports carry the last-seen value forward; sessions that never observed a branch contribute nothing, and in-range spend that precedes a session's first branch observation lands in an explicit null row the UI can label honestly).
Two real bugs found and fixed along the way, verified by the lane's own adversarial round: cachedTurnToClassified silently dropped gitBranch on the warm-cache path, so branch data never reached ANY report until now; and a date range clipping a session's only branch-observation turn dropped its pre-branch spend instead of landing it in the null row (fixed with a pre-filter everHadBranch marker).
The desktop app gains a Pull requests sidebar entry between Sessions and Spend: PR label linking out, cost, sessions, calls, active span, and the by-reference footnote with the distinct total; quiet empty state, never a fake table.
Real lifetime data: 20 PR rows, distinct 7,240 USD across 14 sessions, top row getagentseal/eywa#30 at 2,406 USD; byBranch main 2,808 USD / 297 sessions, HEAD 1,261, feat/memory-rebuild 726. Root suite 2,140 green, app 418 green, 12 new tests.
Part of the phased surfacing wave; PRs only, no release.