diff --git a/work/projects/macos-tests-worktrees-2026-10-14.md b/work/projects/macos-tests-worktrees-2026-10-14.md index f05c5d80..c5537904 100644 --- a/work/projects/macos-tests-worktrees-2026-10-14.md +++ b/work/projects/macos-tests-worktrees-2026-10-14.md @@ -18,7 +18,7 @@ All worktrees are in `/Users/admin/DuckDuckGo/apple-browsers.git/`, on bra |---|---|---|---| | `macos-unit-tests-no-app-delegate` | origin/main `ca834f869a` | Unit tests no longer use the app delegate, buildable folder, test plans | Done, not committed | | `fix-address-bar-tests-flakiness` | origin/main `ddb1a82283` | Fix flaky `AddressBarTests`: mocks plus two leak root causes | Done, not committed | -| `fix-ask-ai-chat-button-animation-leak` | origin/main `e698211924` | Ask AI Chat button animation leak plus regression test | In progress | +| `fix-ask-ai-chat-button-animation-leak` | origin/main `e698211924` | Ask AI Chat button animation leak plus regression test | Done, not committed | | ~~`animation-leak-audit`~~ | origin/main `e698211924` | Audit `NSAnimationContext` completion handlers for leaks | Done: no leaks found; worktree and branch removed | | `fix-fire-window-video-leak` | origin/main `e698211924` | Video keeps playing after a Fire Window is closed: reproduce, fix, regression test | Not reproduced: 4 guard tests only, no fix (see update below) | | `spm-browser-tests` (existing) | — | Source of the unit-test changes (SwiftPM variant) | Not changed | @@ -60,13 +60,26 @@ Branch `alex/fix-address-bar-tests-flakiness`. 3 files, +100/−6. - Isolated: 7 out of 7 runs with 0 failures and 0 restarts. Before the fix, origin/main had 1–6 failures per run. - Full Integration Tests ×2: 0 AddressBarTests failures. - The 3 remaining failures also fail on main because of this machine's settings: FireCoordinator (locale) and NTP search (`aichat.enabled=0`). -- **TODO:** reword the comment in `AddressBarButtonsViewController` to say the handler is held until the animation ends, rather than "never called". The wording will match the fix in `fix-ask-ai-chat-button-animation-leak`. +- The comment in `AddressBarButtonsViewController` was reworded on 2026-10-15 to say the completion is held until the animation ends. The handler change is now identical to the one in `fix-ask-ai-chat-button-animation-leak`. ## fix-ask-ai-chat-button-animation-leak -Branch `alex/fix-ask-ai-chat-button-animation-leak`. In progress. Separate production fix for the Ask AI Chat button animation in `AddressBarButtonsViewController` (`[weak self]`), plus a regression test. +Branch `alex/fix-ask-ai-chat-button-animation-leak`, based on origin/main `e698211924`. **Done, not committed.** 2 files, +63/−3. -- **Revised requirement after the audit:** the test must fail on main deterministically regardless of whether the display is asleep or awake. It asserts deallocation right after teardown, before the 0.2 s animation ends. +- **Fix** in `AddressBarButtonsViewController.animateAskAIChatButtonContraction()`: `[weak self]` plus `guard let self`. + - The comment explains why: the completion is deferred until the animation ends, indefinitely while the display link is paused. + - `isAskAIChatButtonExpanded` changed from `private` to `private(set)` so the test can read it. + - The rest of the file was checked: the expansion animation has no completion handler, and the `asyncAfter` and `sink` closures already use `[weak self]`. +- **Regression test:** `AddressBarTests.testWhenWindowIsClosedWhileAskAIChatButtonContracts_windowObjectsAreDeallocated`. + - It sets text in the address bar so the button expands, then calls `makeFirstResponder(nil)` to start the contraction. + - In the same autorelease pool, it closes and releases the window. + - It immediately asserts that `AddressBarButtonsViewController` and `TabCollectionViewModel` are released. There are no sleeps or waits, so the result doesn't depend on display state. +- **Results:** + - main: 10/10 FAIL (5 with the display awake, 5 asleep). + - fix: 15/15 pass (asleep, awake, and `-test-iterations 5`). + - Full `AddressBarTests`: 0 failures. `test_WhenControlTextDidChange…` sometimes crashes with SIGINT; that is the `TestRunHelper` autorelease problem fixed in `fix-address-bar-tests-flakiness`. + - Lint: 0. +- **Overlap:** `fix-address-bar-tests-flakiness` contains the same handler fix (the comment was aligned on 2026-10-15; the change is identical). Whichever lands first, the other must drop or rebase this hunk. ## animation-leak-audit (removed)