Skip to content

attach-artifacts-utf8 - #897

Merged
jeffreyaven merged 1 commit into
mainfrom
fix/attach-artifacts-utf8
Nov 5, 2026
Merged

jeffreyaven merged 1 commit into
mainfrom
fix/attach-artifacts-utf8

Conversation

@jeffreyaven

Copy link
Copy Markdown
Member

Fixes the crash hit on the first v1.0.888 dry run of cicd/python/attach_build_artifacts.py on Windows (release process step 2):

UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 116223
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

What changes

  • gh() decodes the subprocess output as UTF-8 (errors='replace') instead of the console code page. gh always writes UTF-8; with text=True alone, Windows decoded it as cp1252, the stdout reader thread died on the first unmappable byte and completed.stdout came back as None.
  • tag_commit() asks the commits endpoint for .sha only via --jq. Unfiltered, that endpoint returns the full diff of the tagged commit (over 100 KB for the plugin-submissions #896 squash), which is where the unmappable byte came from.

Two files touched: the script and its unit tests.

Test plan

  • python -m pytest cicd/python/test_attach_build_artifacts.py: 9 passed, including two new regression tests (UTF-8 decoding kwargs on the gh call; tag_commit requests only the sha and strips it).
  • python cicd/python/attach_build_artifacts.py 1.0.888 --dry-run on Windows with the fix applied, against the real v1.0.888 release.
  • No Go or query behaviour change, so no robot scenario.

🤖 Generated with Claude Code

Decode gh output as UTF-8 in cicd/python/attach_build_artifacts.py and
fetch only the sha when resolving the tag commit.

On Windows subprocess.run(text=True) decodes with the console code page
(cp1252). The commit endpoint returns the whole diff of the tagged commit,
and the first byte cp1252 cannot map crashed the stdout reader thread, so
stdout was None and the script died with a TypeError before attaching
anything (seen on the v1.0.888 dry run). gh always writes UTF-8, so decode
as UTF-8 with errors=replace; tag_commit now passes --jq .sha so the diff
is not fetched at all. Two regression tests cover both.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jeffreyaven
jeffreyaven merged commit 2cfce65 into main Nov 5, 2026
39 checks passed
@jeffreyaven
jeffreyaven deleted the fix/attach-artifacts-utf8 branch November 5, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant