Repository navigation
fix(tools): report invalid UTF-8 case manifests as CaseManifestError - #689
Merged
LunaStev merged 1 commit intoSep 22, 2026
Merged
Conversation
Signed-off-by: Subiksha Jegadish <[email protected]>
LunaStev
approved these changes
Sep 22, 2026
LunaStev
left a comment
Member
There was a problem hiding this comment.
LGTM, thank you for your contribution!
Open
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.
Summary
Catch
UnicodeDecodeErrorinload_case_manifestalongsideOSErrorandTOMLDecodeError, so invalid UTF-8 in the case manifest is reported as aCaseManifestErrorthat includes the manifest path and the decoding details.Motivation
Fixes #688.
load_case_manifestintools/case_manifest.pyreads the manifest as UTF-8 but did not handle decoding errors. Invalid bytes escaped as a rawUnicodeDecodeErrorwithout the manifest path, bypassing the CLI'sinvalid case manifestdiagnostic and exit status 2.Target and compatibility impact
None. This only affects error reporting in the Python case manifest tooling. Valid manifests load unchanged, TOML syntax and filesystem errors are handled as before, and no replacement decoding is used.
Validation
test_invalid_utf8_manifest_reports_path_in_case_manifest_error: a temporary manifest containing\xffraisesCaseManifestErrorwith the manifest path and decoding context, and preserves theUnicodeDecodeErroras its cause. This test fails without the fix.test_manifest_accepts_non_ascii_utf8_comments: the repository manifest with a prepended non-ASCII UTF-8 comment loads identically to the original.python3 tools/case_manifest.py validatepointed at an invalid UTF-8 manifest printsinvalid case manifest: cannot read case manifest <path>: 'utf-8' codec can't decode byte 0xff ...and exits 2 without a traceback.python3 tools/case_manifest.py validateon the repository manifest still passes.python3 -m py_compile ...(full list from CONTRIBUTING.md) passes.python3 -m unittest tools.test_case_manifest tools.test_test_contracts tools.test_process_treepasses (38 tests, 1 Windows-only skip).Checklist
Signed-off-byline.std/.