detached 1105732

test(daemon): cover datagram output window coalescing

commit
11057325a9035cf8dbf457e442282307542375e7
author
brice · · 2026-07-10 11:07 UTC
parent
e25b377
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +37 -0
M internal/usecase/daemon/output_state_sync_test.go +37 -0
@@ -268,3 +268,40 @@ func TestFailedPaintSendRollsBackOutputState(t *testing.T) {
268268 require.Zero(t, ac.output.next)
269269 require.Zero(t, ac.output.acked)
270270 }
271+
272+func TestDatagramWindowOneCoalescesPaintsUntilMsgAck(t *testing.T) {
273+ p, releasePTY := newBlockingPTY(t)
274+ defer releasePTY()
275+ d, sess, _, _ := newManualSessionWithPTYs(t, p)
276+ tr := newDatagramTestTransport()
277+ _, ac, err := d.route(ports.Hello{
278+ Version: ports.ProtocolVersion,
279+ Intent: ports.IntentAttach,
280+ Name: sess.name,
281+ Size: domain.Size{Cols: 80, Rows: 24},
282+ MaxOutputInFlight: 1,
283+ }, tr)
284+ require.NoError(t, err)
285+
286+ pane := sess.tabs[0].focusedPane()
287+ pane.screen.Write([]byte("A"))
288+ d.paint(sess, ac, false)
289+ first := awaitFrame(t, tr.sends, ports.MsgOutput)
290+ firstOutput, err := ports.UnmarshalOutput(first.Payload)
291+ require.NoError(t, err)
292+ require.Equal(t, uint64(1), firstOutput.NewStateNum)
293+ for range 100 {
294+ pane.screen.Write([]byte("x"))
295+ d.paint(sess, ac, false)
296+ }
297+ requireNoOutputFrame(t, tr.sends)
298+
299+ tr.recv <- ports.Frame{Type: ports.MsgAck, Payload: ports.MarshalAck(ports.Ack{AckedStateNum: firstOutput.NewStateNum})}
300+ require.NoError(t, tr.Close())
301+ d.runConnLoop(ac)
302+ second := awaitFrame(t, tr.sends, ports.MsgOutput)
303+ secondOutput, err := ports.UnmarshalOutput(second.Payload)
304+ require.NoError(t, err)
305+ require.Equal(t, firstOutput.NewStateNum, secondOutput.BaseStateNum)
306+ require.Equal(t, uint64(2), secondOutput.NewStateNum)
307+}
@@ -268,3 +268,40 @@ func TestFailedPaintSendRollsBackOutputState(t *testing.T) {
268 require.Zero(t, ac.output.next)268 require.Zero(t, ac.output.next)
269 require.Zero(t, ac.output.acked)269 require.Zero(t, ac.output.acked)
270 }270 }
271+
272+func TestDatagramWindowOneCoalescesPaintsUntilMsgAck(t *testing.T) {
273+ p, releasePTY := newBlockingPTY(t)
274+ defer releasePTY()
275+ d, sess, _, _ := newManualSessionWithPTYs(t, p)
276+ tr := newDatagramTestTransport()
277+ _, ac, err := d.route(ports.Hello{
278+ Version: ports.ProtocolVersion,
279+ Intent: ports.IntentAttach,
280+ Name: sess.name,
281+ Size: domain.Size{Cols: 80, Rows: 24},
282+ MaxOutputInFlight: 1,
283+ }, tr)
284+ require.NoError(t, err)
285+
286+ pane := sess.tabs[0].focusedPane()
287+ pane.screen.Write([]byte("A"))
288+ d.paint(sess, ac, false)
289+ first := awaitFrame(t, tr.sends, ports.MsgOutput)
290+ firstOutput, err := ports.UnmarshalOutput(first.Payload)
291+ require.NoError(t, err)
292+ require.Equal(t, uint64(1), firstOutput.NewStateNum)
293+ for range 100 {
294+ pane.screen.Write([]byte("x"))
295+ d.paint(sess, ac, false)
296+ }
297+ requireNoOutputFrame(t, tr.sends)
298+
299+ tr.recv <- ports.Frame{Type: ports.MsgAck, Payload: ports.MarshalAck(ports.Ack{AckedStateNum: firstOutput.NewStateNum})}
300+ require.NoError(t, tr.Close())
301+ d.runConnLoop(ac)
302+ second := awaitFrame(t, tr.sends, ports.MsgOutput)
303+ secondOutput, err := ports.UnmarshalOutput(second.Payload)
304+ require.NoError(t, err)
305+ require.Equal(t, firstOutput.NewStateNum, secondOutput.BaseStateNum)
306+ require.Equal(t, uint64(2), secondOutput.NewStateNum)
307+}

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