Repository navigation
Both wheel checks hold a payload file to the commit's whole mode, release.yml's checks refuse with a named ::error:: line and not a traceback, and the macOS rerun places the sixteen commands under bash 3.2 (part of opensoft/openRepoTools#278) - #12
Conversation
…ease.yml's wheel and index checks refuse with a named ::error:: line instead of a traceback, and the macOS rerun places the sixteen commands under bash 3.2 in a bin directory of its own (#278) Lane 2's review of #228's pull request 3 (#268) found four edges in release.yml's checks. Each now holds as follows. (a) The two wheel checks hold a payload file to one rule: its whole mode is the commit's, 100755 or 100644, a regular file at 0755 or 0644 and no other bit. release.yml read only S_IMODE, so it passed a member typed as a symlink, a directory or no type at all; tests.yml read only the low nine bits, so it passed setuid, setgid and sticky. The whole mode is the reading both can hold: it is what git records, and hatchling 1.27.0 writes exactly that for every payload file. TestPyPI's 1.1.0rc1 wheel (sha256 9babb294...) and a pip wheel build of a42946e both have all 24 at 100755 or 100644, and both pass the new checks. pip makes a member executable only when it is typed a regular file (pip/_internal/utils/unpacking.py:111-115 in pip 26.2.1), so an untyped 0755 member is not the commit's mode either. (b) release.yml's wheel check reads every member before it compares anything. A member it cannot read, such as a bad CRC, a broken deflate stream or a compression method zipfile does not know, is named in an ::error:: line and the step exits 1. Before, a bad CRC ended in an uncaught BadZipFile. (c) Both index checks, in both upload jobs, end every refusal in an ::error:: line naming its cause. The empty-index check still reads once: an HTTP status other than 404, a read with no answer or one cut off, and an answer that is not the index's JSON each refuse. The served check keeps its retry set: a 404, a 5xx and a read with no answer are read again, and a connection broken mid-answer now counts as no answer. It refuses at once any other HTTP status and an answer that is not the index's JSON. (d) The macOS rerun runs --install in a bin directory of its own, which holds a link with pipx's link's value. So the sixteen commands are placed under /bin/bash 3.2, rather than found "already installed" in step 8's directory. The step now requires sixteen "installed at" lines there. Run under a Linux build of bash 3.2.57, main's rerun prints 16 "already installed" and this one 16 "installed at". Docker's bash:3.2 also places all sixteen beside such a link in a fresh bin directory. tests/test_release_workflow.py: the wheel helpers write whole modes, as hatchling does; new tests run both wheel checks over six modes, and step 13 over three unreadable members; the index cases add a connection dropped with no answer, an answer cut off, a non-JSON answer and JSON without the file list, and every refusal must print an ::error:: line and no traceback; a new test runs the offline --install and then the macOS rerun, as one macOS leg, over a real venv holding the package; MACOS_RERUN_LINES names the rerun's new lines. Lane: openRepoTools-2 Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 64cd308a0ed5e6e2de4cddb502787c0e7d74d63f)
…data, its macOS rerun runs --install a second time into its bin directory so the already-installed arm also runs under bash 3.2, and the review's wording nits in release.yml, tests.yml and tests/test_package.py are fixed (#278)
Lane 2's second review of this branch (RV-B, at 64cd308) found no MUST, two
SHOULDs and eight NITs. This is the code side of the fixes to the two SHOULDs
and five of the NITs; the spec side follows in its own commit.
SHOULD 1, release.yml's step 13: the read loop's except tuple missed
lzma.LZMAError, which derives from Exception alone, so a member stored as
ZIP_LZMA with corrupt data ended in "_lzma.LZMAError: Corrupt input data"
and a traceback instead of a named ::error:: line, against the step's own
comment and claim (b). It failed closed (exit 1), and hatchling writes only
deflate, but the refusal now names the member. The step imports lzma and the
tuple names exactly the errors zipfile's readers raise, not a bare
Exception. tests/test_release_workflow.py: UNREADABLE_MEMBERS gains a
payload file stored as LZMA with corrupt data (damage's new `lzma` kind
stores the member with zipfile, then makes the first byte of its LZMA stream
0xFF, where the range coder's first byte is always 0): the step exits 1 with
an ::error:: line naming the member and prints no traceback.
SHOULD 2, release.yml's macOS rerun: giving the rerun a bin directory of its
own made its --install place all sixteen commands, so no macOS step ran the
installer's already-installed arm (cmp -s, the mode test, chmod) under any
bash: main's rerun ran it, step 8 places fresh, and tests.yml has no macOS
job. The rerun now runs --install a second time into the same bin directory
and requires exactly 16 `<command>: already installed at <bin>/<command>
(unchanged)` lines, as it requires its 16 `installed at` lines.
tests/test_release_workflow.py: MACOS_RERUN_LINES names the new lines, and
the rerun's test runs the step and reads each run's own output: one case
finds all sixteen unchanged and passes, and one has a `cmp` ahead of the
system's report a command different, so that the second run updates it, only
15 are unchanged, and the step must exit 1 naming that count.
NITs fixed here, each wording in a line the branch changed or a docstring:
- NIT 1, tests.yml: the mode message prints the whole mode and the rule
("has mode 000755 in the wheel, and lane is 100755 at HEAD, a regular file
at 0755 and no other bit"), where an untyped member printed "has mode 755
... which is mode 0755", which contradicted itself.
- NIT 2, release.yml's served check: its comment says what the check reads
again, a 404, a 5xx and every failure with no HTTP status (any OSError and
any http.client.HTTPException), bounded by the 20 reads. 64cd308's comment
and message named less than the code retries.
- NIT 3, both copies of the served check: the refusal of a 4xx other than
404 said "which no later read outlasts", false of 408 and 429; it says "a
status this check does not read again". The behaviour is unchanged, and
main refused those two as well.
- NIT 7, the rerun's link message: it says "the copy of pipx's link", because
$link is the copy in the rerun's own bin directory.
- NIT 8, tests/test_package.py: the docstring says the test reads permission
bits and no file type, a subset of the contract's whole-mode rule, which
release.yml's step 13 and tests.yml's package job hold in full.
Left open: NIT 4 (a JSON body nested past the recursion limit ends in a
RecursionError traceback in both index checks), NIT 5 (a name flagged UTF-8
that is not UTF-8 ends in a UnicodeDecodeError: pre-existing) and NIT 6
(step 13 skips a name ending in "/", so an extra directory entry passes it:
pre-existing).
Part of #278.
Lane: openRepoTools-2
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
(cherry picked from commit ea9310849f62d8c1578e05ae23d219b4c920561f)
…tore one command's mode, so the step's count must hold its (unchanged) to refuse it, and two test comments now say what the read loop's tuple did not name and which served cases refuse at the first read (#278) Lane 2's final review of this branch (RVF-B, at 273e32c) found no MUST and no SHOULD and three NITs, and the coordinator posted its verdict on #278 (comment 6320879246). This commit fixes the three in tests/test_release_workflow.py. It changes no workflow, no script and no spec. NIT B, the second --install's ` (unchanged)`: the step's count requires exactly 16 lines `<command>: already installed at <bin>/<command> (unchanged)`, but only the text-matching test held the ` (unchanged)`, through MACOS_RERUN_LINES's pinned copy of the count. RVF-B's mutant CO1 drops it from release.yml's count and from that pin together (`grep -cF ' (unchanged)'` becomes `grep -c .`), and every test passed, because no case made the second run find a command already installed but not unchanged. RERUN_SECOND_RUN gains a third case, one-command-whose-mode-the-second-run-would-restore. A `find` ahead of the system's, in the stand-in /bin, prints nothing for `*/bin-bin-bash/lane`, which is what mode_is (`find -perm 755`, openRepoTools:1960-1962) reads as a mode that is not 755. The second run then prints `lane: already installed at <bin>/lane (mode restored to 755)`, 15 lines are `(unchanged)`, and the step must exit 1 with its `found 15 commands already installed and unchanged in <bin>, not all 16` line. A count of every `already installed` line gives 16 there and passes the step, so the case holds the ` (unchanged)`. The table's rows now name the tool a stand-in wraps, and the new RERUN_STAND_INS holds each stand-in's shell lines and what the second run then says of the command. The `cmp` stand-in is the same text as before, and the first two cases are unchanged. Proved in a private clone at 273e32c plus this change, on the five tests selected by -k 'test_release_install_check_the_macos or test_release_install_check_the_offline_installs_are_one_script': unmutated, 5 passed. With CO1 applied, the new case fails (`assert 0 == 1`: the step exits 0 on a second run that printed `lane: already installed at <bin>/lane (mode restored to 755)`), and the other four pass, as they did before this commit. NIT A, UNREADABLE_MEMBERS's comment said LZMAError was "the one error here that is neither an `OSError` nor a `ValueError`". None of the four read errors (BadZipFile, zlib.error, NotImplementedError, LZMAError) is either. It now says what set LZMAError apart: the read loop's `except` tuple did not name it, as it names BadZipFile, zlib.error and RuntimeError (NotImplementedError's base), and it derives from Exception alone, so it ended in a traceback until ea93108 named it. NIT C, SERVED_CASES's comment (carried over from main) said the served check refuses "any other file" at once, but its table gives another-file-beside-it- every-time 20 reads. It now says what the table holds: the wheel yanked, a client error and an answer that is not the index's JSON are refused at the first read, and an index that never serves exactly the wheel (another file beside it every time, its digest another every time, or the wheel only at the 21st read) after the 20. Part of #278. Lane: openRepoTools-2 Co-Authored-By: Claude Sonnet 5.5 <[email protected]> (cherry picked from commit cc20d58500de7b8ae2109145c60b61f674615541)
Reviewer's GuideConfigurationMake both wheel checks require payload files to match the commit’s complete regular-file mode, and make the release wheel check name unreadable members instead of raising a traceback.
Make the pre- and post-upload index checks report named errors for unreadable responses and invalid JSON while preserving their intended retry rules.
Give the macOS Bash 3.2 rerun its own command directory and require both placement and unchanged already-installed handling there.
TestsUpdate the package payload test’s mode contract explanation and add release-workflow coverage for strict wheel modes, unreadable members, index failures, and both macOS rerun paths.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/release.yml" line_range="902" />
<code_context>
problems.append("the wheel names one file twice")
members = {e.filename: e for e in entries}
+ contents = {}
+ for name, entry in members.items():
+ try:
+ contents[name] = wheel.read(entry)
</code_context>
<issue_to_address>
**Extra wheel directories pass verification**
When the release wheel contains an extra ZIP directory entry, a wheel containing an extra directory entry passes this inventory check: the earlier `entries` filter omits names ending in `/`, so `members` and this read loop never see the entry and no problem is recorded. The release can therefore accept a wheel with content beyond the allowed members.
Include directory entries in the release wheel inventory and reject any whose names are not explicitly allowed.
</issue_to_address>
### Comment 2
<location path=".github/workflows/release.yml" line_range="904" />
<code_context>
+ contents = {}
+ for name, entry in members.items():
+ try:
+ contents[name] = wheel.read(entry)
+ except (zipfile.BadZipFile, zlib.error, lzma.LZMAError, EOFError, OSError,
+ RuntimeError, ValueError) as error:
</code_context>
<issue_to_address>
**Large wheels exhaust runner memory**
When the wheel contains members whose combined uncompressed size exceeds the runner’s available memory, the loop retains every member’s uncompressed bytes in `contents` until all members have been read and compared, so a wheel with a very large total uncompressed size can exhaust the runner and terminate the step before it reports a named error.
Read and discard members during the validation pass, or enforce an aggregate uncompressed-size limit instead of retaining every body.
</issue_to_address>
### Comment 3
<location path=".github/workflows/release.yml" line_range="1221" />
<code_context>
+ release = json.loads(body)
+ held = {f["filename"]: f["digests"]["sha256"] for f in release["urls"]}
+ yanked = sorted(f["filename"] for f in release["urls"] if f.get("yanked"))
+ except (ValueError, KeyError, TypeError, AttributeError) as error:
+ sys.exit(f"::error::{index}'s answer for {url} is not its JSON API's "
+ f"({type(error).__name__}: {error}), {unknown}")
</code_context>
<issue_to_address>
**Nested index responses cause tracebacks**
When an index response is nested beyond Python’s JSON decoder recursion limit, `json.loads(body)` raises `RecursionError`, which the index parsing handler does not catch, so the index check prints a traceback instead of the named `::error::` refusal.
Add `RecursionError` to the index parsing handler’s exception tuple.
Also at `.github/workflows/release.yml:1218`, `.github/workflows/release.yml:1274`, `.github/workflows/release.yml:1277`, `.github/workflows/release.yml:1782`, `.github/workflows/release.yml:1785-1786`, `.github/workflows/release.yml:1827`, `.github/workflows/release.yml:1830-1831`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 3 findings to address first, and if a wheel-validation check accepts a malformed artifact, or the index checks mistake what was published or served, the release can expose that wheel to users; reverting the workflow cannot retract an already published version from everyone who obtained it. The stricter checks and clearer failure handling mostly fail closed, but the release gate itself determines what may be published.
Blocking findings: .github/workflows/release.yml:902, .github/workflows/release.yml:904, .github/workflows/release.yml:1221
The in-place merge of runbook v9: the stack grows by this clean merge, with no force-push. Lane: openRepoTools-2 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The in-place merge of runbook v9: the stack grows by this clean merge, with no force-push. Lane: openRepoTools-2 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
…L 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) Item 4 of opensoft/openRepoTools#352 and its follow-ups 5 and 6, from the sourcery-ai threads on release.yml's wheel and index checks (#12) and 006's macOS rerun (opensoft/openRepoTools-spec#11). Items 1 to 3 landed in #23. - The build job's wheel check holds a wheel to the layout zipfile writes, from byte 0 to the end of its end record. Each member's local header repeats its central entry's fields, the members follow one another with nothing between them, and the central directory and end record end the file with no extra field or comment. Each member's data must give exactly its declared size and CRC-32. Bytes no member declares, a local header that disagrees with its central entry, a directory entry that holds bytes, and a name with a NUL byte are each refused in one ::error:: line (follow-up 5). - The install job's TestPyPI fetch names an answer that is not TestPyPI's JSON in one ::error:: line instead of a traceback, and fetches nothing (follow-up 6). - The macOS rerun counts only lines of the contract's exact form toward its 16, so a line naming another file, or carrying more after "(unchanged)", no longer counts (item 4). - The review's fix round reads the last central record's name, extra field and comment lengths from the directory's own bytes. It ends a directory entry at a negative offset in an ::error:: line, not a traceback, and it names a name flagged UTF-8 that is not UTF-8 and a version needed to extract above 6.3. Lane openRepoTools-3's independent review read READY at 5a175f3, with no MUST. Its two SHOULDs and its NIT 3 are fixed at e0e9278 with six new cases, each failing before the fix, and lane openRepoTools-3 checked that delta. All 14 checks are green at e0e9278, tested on main ecd1bce. It lands under Brett Heap's standing landing word for lane 3's own fixes, typed in lane 3's session on 2026-11-10. Fixes opensoft/openRepoTools#352 Lane: openRepoTools-3 Co-Authored-By: Claude Opus 5.5 <[email protected]>



Lane: openRepoTools-2
Claim: opensoft/openRepoTools#278 (comment)
release.yml's checks had four edges: (a) the two wheel checks read only part of a payload file's
mode; (b) release.yml's wheel check ended in a traceback on a member it could not read; (c) its
index checks ended in tracebacks on an answer they could not read; (d) the macOS rerun found the
sixteen commands already installed, so it placed none under bash 3.2. The first pick holds both
wheel checks to the commit's whole mode (100755 or 100644: a regular file and no other bit), makes
the wheel check and both upload jobs' index checks refuse with a named ::error:: line, and gives the
macOS rerun a bin directory of its own. The second pick names a member stored as LZMA with corrupt
data, runs the rerun's --install a second time into the same directory so that the installer's
already-installed arm also runs under bash 3.2 (sixteen already-installed and unchanged lines are
required), and fixes wording nits in release.yml, tests.yml and tests/test_package.py. The third
adds a case to the rerun's test in which the second --install restores one command's mode, so that
the count's (unchanged) is held, and corrects two test comments.
The picks, from lane openRepoTools-2's branches in opensoft/openRepoTools, each made with
git cherry-pick -xand followed by its source commit:(cherry picked from commit 64cd308a0ed5e6e2de4cddb502787c0e7d74d63f)
(cherry picked from commit ea9310849f62d8c1578e05ae23d219b4c920561f)
(cherry picked from commit cc20d58500de7b8ae2109145c60b61f674615541)
Part of opensoft/openRepoTools#278.
Lane: openRepoTools-2
Co-Authored-By: Claude Opus 5.5 [email protected]
Co-Authored-By: Claude Sonnet 5.5 [email protected]
🤖 Generated with Claude Code
Summary by Sourcery
Harden release and package validation so malformed artifacts, index responses, and macOS installation reruns fail clearly and enforce the intended file modes and command counts.
Bug Fixes:
Enhancements:
Tests: