From fae8216c94738c4d52e7b836594faae7da93a9cd Mon Sep 17 00:00:00 2001 From: Colin Neilens Date: Wed, 23 Sep 2026 19:28:55 -0700 Subject: [PATCH] Wait for workspace detail children to lay out before asserting bounds PR #440 widened the workspace chrome mount loop, but its break condition tests only that the eight children are non-null. The assertion immediately afterwards tests something stronger -- that four of them have non-empty BoundingRectangle -- so the loop can exit the instant the children appear in the UIA tree, before the loop panel has laid them out. Wait for the layout to settle on exactly the condition being asserted. All 378 Require predicates remain byte-identical to main. Refs #438 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Colin Neilens --- Tools/windows/uia-live-gate.ps1 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Tools/windows/uia-live-gate.ps1 b/Tools/windows/uia-live-gate.ps1 index d4bd9afd..07bf30f9 100644 --- a/Tools/windows/uia-live-gate.ps1 +++ b/Tools/windows/uia-live-gate.ps1 @@ -1619,7 +1619,19 @@ try { Require ($null -ne $workspaceSparkline) "workspace right panel omitted metric sparkline child" Require ($null -ne $workspaceStart) "workspace right panel omitted start-time child" Require ($null -ne $workspaceUsage) "workspace right panel omitted token-usage child" - foreach ($detailChild in @($workspacePanelToggle, $workspaceSparkline, $workspaceStart, $workspaceUsage)) { + # The four detail children can be present in the UIA tree before the loop panel has + # laid them out, so existence (which the mount loop above waits for) does not imply + # non-empty bounds. Wait for the layout to settle on exactly the condition asserted + # below rather than reading BoundingRectangle the instant the children appear. + $workspaceDetailChildren = @($workspacePanelToggle, $workspaceSparkline, $workspaceStart, $workspaceUsage) + for ($attempt = 0; $attempt -lt 100; $attempt++) { + $unlaidOut = @($workspaceDetailChildren | Where-Object { + ($_.Current.BoundingRectangle.Width -le 0) -or ($_.Current.BoundingRectangle.Height -le 0) + }) + if ($unlaidOut.Count -eq 0) { break } + Start-Sleep -Milliseconds 100 + } + foreach ($detailChild in $workspaceDetailChildren) { Require (($detailChild.Current.BoundingRectangle.Width -gt 0) -and ($detailChild.Current.BoundingRectangle.Height -gt 0)) ` "workspace right panel child $($detailChild.Current.AutomationId) has empty bounds"