Skip to content

Commit 70c25aa

Browse files
committed
refactor: sweep vendored_backend (#1939)
Assisted-by: Claude Code:claude-opus-5-5
1 parent 1eceac8 commit 70c25aa

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

‎coverage/files.tsv‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ crates/socket-patch-cli/src/commands/update.rs 613 audit-cli-tests cbbbdb9 2026-
3434
crates/socket-patch-cli/src/commands/user_patches.rs 188 audit-cli-tests cbbbdb9 2026-11-01 PR #1929 evidence/skip_protected/partition repeat one loop; return RunWarning not tuples; refuse reuse lock_cli::error_envelope; DETECTED prefix list belongs in core UserPatchIndex; see T38
3535
crates/socket-patch-cli/src/commands/vendor.rs 7937 audit-cli-tests cbbbdb9 2026-11-01 - run_eject 554 lines, run 306, run_check 210; 10 RunWarning literals; refuse_candidate helper for 10 Failed+report copies; eject envelope preamble x4; misplaced docs L558, L3446; dead dry-run VEX L2319; sweep_stale_artifact let _ then Removed; inline gc_note; merge 2 FIFO tests; move core/envelope/orphan tests out; 2 vacuous if-let tests; ~70 comment lines; see T35-T38,T40,T41
3636
crates/socket-patch-cli/src/commands/vendor_orphans.rs 242 audit-cli-tests cbbbdb9 2026-11-01 PR #1929 sweep_orphan_vendor_dirs forwards to _where(..,|_|true): inline at 2 callers; borrow (&str,&str) keys at L85; stale test doc L217-L220 contradicts const doc; trim L27-L37; sweep is engine code (core vendor::path, C12); see T19, T42
37-
crates/socket-patch-cli/src/commands/vendored_backend/mod.rs 405 audit-cli-tests cbbbdb9 2026-11-01 - inline revert_vendor_entry+VendorRevertResult into revert; ApplyRequest.manifest -> &HashMap and delete records_manifest; VendorRevertStep::unwired() for the two match lists L160/L218; stop_on_failure bool (true only from remove); hand-written Error: emit L103 (T20); see T16, T37
38-
crates/socket-patch-cli/src/commands/vendored_backend/repair.rs 1369 audit-cli-tests cbbbdb9 2026-11-01 - repair() is 570 lines (health loop ~380): extract check_entry + redownload phase; one ensure_client for L768/L921; inline workspace_copy_issue, rebuild_reason_label, format_redownload_preview; drop Candidate Clone+detached; SOCKET_DIR const; rename repair_returns_with_fifo_script; fix stale test docs; merge ui_format_tests; scan_vendor_references -> core vendor::path (C12); see T41, T42
37+
crates/socket-patch-cli/src/commands/vendored_backend/mod.rs 405 audit-cli-tests cbbbdb9 2026-11-01 PR #1939 inline revert_vendor_entry+VendorRevertResult into revert; ApplyRequest.manifest -> &HashMap and delete records_manifest; VendorRevertStep::unwired() for the two match lists L160/L218; stop_on_failure bool (true only from remove); hand-written Error: emit L103 (T20); see T16, T37
38+
crates/socket-patch-cli/src/commands/vendored_backend/repair.rs 1369 audit-cli-tests cbbbdb9 2026-11-01 PR #1939 repair() is 570 lines (health loop ~380): extract check_entry + redownload phase; one ensure_client for L768/L921; inline workspace_copy_issue, rebuild_reason_label, format_redownload_preview; drop Candidate Clone+detached; SOCKET_DIR const; rename repair_returns_with_fifo_script; fix stale test docs; merge ui_format_tests; scan_vendor_references -> core vendor::path (C12); see T41, T42
3939
crates/socket-patch-cli/src/commands/vex.rs 2789 audit-cli-tests cbbbdb9 2026-11-01 - generate_vex 575 lines: Go gates L950-1081 to core (T46); merge _inner into with_cleanup, drop calm_when_nothing bool; inline join_and, format_manifest_not_found_hint; drop wrapper generate_vex_from_manifest_path; print_embedded L320 dups L1998; L1408 .ok() swallows join panic; 2 RunWarning literals; delete test go_redirect_coord_guard; ~35 comment lines; T25, T43, T45
4040
crates/socket-patch-cli/src/commands/vex_consumed.rs 1028 audit-cli-tests cbbbdb9 2026-11-01 - drop not_installed() and cfg(test) npm_identity_fallback wrapper (move doc to _reusing); inline short single-caller fns (registry_host, cached_crate…); move npm_alias_copies_* x2 tests to ecosystem_dispatch, store_variants test to core npm_crawler; stale doc L683-685, garbled L937-941; cfg(test) import swap L43-55; ~15 comment lines; see T48
4141
crates/socket-patch-cli/src/commands/vex_sources.rs 1897 audit-cli-tests cbbbdb9 2026-11-01 - inline recognized_dead_note, fetch_concurrency, build_candidates; drop note() and failed() wrappers; PlanNote copies RunWarning; make 10 NOTE_* consts private, move L262-272 above L226; api_auth_fallback_warning L200-209 (RunWarning literal, used by repair/vendor/apply) belongs in json_envelope; test socket_api_concurrency_paces… tests core; ~25 comment lines; see C09, C12
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[agent] 2026-11-01: architecture refactor (sweep)
2+
3+
`main` @ `cbbbdb9`. The previous entry was structural (#1936), so this run is a sweep. Nothing of mine merged or closed since the last entry, and the discussion has no maintainer steering. Next in the register's sweep order, `vlt_preflight.rs`'s notes change callers in `vendor.rs` (#1698), so I took `vendored_backend/{mod,repair}.rs`: no open PR touches them. Their outside callers (`vendor.rs`, `rollback.rs`, `remove.rs`, `commands/repair.rs`) are all held, so only file-local notes landed.
4+
5+
**PR:** [#1939](https://github.com/SocketDev/socket-patch/pull/1939), ready for review. `/code-review high` found no correctness bugs: I fixed 2 of its 8 low-severity notes and gave reasons for the other 6 in the PR. CI and Bugbot were pending at handoff.
6+
7+
### Per file
8+
- **`mod.rs`:** 1 fn and its result struct inlined (`revert_vendor_entry`, `VendorRevertResult`); 2 match lists replaced by `VendorRevertStep::unwired()`; 7 bare issue refs removed. Net about −14.
9+
- **`repair.rs`:** 3 fns inlined (`workspace_copy_issue`, `rebuild_reason_label`, `format_ledger_missing`); `Candidate`'s `Clone` and duplicate `detached` dropped; 2 client-builder copies replaced by one `ensure_client` with no `expect`; test module merged, 1 test renamed, 1 assert on the deleted fn dropped; 6 bare refs removed. Net about −27 (production −20, test −7).
10+
- **Total:** +115 / −165.
11+
12+
### Behavior
13+
None.
14+
15+
### Merges recorded
16+
None.
17+
18+
### Lessons
19+
- **Most audit notes on a shared backend change its callers.** With `vendor.rs`, `rollback.rs` and `remove.rs` held, about half of these rows' notes wait; they are listed in the register.

‎register/90-refactor.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### Refactor routine
2-
_Last updated 2026-11-01T13:25Z · main @ cbbbdb9_
2+
_Last updated 2026-11-01T15:15Z · main @ cbbbdb9_
33

44
#### In flight
55
| PR | Kind | Scope | State |
@@ -20,6 +20,7 @@ _Last updated 2026-11-01T13:25Z · main @ cbbbdb9_
2020
| #1923 | sweep + A20 #1848 | core `utils/{redact,repo_root,serde,toml_edit_ext,uri,uv_workspace}.rs` (+ `vex/product.rs`, `redirect/upstream/npm.rs`, advisory lint moved to `vendor/service_fetch.rs`) | ready; CI (82 checks) and Bugbot green |
2121
| #1929 | sweep | `cli/src/commands/{update,user_patches,vendor_orphans,vlt_heal}.rs` (+ `InstallChannel::id` in core `update/channel.rs`) | ready; CI (82 checks) and Bugbot green |
2222
| #1936 | structural | A54 #1932: `formats/gem/{gemspec,manifest}.rs`, `vex/product.rs` (`for_each_code_line` → `code_lines`) | ready; CI (82 checks) and Bugbot green |
23+
| #1939 | sweep | `cli/src/commands/vendored_backend/{mod,repair}.rs` | ready; CI and Bugbot pending |
2324

2425
#### Merged
2526
_None._
@@ -34,7 +35,7 @@ Structural candidates, scored `3·B + 2·U + 2·D + 2·C − risk`. As of 2026-1
3435

3536
A05/A32 are the fixer's (#1898/#1895); A42 #1901 and A45 #1902 likewise. A26 [#1867](https://github.com/SocketDev/socket-patch/issues/1867) scores 4 (files free).
3637

37-
The next run is structural if a candidate scoring 6 or more has free files, else a sweep. Next sweep files, in order: `vlt_preflight.rs`, `vendored_backend/{mod,repair}.rs`, `vex_consumed.rs`, `vex_sources.rs` (free; check callers), `scan/policy.rs` and `scan/render.rs` once #1856/#1884 merge; core `utils/lock_fragments.rs` (wait on #1898); next free: `python_lock.rs` (2,283), `python_script.rs` (1,768), then `api/{blob_fetcher,date,retry,types}.rs` and the crawler rows. `purl_key_nuget_vendor_tests.rs` waits on #1907 (`purl_key.rs` mounts it); scan `policy`/`rollout`/`rollout_args`/`socket_yml_args`/`withdrawn` have free files but their callers sit in `scan/mod.rs` (#1856, #1884, #1897). Left from #1923: delete `toml_edit_ext` (move `ensure_table`/`has_table` beside their one caller each; `utils/mod.rs` held by #1914, `vendor/pypi.rs` by the pypi PRs) and fold `uv_workspace`'s two-call pattern (`governing_root.rs` #1863, `vendor/pypi.rs`). `process.rs` waits on #1895, `pdm_lock.rs` on #1898, `poetry_lock.rs` on #1865/#1898, `pnpm_workspace.rs` on #1863. Left from #1920: inline the 7 `build_*_purl` wrappers and `parse_jsr_purl` (callers held by #1882/#1886/#1891/#1698), move purl's PurlKey asserts to `purl_key.rs` (#1907), drop pipenv `installed_major`'s `_root` (callers in #1897 and the `vendor/pypi.rs` PRs). Waiting on PRs: `utils/fs.rs` and core `lib.rs` (#1891), `go_env.rs`/`go_installed_tools.rs` (#1876), `cargo_workspace.rs` (#1866), `cargo_build_cache.rs` (#1849), `group_commit.rs` is free but 2,163 lines (sweep a region). Skip `agent_download.rs`, `apply.rs`, `get.rs`, `vendor.rs` while #1698 is open, `rollback.rs` while #1864 is open. Left from #1914: delete the String `read_capped` wrapper (callers in `maven_repo.rs`, held by #1886/#1891; or rename `read_capped_typed`, touching `api/client.rs`, held by #1870/#1891); `lock_fragments`/`pdm_lock` `pub mod` → `pub(crate)` waits on #1898. Left from #1907: `CargoCrawler::cargo_home` forwarder (#1882), digest's `vendor/jvm` copies (#1886), async `fs::is_symlink` (#1891).
38+
The next run is structural if a candidate scoring 6 or more has free files, else a sweep. Next sweep files, in order: `vlt_preflight.rs` (callers in `vendor.rs`, #1698), `vex_consumed.rs`, `vex_sources.rs` (free; check callers), `scan/policy.rs` and `scan/render.rs` once #1856/#1884 merge; core `utils/lock_fragments.rs` (wait on #1898); next free: `python_lock.rs` (2,283), `python_script.rs` (1,768), then `api/{blob_fetcher,date,retry,types}.rs` and the crawler rows. `purl_key_nuget_vendor_tests.rs` waits on #1907 (`purl_key.rs` mounts it); scan `policy`/`rollout`/`rollout_args`/`socket_yml_args`/`withdrawn` have free files but their callers sit in `scan/mod.rs` (#1856, #1884, #1897). Left from #1923: delete `toml_edit_ext` (move `ensure_table`/`has_table` beside their one caller each; `utils/mod.rs` held by #1914, `vendor/pypi.rs` by the pypi PRs) and fold `uv_workspace`'s two-call pattern (`governing_root.rs` #1863, `vendor/pypi.rs`). `process.rs` waits on #1895, `pdm_lock.rs` on #1898, `poetry_lock.rs` on #1865/#1898, `pnpm_workspace.rs` on #1863. Left from #1920: inline the 7 `build_*_purl` wrappers and `parse_jsr_purl` (callers held by #1882/#1886/#1891/#1698), move purl's PurlKey asserts to `purl_key.rs` (#1907), drop pipenv `installed_major`'s `_root` (callers in #1897 and the `vendor/pypi.rs` PRs). Waiting on PRs: `utils/fs.rs` and core `lib.rs` (#1891), `go_env.rs`/`go_installed_tools.rs` (#1876), `cargo_workspace.rs` (#1866), `cargo_build_cache.rs` (#1849), `group_commit.rs` is free but 2,163 lines (sweep a region). Skip `agent_download.rs`, `apply.rs`, `get.rs`, `vendor.rs` while #1698 is open, `rollback.rs` while #1864 is open. Left from #1914: delete the String `read_capped` wrapper (callers in `maven_repo.rs`, held by #1886/#1891; or rename `read_capped_typed`, touching `api/client.rs`, held by #1870/#1891); `lock_fragments`/`pdm_lock` `pub mod` → `pub(crate)` waits on #1898. Left from #1907: `CargoCrawler::cargo_home` forwarder (#1882), digest's `vendor/jvm` copies (#1886), async `fs::is_symlink` (#1891).
3839

3940
#### Notes
4041
- First-thread PRs: `review/2026-10-v1/register/90-refactor.md`.
@@ -60,3 +61,4 @@ The next run is structural if a candidate scoring 6 or more has free files, else
6061
- Left from #1929: `UpdateArgs.pin_version` as `semver::Version` waits on `lib.rs` (#1842); `sweep_orphan_vendor_dirs` forwarder on `vendor.rs` (#1698).
6162
- Wants an issue: `strip_url_userinfo`'s scp branch keeps credentials in `u:p@host:team@2024/r.git` (changes VEX `@id` bytes).
6263
- Left from #1936: `vendor/gem.rs` `plan_gemfile_edit`, `vex/discover/gem.rs` (~L252) and `redirect/upstream/gem.rs` (~L661) still hand-scan `=begin`; route them through `manifest::code_lines` (the pin writer refuses a Gemfile whose duplicate `gem` line sits in `=begin`). `code_lines`'s heredoc heuristic reads `x <<FLAG` (a shift) as a heredoc and closes a plain `<<ID` at an indented terminator.
64+
- Left from #1939: `remove.rs` L1327 doc still names the deleted `revert_vendor_entry` (#1875); `commands/repair.rs` ~L429 copies the build-once client (use `vendored_backend::repair::ensure_client`, #1875); `ApplyRequest.manifest` → `&HashMap` + delete `records_manifest`, and `stop_on_failure`, wait on `vendor.rs` (#1698), `rollback.rs` (#1864), `remove.rs` (#1875); `repair()` (~560 lines) still wants its health check and redownload phases split.

0 commit comments

Comments
 (0)