tooling: report unreadable torrents in verify_build as usage errors #640
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/646"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by louisdibiasi on 2026-11-22T17:28:42Z.
Change
tools/verify_build.pydecodes the torrent and reads its file list without handling a torrent that is valid bencode but not a multi-file torrent. Each of these ended in a traceback with exit status 1:KeyError: b'files'infois not a dictionary:TypeErrorUnicodeDecodeErrorValueError: Invalid torrent file list or piece lengthFileNotFoundErrorExit status 1 also means "payload failed verification" (
return 0 if report["torrent_payload_passed"] else 1), so a crash can be read as a verification result. This reports the same problems throughparser.error(exit 2, no traceback, no report written), the way manifest selection already does.Independent problem, no linked issue.
Verification
Commit under test:
c8b6dc7onbcdce96, Windows 11, Python 3.12.10.Base vs this branch,
python -B tools/verify_build.py <package> --output r.jsonon synthetic packages (an emptylayout.xmland apayload.torrent):KeyError: b'files', exit 1payload.torrent is not a readable multi-file torrent: KeyError: b'files', exit 2d4:infoi7eeTypeError: 'int' object is not subscriptable, exit 1\xffUnicodeDecodeError, exit 1ValueError: Invalid torrent file list or piece length, exit 1FileNotFoundError, exit 1cannot read <dir>: The system cannot find the file specified, exit 2New
check_unreadable_torrent_is_a_usage_errorintests/layout_chunks_check.pycovers the four torrent shapes and the missing directory (exit 2, "payload.torrent" named, noTraceback, no report file).python -B tests/layout_chunks_check.py-> AssertionError on the first case (returncode 1,KeyError: b'files').layout chunk summary ok.python -B tests/intake/check.py <build>/intake_candidate.exe <build>/intake_provider.dll(thestatic_exe_intaketest, run directly against my dev build) passes.Evidence and follow-up
Synthetic bytes only. The invalid-file-list case changes from a traceback with exit 1 to a usage error with exit 2. Found while testing: a
layout.xmlthat is not valid XML still ends in an uncaughtParseErrortraceback; I left that out to keep this PR to the torrent, and can send it separately.Checklist
AI-assisted: I used Claude to find the bug and draft the change. I ran the reproductions and tests above myself.
Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-22T18:27:11Z.
Verified on Windows 11 26100.9168 with Python 3.12.10.
python -B tests/layout_chunks_check.pyprintslayout chunk summary okat headc8b6dc7, which merges cleanly withmainat719552e.This PR edits the same two files as #643 (
tools/verify_build.py,tests/layout_chunks_check.py), and #644 also edits that test. Merging #643, #644 and #646 ontomainin that order gives no conflicts, and the combined test still printslayout chunk summary ok.AI-assisted (Claude Code).