From 062dffab26d24cb109e8e93e1612eacef9fa88c3 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 7 Oct 2026 05:15:08 -0700 Subject: [PATCH] test(desktop-update): a hand-off log read racing Add-Content retries, not fails test_script_killed_before_publishing_the_delegate_runs_no_update failed on the Windows arm64 lane with PermissionError reading logs/desktop-update-handoff.log: windows.ps1 appends each line with Add-Content, and a poll that lands while that write holds the file is a Windows sharing violation, not a missing line. The poll helper now retries the read (5 s budget) instead of failing the test on it. Same test is green on main's latest arm64 run; nothing in this PR touches the desktop-update scripts. --- .../scripts/desktop_update/windows_handoff_support.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/scripts/desktop_update/windows_handoff_support.py b/tests/scripts/desktop_update/windows_handoff_support.py index 3b731ff584..89b73d81ae 100644 --- a/tests/scripts/desktop_update/windows_handoff_support.py +++ b/tests/scripts/desktop_update/windows_handoff_support.py @@ -88,8 +88,16 @@ def _op(home: Path, *args: str) -> tuple[int, str, str]: def _log(home: Path) -> str: + """The hand-off log so far. windows.ps1 appends with Add-Content, which holds the file without + read sharing for the length of each write: a read landing in that window is a sharing + violation (PermissionError), not a missing line, so it is retried.""" path = home / 'logs/desktop-update-handoff.log' - return path.read_text(encoding='utf-8-sig') if path.exists() else '' + for _ in range(50): + try: + return path.read_text(encoding='utf-8-sig') if path.exists() else '' + except PermissionError: + time.sleep(0.1) + return path.read_text(encoding='utf-8-sig') def _custodian(home: Path, handoff: int) -> str: