From: Anderson A. Giacomolli Date: Wed, 11 Nov 2026 14:38:34 +0000 (-0300) Subject: Correct the remaining review style findings X-Git-Url: https://git.giacomolli.uk/onechat/commitdiff_plain/0cb73c3dde36d0078f3c1aa4200f2edcb5ceed38?ds=inline Correct the remaining review style findings Multiline callbacks and literals keep their required separators even when the next operation has its own error assertion. The hook test comment uses the repository reflow tool without changing fixtures. View layout comments explain the current prompt-cache contract instead of retaining historical measurements. Issue: 3cdc678 --- diff --git a/.githooks/commit-msg-test b/.githooks/commit-msg-test index d7499ae..bed3275 100755 --- a/.githooks/commit-msg-test +++ b/.githooks/commit-msg-test @@ -25,8 +25,8 @@ reject() { grep -q "$1" "$work/output" } -# The next word has 13 characters. Its preceding line has 60, so the -# combined line has 74 characters and cannot fit the 72-column limit. +# The next word has 13 characters. Its preceding line has 60, so the combined +# line has 74 characters and cannot fit the 72-column limit. accept <<'MESSAGE' Reflow comments and expand event literals diff --git a/daemon_message_test.go b/daemon_message_test.go index 3cca09f..a7792e8 100644 --- a/daemon_message_test.go +++ b/daemon_message_test.go @@ -664,6 +664,7 @@ func TestMissingWhatsAppRouteChildFallsBackToRoot(t *testing.T) { ID: whatsappTestAna.String(), Name: "Ana", } + require.NoError(t, test.messages.routes.Set("whatsapp:"+chat.ID, "Missing")) whatsappRouteTestAdd(t, inbox, chat, "Please check the plan.") require.NoError(t, inbox.deliver(t.Context(), test.loops[0], WhatsAppLink{}, true)) @@ -819,6 +820,7 @@ func TestQueuedWhatsAppBatchUsesRootIfItsChildIsRemoved(t *testing.T) { ID: whatsappTestAna.String(), Name: "Ana", } + require.NoError(t, first.messages.routes.Set("whatsapp:"+chat.ID, "Garden")) whatsappRouteTestAdd(t, inbox, chat, "Keep the gate plan.") require.NoError(t, inbox.deliver(t.Context(), first.loops[0], WhatsAppLink{}, true)) @@ -853,6 +855,7 @@ func TestRoutedWhatsAppBatchesCanCloseOutOfNumberOrder(t *testing.T) { Name: "Garden plans", Group: true, } + require.NoError(t, test.messages.routes.Set("whatsapp:"+first.ID, "Garden")) require.NoError(t, test.messages.routes.Set("whatsapp:"+second.ID, "Garden")) @@ -901,6 +904,7 @@ func TestWhatsAppCatchupSeparatesChildAndRootBatches(t *testing.T) { ID: whatsappTestAna.String(), Name: "Ana", } + require.NoError(t, test.messages.routes.Set("whatsapp:"+garden.ID, "Garden")) require.NoError(t, test.messages.routes.Set("whatsapp:"+library.ID, "Library")) inbox.waitForCatchup() @@ -937,6 +941,7 @@ func TestRoutedWhatsAppQueueFailureKeepsTheInboxBatch(t *testing.T) { ID: whatsappTestAna.String(), Name: "Ana", } + require.NoError(t, first.messages.routes.Set("whatsapp:"+chat.ID, "Garden")) require.NoError(t, os.Mkdir(first.messages.path, 0o700)) whatsappRouteTestAdd(t, inbox, chat, "Keep the gate plan.") diff --git a/view_layout.go b/view_layout.go index 560abb2..a88c8fd 100644 --- a/view_layout.go +++ b/view_layout.go @@ -18,9 +18,9 @@ const viewLayoutFileName = "layout.json" // grow between batches. The view goes out as the same messages as in the // request before, while their lines give the same text, and the new lines // follow as one new message. So the end of the view of each earlier turn stays -// a message end. On the ChatGPT backend, the first request of a turn with this -// layout read the view of the turn before from the prompt cache in each of 10 -// turns, and with the view in one message it missed once in 5. +// a message end. Stable message boundaries let the model reuse the unchanged +// view prefix from its prompt cache instead of invalidating it when new lines +// arrive. // // The first message starts with "\n". The closing tag goes into the state // message after the view, so that no view message changes when lines come. The diff --git a/whatsapp.go b/whatsapp.go index 91ee675..df43e8e 100644 --- a/whatsapp.go +++ b/whatsapp.go @@ -309,6 +309,7 @@ func (w *WhatsApp) Run(ctx context.Context, l *TurnLoop, notify func(Event)) err cancel := func() { } + defer func() { cancel() pairing.Wait() diff --git a/whatsapp_fake_helper_test.go b/whatsapp_fake_helper_test.go index 1fca3b0..4f12a16 100644 --- a/whatsapp_fake_helper_test.go +++ b/whatsapp_fake_helper_test.go @@ -439,6 +439,7 @@ func whatsappTestSession(t *testing.T, dir string, linked bool) { AccountSignatureKey: make([]byte, 32), DeviceSignature: make([]byte, 64), } + require.NoError(t, device.Save(t.Context())) }