Repository navigation
Sweep core utils http, mod and hatch - #1914
Mikola Lysenko (mikolalysenko) wants to merge 5 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
The cap tests matched "too large" in a String; they now assert the ReadCappedError variant and message. New tests cover the mid-stream cap (a chunked body with no Content-Length) and a body cut short of its Content-Length (Truncated), neither of which had a test. A raw loopback server replaces wiremock, which always declares a length. Drop the history note on read_capped and the issue-number banner, and rename production_builder_builds to what it checks. Assisted-by: Claude Code:claude-opus-5-5
hatch.rs: name the two documents (PYPROJECT, HATCH_TOML); one
tool_hatch lookup and one merged_key rule (a hatch.toml top-level key
replaces [tool.hatch]'s) replace three hand copies; Round::new builds
the targets and index that plan and rewrite_all built twice;
Target::root_relative replaces three {root:uri} literals; plan's
permission is a HatchEdit, so HatchPermission goes; require_pip_installer
reuses parse_documents; external_metadata replaces collecting every
hatch.toml key to test for one. Bare issue numbers dropped.
hatch_workspace.rs: inline expand into members_of, replace a constant
take_while with an if, use the named documents, drop review/issue
history from test docs.
mod.rs: sort hatch modules into place; hatch_workspace is pub(crate).
Assisted-by: Claude Code:claude-opus-5-5
Review: plan's permission holds whole file texts while a HatchEdit holds one setting line, so folding one into the other blurred the type. Restore HatchPermission with a doc saying what it holds. environments was a one-line forward to merged_key(.., "envs"); its two callers call merged_key instead. Rewrap the members_of doc. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
|
Burn-down agent: labeled Ready for review.
Generated by Claude Code |
Final review brief (
|
The boundary test moved to a chunked body, leaving no test of a declared Content-Length equal to the cap. Check both: a declared length of exactly max is accepted, as is a streamed body of max bytes. Changing the declared check to >= now fails it. Assisted-by: Claude Code:claude-opus-5-5
|
[agent] Final review follow-up: I'm leaving Generated by Claude Code |
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e598769. Configure here.
|
[final reviewer] Disarmed auto-merge: head Generated by Claude Code |
Final review brief (
|
|
Burn-down agent: Ready for review re-confirmed on the new head.
Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Architecture refactor sweep of core
utils/http.rs,utils/line_endings.rs(clean, nothing to do),utils/mod.rs,utils/hatch_workspace.rsandutils/hatch.rs. It follows the audit notes incoverage/files.tsvonarch-audit/ledger(living document: discussion #1830, Part 4 structure and Part 5 tests).Changes
utils/http.rs"too large"in a String. They now assert theReadCappedErrorvariant and the exact message.streamed_body_over_cap_is_refused_mid_stream: a chunked body with no Content-Length, so only the streamed count catches it.body_cut_short_of_its_content_length_is_truncated: coversTruncated.CapExceededfails the second.read_cappedand the(#1107)banner are removed.production_builder_buildsbecomesproduction_builder_accepts_the_shared_tls_config. Its doc had claimed a platform-store check that it never asserted.read_cappedwrapper stays. Deleting it touchesvendor/maven_repo.rs(Fix Maven 4 implicit subprojects missed outside vendored (#1809) #1886, Build: share one test env guard in core (#1889) #1891) orapi/client.rs(One serve GET and one vendor retry loop in api/client.rs (#1869) #1870, Build: share one test env guard in core (#1889) #1891).utils/hatch.rsPYPROJECTandHATCH_TOMLreplace theHATCH_FILES[0]/[1]indexing, including 3 sites invendor/pypi_hatch.rs.merged_keyencodes "a hatch.toml top-level key replaces[tool.hatch]'s key". It replaces the hand copy inlocks_environmentsand theenvironmentsforwarder, which is deleted.tool_hatchreplaces 3 open-codedtool.hatchlookups.Round::new: builds the targets and index thatplanandrewrite_alleach built by hand (2 × ~20 lines).Target::root_relative: replaces 3{root:uri}prefix literals.require_pip_installerreusesparse_documents.external_metadata: replaces collecting every hatch.toml key into a Vec just to test formetadata.six==1.16for an installed 1.16.0, soscanexits 0 and pip installs the unpatched release (regression from v4.0.0) #475, Perf regression: hatch/hosted wall +21% (9c43dfc9..17793173) #1471).utils/hatch_workspace.rsexpand, a single caller, intomembers_of, with its doc merged.take_while(|_| !at_checkout)becomes anif.utils/mod.rshatch_workspaceispub(crate): its only users are in core./code-review high
I fixed 3 findings:
HatchPermission→HatchEditmerge is reverted. A plan's permission holds whole file texts, while aHatchEditholds one line.environmentsforwarder is deleted.members_ofdoc is rewrapped.I left 5 unfixed:
hatch_workspace: the audit asked for it, and prior sweeps narrowed core items the same way.require_pip_installer_documentsignores the hatch.tomlenvsoverride: this is pre-existing, and fixing it changes refusals, so it wants an issue.walk's key-stripping merge: it mutates a copy for the rewrite, a different operation from a lookup.respond_rawduplicating other modules' private test servers: sharing them is test_support work across files held by open PRs.#547/#505references invendor/pypi_hatch.rs: that file isn't in this sweep.Totals
git diff --stat: 5 files, +231 / −208.Behavior
None. The output bytes, error strings and refusal order are unchanged.
Verification
ece45b6. Bugbot found no issues.cargo clippy --workspace --all-features -- -D warningsis clean.cargo test -p socket-patch-core --lib: 6997 pass and 4 fail. All 4 rely on chmod and fail under the root sandbox, in files this PR doesn't touch:copy_tree::relax_loop_must_not_traverse_symlinked_rootvlt_heal::an_unremovable_hidden_lock_keeps_every_store_entrypypi_poetry::wire_write_failure_maps_error_and_leaves_lock_untouchedpypi_requirements::wire_failure_rolls_back_already_written_filesmerged_keyignore hatch.toml forlock-envsfailshatch_lock_detection_follows_the_config_merge.Risk
Low. The changes are local to core, and no
cfg(windows)/cfg(unix)code changed.https://claude.ai/code/session_011f9aeNjuH4Ykvk5p4WEcU3
Note
Low Risk
Structural refactors and test harness changes in core utils; PR asserts byte-identical outputs and unchanged refusal order.
Overview
Refactors Hatch TOML handling without changing rewrite or refusal behavior.
hatch.rsintroducesPYPROJECT/HATCH_TOML, centralizes pyproject[tool.hatch]access viatool_hatch, and replaces ad hoc hatch.toml-vs-pyproject merging withmerged_key(replacing the oldenvironmentshelper).Round::new,Target::root_relative,external_metadata, and sharedparse_documentscut duplicated setup;pypi_hatch.rsfollows the new path constants.hatch_workspace.rsuses the same merge helper and document names, inlines member-spec{root}/{home}expansion intomembers_of, and simplifies checkout-root discovery inroots.mod.rsreorders exports and makeshatch_workspacepub(crate).http.rstest-only changes: wiremock is replaced with a raw loopback server so cap logic can be exercised on chunked bodies and truncated Content-Length responses; assertions targetReadCappedErrorvariants. Stale issue/history comments are stripped across these files.Reviewed by Cursor Bugbot for commit e598769. Configure here.
Generated by Claude Code