detached 6c7d5d9

test(daemon): allocate unique helper row IDs

commit
6c7d5d9a4e436c087a66ceace0f8a3aa158cec75
author
brice · · 2026-08-02 21:57 UTC
committer
brice · · 2026-08-03 17:54 UTC
parent
7d1e3b2
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +14 -1
M internal/usecase/daemon/daemon_test.go +14 -1
@@ -458,7 +458,20 @@ func testRow(text string) []renderer.Cell {
458458 // wrapped out of. Tests that care about wrapped extents build the bound instead.
459459 func appendHistoryRow(tb testing.TB, history *vt.History, row []renderer.Cell) {
460460 tb.Helper()
461- require.NoError(tb, history.AppendWithID(row, vt.LineBound{End: len(row)}, vt.RowID(1_000_000+history.Len()+1)))
461+ require.NoError(tb, history.Append(row, vt.LineBound{End: len(row)}))
462+}
463+
464+func TestAppendHistoryRowAllocatesUniqueIDsAfterEviction(t *testing.T) {
465+ history := vt.NewHistory(vt.HistoryConfig{MaxRows: 2, ChunkRows: 1})
466+ ids := make(map[vt.RowID]struct{})
467+ for range 4 {
468+ appendHistoryRow(t, history, testRow("row"))
469+ view := history.View()
470+ id := view.RowID(view.Len() - 1)
471+ require.NotContains(t, ids, id)
472+ ids[id] = struct{}{}
473+ }
474+ require.Len(t, ids, 4)
462475 }
463476
464477 func tabCount(sess *session) int {
@@ -458,7 +458,20 @@ func testRow(text string) []renderer.Cell {
458 // wrapped out of. Tests that care about wrapped extents build the bound instead.458 // wrapped out of. Tests that care about wrapped extents build the bound instead.
459 func appendHistoryRow(tb testing.TB, history *vt.History, row []renderer.Cell) {459 func appendHistoryRow(tb testing.TB, history *vt.History, row []renderer.Cell) {
460 tb.Helper()460 tb.Helper()
461- require.NoError(tb, history.AppendWithID(row, vt.LineBound{End: len(row)}, vt.RowID(1_000_000+history.Len()+1)))461+ require.NoError(tb, history.Append(row, vt.LineBound{End: len(row)}))
462+}
463+
464+func TestAppendHistoryRowAllocatesUniqueIDsAfterEviction(t *testing.T) {
465+ history := vt.NewHistory(vt.HistoryConfig{MaxRows: 2, ChunkRows: 1})
466+ ids := make(map[vt.RowID]struct{})
467+ for range 4 {
468+ appendHistoryRow(t, history, testRow("row"))
469+ view := history.View()
470+ id := view.RowID(view.Len() - 1)
471+ require.NotContains(t, ids, id)
472+ ids[id] = struct{}{}
473+ }
474+ require.Len(t, ids, 4)
462 }475 }
463 476
464 func tabCount(sess *session) int {477 func tabCount(sess *session) int {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close