Repository navigation
fix: Keep tool rows under their exchange when sorted - #1807
Conversation
Under a sort, each tool row had a sort key of its own (rossoctl#1776, rule 11). So a tool row left its exchange. On DURATION, TIME and METHOD the tools ranked among the exchanges by their own values. On every other column a tool had the zero value, so all the tools collected at one end of the table. On TIME descending, the tools of an exchange went above it. Now a tool row has the sort key and the exchange of its exchange. The row position, the last tie-break, keeps the tools directly under the exchange in timeline order. The # cell is ┣⚒ or ┗⚒ also under a sort, so the ↳<n> cell is gone. A long tool does not move its exchange up a DURATION sort. A later TOTALDURATION column is for that. toolSortKey and toolRow.duration had no other caller, so they are removed. A new test sorts on each sortable column in both directions and checks that each tool row is under its exchange. Fixes rossoctl#1805 Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Ed Snible <snible@us.ibm.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
clawgenti
left a comment
There was a problem hiding this comment.
Summary
The fix is correct and small. Each tool row now gets its exchange's rowKey (same sort value, same arrival index), so all three tiers of sortEventRows tie for an exchange and its tools. The stable row-position tie-break then keeps the tools directly under the exchange, in timeline order, whichever way the sort runs. Removing toolSortKey, toolRow.duration and the sorted parameter leaves no dangling callers. No ↳ remains in non-test code; the only mention left is in tool_enter_test.go's negative assertion, which still holds.
Verified at 553450f:
- I rendered the real
eventsTbl.View()with 3 exchanges and 4 tools (two under exchange 1, one still running) on chronological, DURATION▼, TIME▼ and COST▲. In every view each tool sits directly under its exchange, with┣⚒/┗⚒in the#column. The 16s tool under the 4s exchange and the 57s running tool under the 1s exchange no longer move up a DURATION▼ sort. TIME▼ no longer puts tools above their exchange. - I ran the new
TestToolRows_EverySortKeepsToolsUnderTheirExchangeand the updatedTestToolRows_SortByDurationagainst basea6fbd45: both fail, on placement for ACTION/DIR/DURATION/TIME/... and on the↳<n>cell for every column. At head they pass, so the tests catch the bug. go test -race ./cmd/agentop/tui/passes, andgo vetandgofmt -lare clean.
Author: esnible (MEMBER — maintainer)
Areas reviewed: Go (agentop TUI sort/render), tests, Docs (README)
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (Go CI (core peerproc, macOS) still pending; it does not touch cmd/agentop)
| } | ||
| case tr.last: | ||
| // Also under a sort: the tool rows stay under their exchange (#1805). | ||
| if v = "┣⚒"; tr.last { |
There was a problem hiding this comment.
nit: setting the default in the if init statement (if v = "┣⚒"; tr.last {) is legal but unusual, and at a glance it reads like a comparison. Maybe write it plainly:
v = "┣⚒"
if tr.last {
v = "┗⚒"
}
Summary
Fixes #1805. Under a sort, the tool rows of agentop's events table left their exchange.
Each tool row had a sort key of its own (#1776, rule 11):
Change
sortEventRows(the row position) keeps the tools directly under the exchange, in timeline order.#cell of a tool row is┣⚒or┗⚒also under a sort. The↳<n>cell is gone.toolSortKeyandtoolRow.durationhad no other caller, so they are removed.cmd/agentop/README.mdsays how a sort treats tool rows.Tests
TestToolRows_SortByDurationnow checks the case in the issue: a 38s tool stays under its 2s exchange, below a 4.4s exchange.TestToolRows_EverySortKeepsToolsUnderTheirExchangesorts on each sortable column in both directions. It checks that each tool row is under its exchange, in timeline order, with the correct#cell. Onmainit fails in 15 of the 22 cases. The other cases pass onmainonly because the test data's values tie.TestToolRows_SortOtherColumnIsStable(the new test covers it),TestToolRows_SortedParentNumberFits(no↳cell) andTestToolRow_DurationSortValue(noduration).scripts/dev/go-test-shards.sh -race cmd/agentop: 1017 tests pass.go test -raceon thecmd/agentopsubpackages passes.go vet ./...andgofmt -l .are clean.Assisted-By: Claude (Anthropic AI) noreply@anthropic.com
Summary by CodeRabbit