fix(cli): tolerate undecodable alias lookup output - #48838
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved — hardened subprocess text decoding.
- 2 files changed (+59/-0)
- Hardens text subprocess decoding for edge cases
- No security concerns, no debug artifacts
Reviewed by Hermes Agent
|
Thanks for targeting a real Windows decoding failure. The current-head reproduction path is still present at Problems
Suggested changes
This is an automated hermes-sweeper review. |
07df3ec to
2c3b8f2
Compare
|
Updated in response to the latest hermes-sweeper review. Changes:
Validation:
I also refreshed duplicate/fix-existence checks. #55339 overlaps this production call as part of a 76-file sweep, but has no test files or |
|
Closing this because current |
What does this PR do?
Fixes the current Windows/profile-alias decoding failure in #47939 without changing process-global subprocess behavior.
check_alias_collision()invokeswhere/whichwithtext=True. If that command emits bytes that the platform-selected text codec cannot decode,subprocess.run()can raiseUnicodeDecodeErrorbefore Hermes can handle the lookup result.This patch adds
errors="replace"only at that call site. It deliberately preserves Python's platform-default codec for localized Windows command output and avoids the previous import-timesubprocess.Popen.__init__monkeypatch.Related Issue
Fixes #47939
Type of Change
Changes Made
hermes_cli/profiles.py: tolerate undecodable bytes from the alias lookup subprocess with a localizederrors="replace"policy.tests/hermes_cli/test_profiles.py: exercise the realcheck_alias_collision()path with a subprocess that emits undecodable stderr.Validation
origin/main: the targeted regression failed incheck_alias_collision()withUnicodeDecodeError.tests/hermes_cli/test_profiles.py— 156 passed.git diff --check— passed.Duplicate / overlap check
check_alias_collision().origin/main.Checklist
Screenshots / Logs
Not applicable; this is a CLI subprocess-decoding path with no UI changes.