Fix Windows UTF-8 stdout crash and Win11 OS-name label in self-check#1
Open
luisassardo wants to merge 1 commit into
Open
Fix Windows UTF-8 stdout crash and Win11 OS-name label in self-check#1luisassardo wants to merge 1 commit into
luisassardo wants to merge 1 commit into
Conversation
First run of the Windows checks on real hardware surfaced two issues: - engine/selfcheck.py: on Windows, sys.stdout defaults to the legacy cp1252 codec and json.dump(..., ensure_ascii=False) crashed on the Unicode in findings (e.g. the right-arrow character). Force stdout and stderr to UTF-8 in main(); no-op on macOS/Linux. The JSON-on-stdout contract requires UTF-8, and the Tauri shell consumes this stdout. - engine/checks_windows/cat01_updates.py: derive the display OS name from the build number instead of registry ProductName, which still reads 'Windows 10 Pro' on Windows 11. Evidence now shows 'Windows 11 Pro'. Validated on Windows 11 (build 26200.8117): selfcheck exits 0, 24 findings, and the report/PDF/.age export all work in the Tauri app. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Two Windows-specific fixes surfaced by the first run of the checks on real Windows 11 hardware.
1.
engine/checks_windows/cat01_updates.py— misleading OS label in WIN-CAT01-001 evidenceThe OS-version check derived its title from the build number (correct), but the evidence field printed the raw registry
ProductName. On Windows 11 that key still literally readsWindows 10 Pro— a long-standing Microsoft quirk;HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductNamewas never updated for Win11. The report therefore showed a confusingWindows 10 Proline on Win11 devices.Now the evidence derives the OS name from the build number (
>= 22000⇒ "Windows 11") while preserving the SKU suffix (Pro,Home, …) recovered fromProductName. Evidence reads:2.
engine/selfcheck.py— UTF-8 stdout crash on WindowsOn Windows,
sys.stdoutdefaults to the legacy cp1252 codec, which cannot encode the Unicode in findings (e.g. the→arrow), crashingjson.dump.main()now forces stdout/stderr to UTF-8. The JSON-on-stdout contract requires UTF-8, and macOS/Linux are already UTF-8 so thereconfigurecall is a no-op there.Why
Both bugs only manifest on Windows; the OS-label one produces a confusing report, the UTF-8 one is a hard crash.
Verification
python -m engine.selfcheck --prettyon Windows 11 (build 26200.8117): exits 0, returns 24 findings, and WIN-CAT01-001 now shows:Windows 11 build 26200.8117 is on a supported version(PASS)Windows 11 Pro/Version: 25H2/Build: 26200.8117Reviewer notes
ProductNameSKU is preserved; ifProductNameis empty or just"Windows", evidence falls back cleanly toWindows 11with no dangling suffix.src-tauri/Cargo.tomlline-ending (LF→CRLF) change in the working tree was intentionally left out — it has no content diff.🤖 Generated with Claude Code