fix: conformance tool Windows crash + remove redundant mediaType from local-business example - #69
Open
hammer-build wants to merge 1 commit into
Conversation
conformance/bin/conformance-test: reconfigure stdout/stderr to UTF-8 on startup so the tool no longer crashes on Windows (cp1252 default cannot encode the check/cross/warning symbols). Uses sys.stdout.reconfigure which is a no-op on Python < 3.7 and on terminals already in UTF-8 mode, so Linux/macOS behaviour is unchanged. conformance/examples/local-business/local-business-catalog.json: remove the redundant top-level `mediaType` field from both entries. The `type` field already carries the IANA media type; `mediaType` at entry level is not part of the ARD spec and was absent from all other catalog examples. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
hammer-build
requested review from
evalstate,
mindpower and
rvguha
as code owners
July 27, 2026 17:54
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 this fixes
Two independent issues found while running the conformance tool against the new example catalogs on Windows.
1. Conformance tool crashes on Windows (
conformance/bin/conformance-test)Problem: The tool uses
✓,✗, and⚠for output. Windows terminals default tocp1252encoding which cannot encode these characters — the tool crashes immediately before validating anything, printing aUnicodeEncodeErrortraceback.Fix: Reconfigure
stdout/stderrto UTF-8 at startup:reconfigure is available from Python 3.7+. The call is a no-op on terminals already in UTF-8 mode (Linux, macOS), so cross-platform behaviour is unchanged.
2. Redundant mediaType field in local-business example
Problem: Both entries in local-business-catalog.json have a top-level mediaType field that duplicates type:
mediaType at entry level is not part of the ARD spec — type already carries the IANA media type. It is absent from all other catalog examples (basic, fda-ndc, noaa-weather). As a teaching example, having an extra non-spec field risks confusing readers.
Fix: Remove both occurrences. All conformance checks still pass.
Testing: Verified on Windows (Python 3.13, cp1252 terminal) without setting PYTHONIOENCODING: