The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): exercise production cwd setup in Windows self-test
Tekniumc32e0acb0ec5
diff --git a/scripts/desktop-update/windows.ps1 b/scripts/desktop-update/windows.ps1index b8784ff9aa6..17d4d721973 100644--- a/scripts/desktop-update/windows.ps1+++ b/scripts/desktop-update/windows.ps1@@ -1189,25 +1189,6 @@ $finalCode = 1$finalMsg = "update did not complete"$script:TreeSafeToFinalize = $true-# -SelfTestWorkingDirectory: prove StartAssigned inherits InstallRoot ---------if ($SelfTestWorkingDirectory) {- try {- $resolvedInstallRoot = Set-InstallRootCurrentDirectory $InstallRoot- } catch {- Write-Host "WORKING-DIRECTORY SELF-TEST: FAIL cannot enter the install root ($InstallRoot)"- exit 3- }- $probeExe = Join-Path $PSHOME "powershell.exe"- $probe = Invoke-HermesStep $probeExe @("-NoProfile", "-Command", "[Environment]::CurrentDirectory") "cwd"- $observed = $probe.Output.Trim()- if ($probe.Code -ne 0 -or -not [string]::Equals($observed, $resolvedInstallRoot, [StringComparison]::OrdinalIgnoreCase)) {- Write-Host "WORKING-DIRECTORY SELF-TEST: FAIL expected=$resolvedInstallRoot observed=$observed code=$($probe.Code)"- exit 1- }- Write-Host "WORKING-DIRECTORY SELF-TEST: PASS $observed"- exit 0-}-# ── -SelfTestUi: drive the shim to both terminal states, no update ─────────# Manual QA for the Edge shell without a checkout or a real update. Exits# before the marker/desktop/venv machinery — touches nothing. Off Windows@@ -1484,6 +1465,23 @@ try {exit $finalCode}+ # Exercise the production cwd setup and native launcher without updating.+ if ($SelfTestWorkingDirectory) {+ $expectedRoot = [System.IO.Path]::GetFullPath($InstallRoot)+ $probeExe = Join-Path $PSHOME "powershell.exe"+ $probe = Invoke-HermesStep $probeExe @("-NoProfile", "-Command", "[Environment]::CurrentDirectory") "cwd"+ $observed = $probe.Output.Trim()+ if ($probe.Code -ne 0 -or -not [string]::Equals($observed, $expectedRoot, [StringComparison]::OrdinalIgnoreCase)) {+ $finalMsg = "WORKING-DIRECTORY SELF-TEST: FAIL expected=$expectedRoot observed=$observed code=$($probe.Code)"+ Write-Host $finalMsg+ exit 1+ }+ $finalCode = 0+ $finalMsg = "WORKING-DIRECTORY SELF-TEST: PASS $observed"+ Write-Host $finalMsg+ exit 0+ }+# Check only the interpreter here: dependency recovery belongs to update.$pythonExe = Join-Path $InstallRoot "venv\Scripts\python.exe"if (-not (Test-Path -LiteralPath $pythonExe -PathType Leaf)) {diff --git a/tests/test_desktop_update_windows_python_handoff.py b/tests/test_desktop_update_windows_python_handoff.pyindex 5a2739641f6..e63eb9dd287 100644--- a/tests/test_desktop_update_windows_python_handoff.py+++ b/tests/test_desktop_update_windows_python_handoff.py@@ -50,13 +50,18 @@ def _handoff_source() -> str:fixture runs a synthetic PowerShell step through ``Invoke-HermesStep`` toprove the drain cannot deadlock (#90455) -- so they are not update stepsand the "must drive python.exe" rule does not apply to them. Each exits- before any marker/venv/desktop machinery runs.+ before any venv/desktop machinery runs.Scoped here rather than allow-listing a target, so the rule stays absolutefor every real step. The non-greedy match ends at the first closing brace- in column 0; the blocks' own braces are all indented.+ at the opening statement's indentation; inner braces are deeper."""- return re.sub(r"\nif \(\$SelfTest\w+\) \{.*?\n\}\n", "\n", _read(), flags=re.S)+ return re.sub(+ r"\n(?P<indent> *)if \(\$SelfTest\w+\) \{.*?\n(?P=indent)\}\n",+ "\n",+ _read(),+ flags=re.S,+ )def test_invoke_hermes_step_calls_drive_python_not_the_shim() -> None: