Repository navigation
Release workflow: hold the wheel to its declared layout and refuse NUL names, name a bad TestPyPI answer in the fetch, and count the macOS rerun's lines in the contract's form (opensoft/openRepoTools#352 items 4 to 6) - #26
Conversation
…yte and refuse NUL names; name a bad TestPyPI answer in the install fetch (opensoft/openRepoTools#352 follow-ups 5 and 6) Follow-up 5 of opensoft/openRepoTools#352. zipfile finds a member through the central directory, cuts it at its declared size, checks the CRC of that part alone, and reads nothing of its local header but the name; a name with a NUL byte it reads as the part before the NUL. So a wheel could carry bytes the check never read: past a member's declared size, between members, after the end record, or in a directory entry, and a reader walking the local headers could find other files. The build job's wheel check now also runs `unaccounted` once every member has been read: from byte 0, each local header must be its central entry's fields again (signature, version, flags, method, time, date, CRC-32, sizes, name) with no extra field; each member's data must be exactly its declared compressed bytes, a stored member as many as it declares and a deflated one a single stream ending at their last byte, giving exactly its declared size and CRC-32 (`unlike_declared`); the members must follow one another with nothing between them; and the central directory, with no extra field or comment, then the end record, with no comment, must end the file where zipfile read them. A directory entry must hold no data, and a name with a NUL byte is refused. Each is one named `::error::` line. #23's cap, method allow-list and read loop are unchanged and run first. hatchling 1.27.0 wheels (two local builds, TestPyPI's 1.1.0rc1, PyPI's 1.1.0) pass it unchanged. Follow-up 6. The install job's "fetch the wheel from TestPyPI" step read the answer with no handler. It now catches ValueError, KeyError, TypeError, AttributeError and RecursionError as the index checks do, and exits 1 with one `::error::` line naming the URL and the error; its two other refusals now carry `::error::` too. Tests: eight wheels not laid out as they declare, each read cleanly by zipfile.testzip() and each giving exactly its one `::error::` line, and three TestPyPI answers (not JSON, no `urls`, nested 100,000 deep, the last taking RecursionError or the TypeError of a decoded list by the interpreter). The fetch's existing refusals now assert one `::error::` line. The CD-walking helpers `damage` used are shared, unchanged in effect. Lane: openRepoTools-3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ommand>: installed at <its bin>/<command>`, then sixteen `... (unchanged)` (opensoft/openRepoTools#352 item 4) Item 4 of opensoft/openRepoTools#352, "The macOS rerun is unchanged", checked against the 006 workflows contract as opensoft/openRepoTools-spec#18 left it (e6eaa3c on spec main, step 6 of the install job). The rerun still exists, and since opensoft/openRepoTools#278 (b373ccc, 9ed4734) it already has a fresh HOME and a bin directory of its own holding a copy of pipx's link, requires BASH_VERSION 3.2, and runs --install twice there. What still differed from the contract was the two counts: they took any line holding ": installed at $bin_dir/", and any holding ": already installed at $bin_dir/" and " (unchanged)", where the contract asks for 16 lines of the form `<file>: installed at <that directory>/<file>` and then 16 of the form `<file>: already installed at <that directory>/<file> (unchanged)`. Both counts now go through `exact`, an awk count of lines that are exactly `<command>: <said> $bin_dir/<command><after>`: one command named on both sides and nothing more. A line naming another file at the end of its path, or with more after " (unchanged)", is no longer one of the sixteen. The refusal lines are unchanged. Tests: MACOS_RERUN_LINES names the new lines, so the rerun is still held to the offline --install line for line. The new test_release_install_check_the_macos_rerun_counts_only_the_contract_s_lines runs the rerun with pipx's link pointing at FAKE_INSTALL, a stand-in --install that prints the case's lines. Sixteen lines of the contract's form each run pass. A placed line naming another file, and an unchanged line with more after it, each exit 1 with the exact `::error::` line naming 15; both passed under the old counts. The opensoft/openRepoTools#278 rerun test over a real venv passes unchanged. Lane: openRepoTools-3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideConfigurationReview the wheel-layout and member-data checks together with their invocation and error handling, which ensure the release check accounts for every wheel byte and rejects NUL names.
Review the TestPyPI fetch’s URL handling and error reporting together, so malformed answers and invalid file-host listings fail with a named error before any wheel is fetched.
Review the macOS rerun’s exact-line counting logic together with its contract comment, ensuring only the required placement and unchanged lines count.
TestsReview the synthetic wheel builders and wheel-check cases together to verify malformed layouts, hidden data, NUL names, and wheels the checker cannot open or walk are refused as expected.
Review the fetch-test setup and cases together to verify malformed TestPyPI answers and invalid listings produce one error and trigger no wheel download.
Review the macOS rerun’s updated line-for-line contract and its stand-in installer cases together to verify near-matching lines no longer satisfy either count.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…m the directory, name a negative member offset, a bad UTF-8 name and an extract version above 6.3 (opensoft/openRepoTools#352) Fix round 1 on the independent review of #26 (opensoft/openRepoTools#352 follow-up 5), its two SHOULDs and NIT 3. SHOULD 1: zipfile reads the central directory as one buffer and cuts the last record's name, extra field and comment at its end, so a last record declaring a name 22 bytes longer, a 4-byte extra field or a 9-byte comment, with no byte added, passed the whole step: `directory` summed what zipfile kept, not what the record declares. pip installs such a wheel exactly as checked; uv refuses it. `unaccounted` now walks the directory's own bytes before it reads the end record, in zipfile's order, and a record whose name, extra field and comment lengths are not (its name's bytes, 0, 0) adds `not lengths` to the condition that already refuses bytes after the last member, with that refusal's words unchanged. SHOULD 2: `raw.seek(entry.header_offset)` crashed with OSError and a traceback, and no `::error::` line, on a directory entry zipfile puts at a negative offset (the end record's directory offset too far, so the bytes- before-the-archive correction moves the one record not moved with it to -1000). The call to `unaccounted` now catches OSError, ValueError and OverflowError and names the problem, so the step prints an `::error::` line and exits 1. NIT 3 (older than the layout check): a name flagged UTF-8 that is not valid UTF-8 ended in a UnicodeDecodeError traceback, and a version needed to extract above 6.3 in a NotImplementedError one, as zipfile opened the wheel. Each is now caught there and named in an `::error::` line, exit 1. Six new cases, each failing against the release.yml of 5a175f3 and passing against this one. Three go into LAID_OUT_WRONG (the last record's name 22 bytes longer, a 4-byte extra field, a 9-byte comment; with no bytes added: the three exited 0 before). Three go into the new test_release_build_the_wheel_check_names_a_wheel_it_cannot_walk_or_open (a directory entry at offset -1000, a UTF-8 flagged name that is not UTF-8, a version needed to extract of 6.4; each ended in a traceback with no `::error::` line before). PyPI's 1.1.0 wheel, TestPyPI's 1.1.0rc1 wheel and two hatchling 1.27.0 builds of 5a175f3 all still pass the layout check. Lane: openRepoTools-3 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
|
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 4 days and 20 hours by commenting |
|
R3 source-efficiency attempt remains failed; no queue admission or heavy run occurred.
Under the owner's existing directly-related-repair approval, prepare a bounded source/candidate event comparison: hints may only be absent/null or equal the trusted tested SHA, with actual ordered Git-parent proof still mandatory. Unknown hints retain full even when both snapshots agree. Candidate bodies, admission, fast provenance, protection and subsequent raw live rereads remain strict. Red-first regressions and full ordinary/reusable qualification must precede checked normal merges and genuinely fresh source events. No review-acceptance receipt or queue command has been posted for PR65. The unpublished B remains local. Running lanes, tools, assembly pins, settings, app access, paid service and releases stay unchanged. Routing correction: this rollout belongs to opensoft/openRepoTools-spec#26, not this historical release PR. The same evidence is now posted on the governing spec issue; no release change is requested. |



Lane: openRepoTools-3
Claim: opensoft/openRepoTools#352 (comment)
Item 4 of opensoft/openRepoTools#352, and follow-ups 5 and 6, logged in lane 3's comment 6756663731. The branch is on code
main3460f5e(#23, items 1 to 3). Two commits:1734304is 5 and 6, and5a175f3is item 4. Codemainis nowecd1bce. Its three new commits touch neither file, and the branch merges onto it cleanly.A third commit,
e0e9278, is fix round 1 from the independent review: SHOULD 1 (the last central record's name, extra field and comment lengths are read from the directory's own bytes, so a wheel declaring a longer name, an extra field or a comment with no byte behind it is refused), SHOULD 2 (a directory entry at a negative offset ends in an::error::line, not a traceback) and NIT 3 (a name flagged UTF-8 that is not UTF-8, and a version needed to extract above 6.3, are named, so the "Met, and not fixed here" note below no longer holds). Six new cases, each failing on5a175f3'srelease.ymland passing on this head.The defects
e6eaa3c, install step 6): the rerun exists, and since release.yml's wheel checks disagree on a member's mode, its corrupt-member and index checks end in tracebacks, and its macOS rerun places none of the 16 commands under bash 3.2 openRepoTools#278 (b373ccc,9ed4734) it already has a fresh HOME, a bin directory of its own holding a copy of pipx's link, the 3.2 check and a second--install. What still differed was its two counts. They took any line holding: installed at $bin_dir/, and any holding: already installed at $bin_dir/and(unchanged). The contract asks for 16 lines of the form<file>: installed at <that directory>/<file>, then 16 of the form<file>: already installed at <that directory>/<file> (unchanged).zipfilefinds a member through the central directory, cuts it at its declaredfile_size, checks the CRC of that part only, and reads nothing of its local header but the name. So a wheel could carry bytes the build job's wheel check never read: past a member's declared size, between members, after the end record, or in a directory entry. A reader that walks the local headers could find other files. A name with a NUL byte passed as the part before the NUL.json.load(handle)["urls"]with no handler and no::error::line, so a bad answer ended in a traceback. It failed closed.The fixes
4: the macOS rerun,
release.yml:1755.exact(release.yml:1804), an awk count of lines that are exactly<command>: <said> $bin_dir/<command><after>: one command named on both sides and nothing more. The placed count is atrelease.yml:1811, and the unchanged count atrelease.yml:1827.(unchanged), is no longer one of the sixteen.::error::--install under /bin/bash <version> placed <n> commands in <bin_dir>, not all 16::error::the second --install under /bin/bash <version> found <n> commands already installed and unchanged in <bin_dir>, not all 16release.yml:1750) says so.main's. The awk uses only POSIXindex,substrandENVIRON. It is checked with mawk here; macOS's BSD awk is not tried.5: the wheel check,
.github/workflows/release.yml.unaccounted(release.yml:986) runs once every member has been read (release.yml:1120). Release wheel check: refuse extra directory entries and over-cap wheels, hash members as they are read, and catch RecursionError in the index checks (opensoft/openRepoTools#352 items 1 to 3) #23's cap, method allow-list and read loop are unchanged, and run first.start_dir).unlike_declared(release.yml:944) reads each member's data raw, a MiB at a time:release.yml:910says so.1.1.0rc1and PyPI's1.1.0(digests checked) all give no problem.::error::line:release.yml:996:the wheel names a member '<name>', with a NUL byte, which zipfile and pip read as '<cut name>'release.yml:999:<name> is a directory entry in the wheel, and holds <n> bytesrelease.yml:1002:the wheel holds <n> bytes from byte <at> that no member declares, before <name>release.yml:1005:<name> begins at byte <offset>, inside the member before it, which ends at byte <at>release.yml:1022:<name>'s local header disagrees with its central directory entry on its <fields>release.yml:1027:<name>'s data in the wheel is not exactly what it declares: <why>. The why is one of: it inflates past its declared size; it is stored in a size other than its declared one; its stream ends early; its stream does not end; its stream breaks; or a size or CRC-32 differs.release.yml:1043:the wheel's <n> bytes after its last member are not exactly its central directory, with no extra field and no comment, then its end record, with no comment6: the fetch step,
release.yml:1563.curland passed to the script.urlsplitare under one handler (release.yml:1579). It catchesValueError,KeyError,TypeError,AttributeErrorandRecursionError, the index checks' tuple. It exits 1 with:::error::TestPyPI's answer for <url> is not its JSON API's (<Error>: <message>), so no wheel is fetchedrelease.yml:1583,release.yml:1586) now carry::error::too.Tests (
tests/test_release_workflow.py)Item 4:
test_release_install_check_the_macos_rerun_counts_only_the_contract_s_lines(:5145) runs the rerun with pipx's link pointing atFAKE_INSTALL(:5097), a stand-in--installthat prints the case's lines (RERUN_LINES,:5127):placed 15line;found 15line.MACOS_RERUN_LINES(:4707) names the new lines, so the rerun is still held to the offline--installline for line. The release.yml's wheel checks disagree on a member's mode, its corrupt-member and index checks end in tracebacks, and its macOS rerun places none of the 16 commands under bash 3.2 openRepoTools#278 rerun test over a real venv passes unchanged.Items 5 and 6:
test_release_build_the_wheel_check_refuses_a_wheel_not_laid_out_as_it_declares(:2685) covers eight wheels (LAID_OUT_WRONG,:2668), each built in the test:zipfile.testzip(). The step then exits 1 with no traceback, and its only::error::line is the exact one expected.test_release_install_check_the_fetch_names_an_answer_that_is_not_testpypi_s_json(:4571) covers three answers: not JSON, nourls, and nested 100,000 deep. The whole output must be the one exact::error::line, and nothing is fetched.nested_fetch_error,:4550). It acceptsRecursionError(3.12) or theTypeErrorof indexing a decoded list (3.15), as d23268d did.::error::line.damage's directory walk and rewrite became the shared helperscentral_records,central_recordandrewritten, with the same effect.run_fetchholds the fetch test's setup.main'srelease.yml.Narrow run (
TMPDIR=/tmp XDG_STATE_HOME=/tmp/l3-352b timeout 3600 bash tests/run.sh -k 'test_release_workflow', on5a175f3):571 passed, 3722 deselected in 119.05s (0:01:59), exit 0.Met, and not fixed here: the wheel check's
zipfile.ZipFile(...)handler catchesOSErrorandBadZipFileonly. A central name flagged UTF-8 that is not UTF-8 raisesUnicodeDecodeError, so it ends in a traceback. That predates this PR and fails closed.Fixes opensoft/openRepoTools#352: its items 1 to 3 landed in #23, and this PR does item 4 and follow-ups 5 and 6.
🤖 Generated with Claude Code
Summary by Sourcery
Harden release validation by enforcing wheel layout integrity, making TestPyPI fetch failures explicit, and matching macOS reinstall output to the contract exactly.
Bug Fixes:
Enhancements:
Tests: