From 6f5cbac92d1a569a60fc06bf1c9b993b4a5abc20 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Mon, 7 Sep 2026 20:23:48 -0700 Subject: [PATCH] fix: reject native window timeouts before screenshot acceptance Require the OneNote page frame and successful activation instead of accepting zero-valued AutoHotkey wait results or the transient startup frame. A timed-out window wait now fails before subsequent UI actions. Verified actual missing-modal failure and successful native page-frame navigation on a disposable Windows clone; native-runner regression tests pass. Assisted-by: gpt-6-astra --- tools/native_runner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/native_runner.py b/tools/native_runner.py index 4eaacdbf651ab106b67a6e51b73ed3588b50db32..f02c537bb1627e41c9b134db7ec3fdf8616080a7 100644 --- a/tools/native_runner.py +++ b/tools/native_runner.py @@ -176,8 +176,10 @@ def capture(notebook, output, expected_pages=-1, author=None, screenshots=False, 'OnError((exception, mode) => (FileAppend(exception.Message, "**"), ExitApp(1)))\n' 'DetectHiddenWindows false\napp := ComObject("OneNote.Application")\n' f'app.NavigateTo("{page_id}", "", false)\n' - 'hwnd := WinWait("ahk_exe ONENOTE.EXE",, 10)\n' - 'WinMaximize(hwnd)\nWinActivate(hwnd)\nWinWaitActive(hwnd,, 10)\n', + 'hwnd := WinWait("ahk_class Framework::CFrame ahk_exe ONENOTE.EXE",, 10)\n' + 'if !hwnd\n throw Error("OneNote window did not appear")\n' + 'WinMaximize(hwnd)\nWinActivate(hwnd)\n' + 'if !WinWaitActive(hwnd,, 10)\n throw Error("OneNote window did not become active")\n', target=name, shot_delay_ms=1500) page.with_suffix('.navigation.json').write_text(json.dumps({k: v for k, v in result.items() if k != 'png_b64'}, indent=2)) if result.get('png_b64'): -- 2.54.0