tooling: read the localized Write-Warning prefix in startup_run_ps1 #2263
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2271"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by alvaroolt on 2026-11-25T09:04:11Z.
Change
tests/startup_run_ps1_check.py(cteststartup_run_ps1) expects the-FakeUserwarning that #2167 added totools/startup/run.ps1asWARNING: Without -FakeUser, user API calls go to the host gaming runtime (docs/startup-runtime.md).PowerShell localizes theWrite-Warningprefix with the host's UI language. On Spanish Windows it printsADVERTENCIA: ..., so every case without-FakeUserfails, althoughrun.ps1behaves as intended:Because
main()skips the mutants once the real script fails, none of the mutant controls ran on such a host either.The check now reads the prefix from each shell under test. It runs
Write-Warning '<probe text>'with-NoProfile -Commandin the same environment asrun.ps1(includingNO_COLOR=1). The output must be exactly one line that ends with the probe text after a non-empty prefix, or the check stops with a diagnostic. The warning line is still compared exactly, as<prefix><message>. A new mutant replacesWrite-WarningwithWrite-Hostfor the same text. The run must still reject it, which shows that the prefix is checked and not just stripped.run.ps1is unchanged. No issue.Related: #2167 added the warning and its expected line. #2217 made the same comparison independent of ANSI colors with
NO_COLOR=1, which the probe also uses. Neither covers a localized prefix.Verification
Environment: Windows 11 10.0.26300.9974 (UI language es-ES), Windows PowerShell 5.1.26100.9818 (
pwshnot installed), Python 3.12 (out/pe-env), MSVC 14.52, Windows SDK 10.0.26100. Commit766f83e2on upstreammain1a713de0.Controls, run from a scratch script against the changed module:
'ADVERTENCIA: '.run.ps1with the prefix forced to the old'WARNING: ': 1 problem per case. This is the failure onmain.Write-Hostmutant with the probed prefix: rejected (printed ['Without -FakeUser, ...', ...]).Write-Hostmutant with the prefix forced to'': no problem reported. Without the prefix comparison, the mutant would pass.On
766f83e2:Full suite on the previous base
28e5f4d6plus the same test change (NVIDIA GeForce RTX 5080, AMD Radeon iGPU, WARP; debug layer unavailable). The rebase brought no change totests/startup_run_ps1_check.pyortools/startup/run.ps1.The failure in both runs is
rdna2_tools_check, because this host has nollvm-mconPATH. WithLLVM_LIB,LLVM_MC(LLVM 15.0.7) andLLVM_OBJCOPYset, it passes:Ran 156 tests ... OK (skipped=1). This change does not touch it. Thedevsuite on28e5f4d6without this change gave the same 1532 tests and 38 skips. Its only failures werestartup_run_ps1and the samerdna2_tools_check.Evidence and follow-up
Not measured: an English host, where the probe should return
WARNING:and the check should behave as before (the Windows CI job covers this), andpwsh, which is not installed here. It takes the same probe path.Observed once, unrelated to the prefix: in one
run_checks_parallel.pyrun on766f83e2, the-Translatecase with debugger exit 7 failed withrun.ps1 exited 1. The stderr was aNativeCommandErrorfromtaskkill.exe /T /Fon line 79 ("ERROR: el proceso con PID … (proceso secundario de PID …)"). With$ErrorActionPreference = "Stop", Windows PowerShell 5.1 turns the redirected stderr of a native command into a terminating error. The check then passed in 8 of 8 serial runs, in 8 of 8 runs started at once, and in a second fullrun_checks_parallel.pyrun. This PR does not change that line.Checklist
This change was AI-assisted (Claude Code); I reviewed the diff and the test results.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T09:09:52Z.
Review: COMMENTED
Review of head
766f83e2853ae3c7a3f5bf6fad03c0ce67f25e11(test-only change totests/startup_run_ps1_check.py).Findings: 0 P1, 0 P2.
WARNING:. The prefix is read once per shell by runningWrite-Warningon a probe string, with the same environment asrun.ps1, then cached. This is correct for localized hosts (for example a Spanish UI).Write-Host) is a real behavior regression the old test could also have missed on a non-English host. It is now rejected.Commands executed locally:
python3 tests/docs_links_check.py: pass (18 files, 433 links)python3 tests/bidi_controls_check.py: passgit diff --check origin/main...HEAD: cleanpython3 tests/startup_run_ps1_check.pyon Linux: text-only (no PowerShell host here), exit 0python3 x2w_pipe.py win2025 2271: Windows Server 2025, dev and release /O2,ctest -R '^startup_run_ps1$'1/1 passed in both. This run executes the check's built-in mutants, including the new Write-Host one, and the test passed, so every mutant was rejected.Notes:
Build and test on Windows: pass.tests/mesh_*checks only. They are not touched by this diff. The branch is 7 commits behind main.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T09:11:23Z.
Independent Windows test of
766f83e2on build 26100.9711 with Python 3.14.3, Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9:Both shells emitted
WARNING:under their default settings. I exercised the newWrite-Hostmutation directly with each shell. Both rejected it at the output-line comparison.I also selected
zh-CNfor the current thread in the Windows PowerShell 5.1 probe and the scratch copy of the launcher, using[Threading.Thread]::CurrentThread.CurrentUICulture = [Globalization.CultureInfo]::GetCultureInfo('zh-CN'). The real shell emitted警告:(UTF-8 bytese8 ad a6 e5 91 8a 3a 20). With that prefix, the real warning passed the exit-2 case and theWrite-Hostmutation failed the line comparison. This culture override was limited to those test processes.