Repository navigation
Sweep core constants.rs and utils (concurrent, durability, …) - #1907
Mikola Lysenko (mikolalysenko) wants to merge 5 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
constants.rs: drop the tautological USER_AGENT and manifest-path tests, keep one URL test on https, no trailing slash and distinct hosts, and move the test module to the end. cargo_home.rs: cut the module doc's history and bare #1135 refs. composer_version.rs: composer_versions_equivalent compares composer_version_key, the key PurlKey already uses; the sentinel identity key had no other caller. The two pairwise tests become one that checks equivalence against an independently written spec. containment.rs: linked_level_refusal is private; nearest_socket_dir moves to socket_dir.rs, its only user, and socket_project_root is inlined there. The stale is_link doc is trimmed. digest.rs: drop the banner and the stale #706 pending note. Assisted-by: Claude Code:claude-opus-5-5
MAX_API_CONCURRENCY equalled API_CONCURRENCY, so the env clamp uses API_CONCURRENCY. The consts no other file reads are private (PROXY_API_CONCURRENCY is pub(crate) for the API client). The adaptive cap's floor and ceiling parameters only ever took one value, so it is inlined into api_concurrency_for_under, which now reads the env override once. The per-window test asserts literal caps instead of recomputing them with the code under test. Assisted-by: Claude Code:claude-opus-5-5
durability.rs: barrier checks for pending work, hits its failpoint and runs barrier_blocking on the blocking pool instead of a second copy of the take/sync/restore sequence. sync_all_blocking is private, Pending::moved loses its dead if-let, history phrasing goes, and the test that only asserts Ok is named for what it checks. env_compat.rs: SOCKET_DEBUG and SOCKET_OFFLINE share one env_flag. failpoint.rs: hit matches the point once, then pauses or exits. Assisted-by: Claude Code:claude-opus-5-5
The adaptive cap's clamp panics on a floor above the ceiling, so a compile-time assert now pins the constants' order. barrier takes the pending set first again, so a racing barrier can't pass the check and then find nothing, and both barriers share sync_or_restore. Public docs stop linking items this sweep made private. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
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 14f61b9. Configure here.
|
Burn-down agent: labeled Ready for review at head
Generated by Claude Code |
Final review briefWhat it does: A local cleanup sweep of core Risk: low. Every code change is behavior-preserving on inspection. The only semantic touchpoint is Look here
Verified
Changes I made: none. Open questions: none. The public-API removals are listed in the description for the release agent. Auto-merge is armed, so approving sends it straight to the merge queue. Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Summary
This sweeps the next audited, unswept rows of
coverage/files.tsvthat no open PR touches: coreconstants.rsandutils/{cargo_home,composer_version,concurrent,containment,digest,durability,env_compat,failpoint}.rs. It applies the audit-core notes for each row, plus the other local cleanups found on a re-read. See the living document's structure part (discussion #1830).No structural candidate was free this run: every one scoring 6 or more has its files in an open PR (#1886, #1864, #1698, #1891, #1829, #1863). That is why this run is a sweep.
Changes
constants.rsuser_agent_reports_real_crate_version(it rebuilt theconcat!it checked) andmanifest_path_is_under_dot_socket(literal == literal).USER_AGENTis gone.cargo_home.rs: cut the module doc's story and the bare#1135refs (−7 lines).composer_version.rscomposer_versions_equivalentnow comparescomposer_version_key, the keyPurlKeyalready uses.composer_version_identity_key, the\u{1}-sentinel key, had no other caller and is deleted.key_equality_is_equivalence_over_every_vector_pair. It checks equivalence against an independently written spec (accepted pairs normalize alike, rejected pairs have equalv-stripped text, mixed pairs never match), and also checks the invariant that makes one key sound.purl_key.rs, the now-vacuous "no\u{1}in the key" assert and a stale doc phrase are removed.concurrent.rsMAX_API_CONCURRENCYequalledAPI_CONCURRENCY, so one constant is kept.API_CONCURRENCY,API_CONCURRENCY_FLOOR,REQUESTS_PER_SLOTandREGISTRY_CONCURRENCYare private, andPROXY_API_CONCURRENCYispub(crate)(the API client reads it).adaptive_concurrency's floor and ceiling parameters only ever took one value, so it is inlined.api_concurrency_for_undernow reads the env override once, and aconstassert keeps the floor at or below the ceiling, becauseclamppanics otherwise.adaptive_concurrencyunit test went with the function.containment.rslinked_level_refusalis private.nearest_socket_dirmoved tosocket_dir.rs, its only user, andsocket_project_root(one caller) is inlined there. The test moved with it asnearest_socket_dir_is_the_innermost_dot_socket_ancestor, which adds the nested-.socketcase.is_linkdoc.digest.rs: dropped the banner and the stale#706pending note.durability.rssync_or_restore, so the take/sync/restore sequence is written once.sync_all_blockingis private.Pending::movedloses a deadif let.sync_skips_vanished_files_and_syncs_the_restonly assertedOk, so it is renamedsync_skips_vanished_files.env_compat.rs:SOCKET_DEBUGandSOCKET_OFFLINEshare one privateenv_flag, and the offline doc is trimmed.failpoint.rs:hitmatches the point once, then pauses or exits.Red→green evidence
Each mutation below makes its test fail; the test passes on this branch.
REQUESTS_PER_SLOT = 3→per_window_cap_adapts_only_where_nothing_else_decidesfails. Before this PR the test recomputed the expected cap with the same constant, so it passed.composer_versions_equivalentcomparing rawcomposer_version_normalize→key_equality_is_equivalence_over_every_vector_pairfails, along with 2 others.nearest_socket_dirpicking the outermost.socket→nearest_socket_dir_is_the_innermost_dot_socket_ancestorfails.Size
git diff --stat: 11 files, +163 / −291. That is about −52 production and −76 test lines, with the moved test module inconstants.rscounted as neither.Behavior change
None in the CLI's output, JSON or exit codes.
composer_versions_equivalentnow uses the sentinel-free key. It agrees with the old sentinel key wherever every accepted key is itself accepted, bare and behind av. The test pins that invariant over the whole shared vector file, and/code-reviewprobed about 90 more edge spellings without finding a counterexample.PurlKeyalready relied on it.socket-patch-core: these items werepubwith no caller outside the crate and are now private or removed, for the release agent:concurrent::{API_CONCURRENCY, API_CONCURRENCY_FLOOR, REQUESTS_PER_SLOT, REGISTRY_CONCURRENCY, PROXY_API_CONCURRENCY};composer_version::composer_version_identity_key;containment::{linked_level_refusal, nearest_socket_dir, socket_project_root}.Not done (left for their own PRs)
CargoCrawler::cargo_homeforwarder:cargo_crawler.rsis in Build: share one test RNG across randomized tests (#1868) #1882.vendor/jvmcopies: in Fix Maven 4 implicit subprojects missed outside vendored (#1809) #1886.fs::is_symlinkwrapper:fs.rsis in Build: share one test env guard in core (#1889) #1891.debug_logtoutils/debug.rs: a cross-file move.DEFAULT_PATCH_MANIFEST_PATHfromSOCKET_DIR:concat!takes only literals.@nparse fallback: changing it is a behavior change.Verification
cargo clippy --workspace --all-features -- -D warningsis clean.cargo test -p socket-patch-core --lib: 6991 pass, 4 fail. All 4 fail the same way onmainunder the root sandbox: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_filesvendor_crash_safety_e2e,vendor_group_commit_e2e,e2e_safety_lockandvendor_ejectall pass. They exercise the failpoints and durability barrier./code-review highran. Fixed: the clamp guard, the barrier check-then-take race, and private intra-doc links. Kept with reasons: the public-API narrowing, composer's single key, and the dropped literal URL pins (both stated above).Risk
Low. The changes are local to core utils, and the
durabilitybarrier semantics are unchanged (take, sync, restore on failure).https://claude.ai/code/session_011f9aeNfHxWVP55pKiwaNk4
Generated by Claude Code