Repository navigation
fix(app): open the sessions behind a pull request row - #1338
Closed
ozymandiashh wants to merge 4 commits into
Closed
ozymandiashh wants to merge 4 commits into
ozymandiashh wants to merge 4 commits into
Conversation
The Pull requests section imported the PR selection builder and threaded the drill-through callback through four component levels, but the row's only handler was expand/collapse, so neither was ever invoked: every other aggregate (day, model, category, project) reached the filtered session list and the one report that names shipped work did not. An expanded row now carries its own "View sessions for this pull request" control above the work breakdown, matching the project entry in Spend. It selects the PR by URL — the aggregation key of the by-PR report — and, being a control of its own rather than the row, never toggles the expansion it sits in. Rows with no per-turn detail get it too, and the section renders no affordance at all when there is no destination wired.
The list reset its visible-row count to the first page whenever the selection, the sort, the search or the data changed — but it wrote the internal fallback state, and the app passes visibleCount as a controlled prop so it can restore the depth from the nav history. The reset was therefore dead: after Show more, changing the sort or removing a chip left the reader 240 rows deep in a list that had just been reordered. The owner now resets it in the same commit as the change it owns, so a sort or selection change is one history entry rather than two, and no reset can fire during a Back/Forward restore and discard the depth that was just restored. The effect keeps serving the uncontrolled wiring and says so.
Chips were keyed by the string they display, which truncates a session id to 12 characters and a project path to its last segment. Two sessions whose ids share a prefix, or two projects with the same basename on the same branch, produced one React key for two chips: React warned about the duplicate and could reconcile or remove the wrong one. filterChipKey returns the composite identity each dimension is already normalized and removed by (provider + session id, project + branch), so chips that read alike stay distinct to React while the display label is left as short as it was.
Member
|
Landed via #1350 (merge 68ce480) with your four commits intact and credited; only the changelog needed a conflict resolution after the rebase. Verified by driving the branch build over CDP on this machine: the button on the #1341 row lands in Sessions with the PR chip and one session, $10.57 of $16.57 attributed, row still expanded; lifetime view with 9,005 sessions goes 120, 240 after Show more, back to 120 after a re-sort. Placement in the expanded detail is right, leave it there. |
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.
Fixes #1317.
You were right on all three counts, @iamtoruk.
The PR row. The plumbing from #1316 was there —
prFiltersimported,onInvestigatethreaded throughPullRequestsContent→PullRequestsPage→PrTable→PrRowView— and nothing ever called it. The row's only handler was the expand/collapse toggle, so the section that names actual shipped work was the one aggregate with no way into the sessions behind it.I gave it a control of its own rather than making the row the trigger, since the row is already a toggle. An expanded PR now shows
View sessions for this pull request →above the work breakdown, which selects the PR by its URL (the aggregation key the by-PR report is built on) and lands in Sessions with the chip applied and each session's contribution reconciled. Clicking it or pressing Enter on it leaves the expansion exactly as it was — it lives in the detail cell, not in the trigger, so nothing bubbles into the toggle. Rows with no per-turn detail get it too.On placement: I put it in the expanded detail rather than in the collapsed row so it matches the project entry point in Spend one for one, and because
plain.cssalready reserved.pr-drillfor it next to.spend-proj-drill— #1316 shipped the style and not the button. That also kept the.pr-card-triggergrid untouched. If you would rather have it visible before the row is expanded, say so and I will move it; it needs a grid column and astopPropagation, nothing more.Pagination reset.
Sessionsreset its visible count to the first page on a selection/sort/search/data change, but it wrote the internal fallback state while the app passesvisibleCountas a controlled prop (pagination depth lives in the nav history so Back/Forward can restore it). So afterShow more, re-sorting or removing a chip left you 240 rows deep in a list that had just been reordered. The reset now happens where the count is owned, in the samecommitNavas the change that caused it — one history entry, and nothing fires during a Back/Forward restore to discard the depth that was just restored. The effect stays for the uncontrolled wiring and now says so.Chip keys. Chips were keyed by the label they display, which truncates a session id to 12 characters and a project path to its last segment. Two sessions of one provider sharing an id prefix, or
/work/appand/personal/appboth onmain, collapsed into one React key — a duplicate-key warning and a real risk of removing the wrong chip. NewfilterChipKeyreturns the composite identity the selection is already normalized and removed by (provider + session id, project + branch); the visible label is unchanged.Tests: a render test clicks the new affordance, asserts
onInvestigateis called withprFilters(url)and that the row is still expanded afterwards; a keyboard variant covers a legacy row with no per-turn detail; one asserts no affordance appears when the section has no destination wired.FilterChipsgets its own file — two chips whose labels collide must render as two chips with no duplicate-key warning, and removing the second must remove exactly it — plus a unit test thatfilterChipKeyseparates whatfilterChipLabelcollapses. An App-level test reveals the extra rows, changes the sort and asserts the list is back on the first page. All four failed before the change; each fix reverted individually puts its test back to red.appsuite andtsc --noEmitare clean per file; the pre-existing full-suite timeouts on my machine are unrelated (they reproduce onmain).