From 5fa1f5c5b386cd00476a32822dbd557c911b9eb1 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 25 Jun 2026 09:00:22 -0400 Subject: chore(todo): close collapse-split isolation bug (root-caused and fixed) --- todo.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'todo.org') diff --git a/todo.org b/todo.org index fdc0b1fea..2562cba4f 100644 --- a/todo.org +++ b/todo.org @@ -55,8 +55,9 @@ Tags are additive. For example, a small wrong-behavior fix can be =:bug:quick:=, and a feature that requires internal restructuring can be =:feature:refactor:=. * Emacs Open Work -** TODO [#C] ai-term test isolation: collapse-split leaks state breaking display-rule :bug:test: -=tests/test-ai-term--collapse-split.el= leaves window/display state that makes =test-ai-term--display-rule-routes-agent-buffer-to-right= (=tests/test-ai-term--display-rule.el:30=) fail when collapse-split runs before it in the suite. Bisected to those two files: loading just them together reproduces it; display-rule passes in isolation, and pairs cleanly with every other geometry test (default-geometry / reuse-edge-window / single-window-toggle). Both files predate this session and neither uses the 2026-06-25 ai-term-next rework (collapse-split drives =cj/ai-term= the dispatch; display-rule tests the display rule), so it is pre-existing and unrelated to that change — surfaced when the full ai-term suite was run. Ruled out: it is NOT the frame size (stays 80x25), NOT =split-width-threshold= / =split-height-threshold= (stay 160/80), NOT a window parameter on the selected window (all nil after =delete-other-windows=), and forcing =split-width-threshold= low does not restore the directional right-split. So collapse-split's GUI dispatch (=cj/test--call-as-gui #'cj/ai-term=) leaves some deeper =display-buffer-in-direction= state that survives =save-window-excursion= + =delete-other-windows=. Fix direction: instrument what the dispatch mutates (likely in =cj-window-geometry-lib= / =cj-window-toggle-lib=) and restore it in collapse-split's teardown, or have display-rule build its split in a hermetic frame. Until then the full ai-term suite shows this one red. +** DONE [#C] ai-term test isolation: collapse-split leaks state breaking display-rule :bug:test: +CLOSED: [2026-06-25 Thu] +Root cause found: the display rule's 4th action =cj/--ai-term-display-saved= splits per the globals =cj/--ai-term-last-direction= / =cj/--ai-term-last-size=, captured on the last toggle-off. The collapse-split multi-window and single-window tests call =cj/ai-term= (which captures those globals) but only let-bound =cj/--ai-term-last-was-bury=, so they leaked =last-direction= = below into =display-rule=, which then split below (left-col 0) instead of right (left-col 40). Confirmed by instrumenting: every window/split global was identical fresh vs after-collapse, but the leaked =last-direction= flipped the directional split. Fix: let-bind =cj/--ai-term-last-direction= + =cj/--ai-term-last-size= to nil in both collapse-split tests, isolating the capture-state globals the way the roundtrip test in the same file already does. Full ai-term suite now 158/158 green. ** TODO [#B] eww User-Agent advice may not inject under Emacs 30 :bug: The UA-injection advice =my-eww--inject-user-agent= (=modules/eww-config.el:47=) gates on =(derived-mode-p 'eww-mode)= and is an =:around= on =url-retrieve= / =url-retrieve-synchronously=. Its tests (=tests/test-eww-config-user-agent-advice.el=) fail under =make test=: =test-eww-ua-injected-in-eww-buffer= (:21) and =test-eww-ua-replaces-existing-and-keeps-other-headers= (:42) both see no injected UA, because =(derived-mode-p 'eww-mode)= returns nil in the test's temp buffer where the mode is set with a bare =(setq major-mode 'eww-mode)=. Two possibilities: (a) test-only artifact — a bare setq doesn't establish the mode the way =derived-mode-p= now resolves it, so the test should set the mode properly (call =eww-mode=, or set =derived-mode-parent=); or (b) a real Emacs-30 =derived-mode-p= change that means the advice no longer fires in real eww buffers either, so the desktop User-Agent isn't actually sent. Check (b) first: in a live eww page, =M-: (derived-mode-p 'eww-mode)= — if nil, the gate is broken in production (fix to =(eq major-mode 'eww-mode)= or =provided-mode-derived-p=). If only the test is wrong, fix its mode setup. Pre-existing (eww-config + test unchanged this session); surfaced 2026-06-25 running the full suite during the google-keep work. The third test (=test-eww-ua-not-injected-outside-eww=) passes. ** TODO [#B] first f12 doesn't toggle the term window :bug:solo: -- cgit v1.2.3