fix(cli): preserve detect_runtime_binary --version output on cp1252 Windows consoles#893
Open
4gjnbzb4zf-sudo wants to merge 1 commit into
Conversation
Contributor
Author
|
TL;DR — |
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.
{"schema":"spark-compete-hotfix-v1","team":{"name":"SparkThisUp","contact_handle":"@ValhallaBuilder","device_holder_github":"4gjnbzb4zf-sudo"},"target_repo":{"id":"vibeforge1111/spark-cli","branch":"master"},"finding":{"title":"detect_runtime_binary drops node/python/npm --version output as UnicodeDecodeError on Windows cp1252 consoles","summary":"detect_runtime_binary runs ' --version' with subprocess.run(text=True) and timeout=5, but never sets encoding. It already catches OSError and TimeoutExpired into a structured failure dict; UnicodeDecodeError is NOT caught. On Windows VPS hosts with cp1252/cp936 consoles, several runtime binaries emit non-ASCII bytes in their --version banner: 'uv 0.x.x (...) Copyright (c) ...' includes an em-dash on some versions, npm has translated banners with LANG, and Node's --no-warnings notice can carry locale-translated text when shimmed. When subprocess.run decodes with the platform default, UnicodeDecodeError escapes the OSError-only except block and aborts 'spark doctor', 'spark verify --onboarding', and 'spark autostart status' with a raw traceback — the exact diagnostic surfaces the operator needs to recover.","severity":"medium","category":"reliability","owner_surface":["spark-cli"],"reproduction":{"steps":["1. Windows VPS, chcp 1252, LANG=de_DE or zh_CN.","2. Install uv with a --version banner containing the em-dash (or use a shim that wraps node with a translated banner).","3. Run 'spark doctor' — detect_runtime_binary('uv') / ('npm') / ('node') is called in the runtime probe.","4. UnicodeDecodeError replaces the structured {present, path, version, error} dict and aborts the doctor flow."],"evidence_types":["redacted_terminal_excerpt"],"redacted_terminal_excerpt":"UnicodeDecodeError: 'charmap' codec can't decode byte 0x96 in position 12"},"proposed_fix":{"strategy":"Add encoding='utf-8', errors='replace' to the subprocess.run that probes ' --version'. Two-line additive change. Matches the recipe sister fix #872 used for run_git_or_exit, #884 used for run_autostart_helper, #886 used for write_windows_startup_script, and our PRs #888/#890/#891/#892 used across the module install+update chain.","files_expected":["src/spark_cli/cli.py"],"diff_size_estimate_lines":2},"material_new_value":"Closes the doctor / verify / autostart Windows-cp1252 crash window for runtime-binary version probes — a distinct surface from the install/update chain. R24 batch has accepted multiple sibling encoding fixes. Dedup vs #872 (run_git_or_exit, git only), #884 (autostart helper), #886 (PowerShell startup writer), and our open PRs (#888/#890/#891/#892, all module install+update git): detect_runtime_binary is a separate diagnostic call site driving 'spark doctor', not git.","honest_severity_basis":"Medium because doctor is the operator's first recovery surface when something is wrong; a crash inside the runtime-probe loop forces operators to debug Python tracebacks instead of getting the shaped {present, path, version} report.","confidence_score":0.9}}