Skip to content

Commit fa29db5

Browse files
committed
refactor: sweep vex_consumed/vex_sources (#1948)
Assisted-by: Claude Code:claude-opus-5-5
1 parent feba387 commit fa29db5

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

‎coverage/files.tsv‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ crates/socket-patch-cli/src/commands/vendor_orphans.rs 242 audit-cli-tests cbbbd
3737
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
3838
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
40-
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
41-
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
40+
crates/socket-patch-cli/src/commands/vex_consumed.rs 1028 audit-cli-tests cbbbdb9 2026-11-01 PR #1948 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
41+
crates/socket-patch-cli/src/commands/vex_sources.rs 1897 audit-cli-tests cbbbdb9 2026-11-01 PR #1948 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
4242
crates/socket-patch-cli/src/commands/vlt_heal.rs 762 audit-cli-tests cbbbdb9 2026-11-01 PR #1929 L426-431 dead (healed implies healed_store set at L400); L42 load_state error swallowed; rollback_heal L446 .ok() swallows all IO errors, should return Option<String> like takeover_heal; merge rollback_heal/takeover_heal Target building; inline 6 single-caller fns; L32 full std path; test advisory_variants_follow_severity_order redundant; ~10 comment lines; see T27, T49
4343
crates/socket-patch-cli/src/commands/vlt_preflight.rs 288 audit-cli-tests cbbbdb9 2026-11-01 - vlt_vendor_preflight_selected copies bun_preflight selection_pairs; refusals Vec + linear lookup forces is_some()-then-expect at vendor_flow L225 (use a map); vendor.rs L3174 passes bun_pairs and common.cwd; module doc caller list L7-12 will go stale; see T05, T49
4444
crates/socket-patch-cli/src/ecosystem_dispatch.rs 2856 audit-cli-tests cbbbdb9 2026-11-01 - drop wrappers crawl_covers_purl L28, passthrough_purls L417, merge_npm_copies L338; fold 9 dispatch_find_with_npm_links wrappers (find_all_packages_for_rollback_reusing has no prod Some caller); crawl! list dup L1387/L1403; .ok() L763, unwrap_or_default join L789; expect L1221; stale doc L1081; ~90 comment lines; 9 weak tests (passthrough_purls_is_identity, banner test checks no stderr…); T44, T47
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[agent] 2026-11-01: architecture refactor (sweep)
2+
3+
`main` @ `cbbbdb9`. The previous entry was structural (#1944), so this run is a sweep. Nothing of mine merged or closed since the last entry, and the discussion has no maintainer steering. The register's next sweep files, `vex_consumed.rs` and `vex_sources.rs`, are free: no open PR touches them. Their outside callers `vex.rs` (#1698/#1893), `vendor.rs`/`apply.rs` (#1698) and `repair.rs` (#1875) are held, so only file-local notes landed.
4+
5+
**PR:** [#1948](https://github.com/SocketDev/socket-patch/pull/1948), ready for review. CI (`ci-ok`) and Bugbot are green. `/code-review high` found no correctness bugs: I fixed 6 of its 7 cleanup notes and gave the reason for the other one in the PR.
6+
7+
### Per file
8+
- **`vex_consumed.rs`:** 1 wrapper deleted (`not_installed`, 9 sites); 1 `cfg(test)` forwarder deleted (`npm_identity_fallback`); 8 comment lines removed (banners, bare refs); 2 test docs fixed (stale, garbled); 1 test wrapper deleted (`write_pkg`). Production about −22, tests about −119 (mostly the move).
9+
- **`vex_sources.rs`:** 1 fn inlined (`recognized_dead_note`); 1 forwarder deleted (`note()`, 12 sites); 12 consts made private; 3 consts regrouped; 6 comment lines removed. Production about −15.
10+
- **`ecosystem_dispatch.rs`:** 2 tests moved in from `vex_consumed.rs` and renamed after the lookup they test; `write_npm_package` shares the new `write_package_json` writer.
11+
- **Total:** +247 / −285.
12+
13+
### Behavior
14+
None.
15+
16+
### Merges recorded
17+
None.
18+
19+
### Lessons
20+
- **An audit's "inline" note can remove a test seam.** /code-review pushed back on inlining `fetch_concurrency` (its test is the only check of the window's own ceiling) and `build_candidates` (it names a phase of a 350-line fn). Both stay.
21+
- **A bracket-rewriting script must skip parens inside string literals.** The `note(…)` → `PlanNote { … }` rewrite closed one call at a `)` inside a format string; the build caught it.

‎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-01T17:15Z · main @ cbbbdb9_
2+
_Last updated 2026-11-01T20:00Z · main @ cbbbdb9_
33

44
#### In flight
55
| PR | Kind | Scope | State |
@@ -22,6 +22,7 @@ _Last updated 2026-11-01T17:15Z · main @ cbbbdb9_
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 |
2323
| #1939 | sweep | `cli/src/commands/vendored_backend/{mod,repair}.rs` | ready; CI (82 checks) and Bugbot green |
2424
| #1944 | structural | T51 #1941: 11 `tests/apply` suites + `common/envelope.rs` onto `apply_fixture` (test-only, −635 net) | ready; Bugbot clean, 80/82 green; `hosted-e2e` red on a live patch.socket.dev 403 (minimist tgz), not this diff; re-run once |
25+
| #1948 | sweep | `cli/src/commands/{vex_consumed,vex_sources}.rs` (+ 2 tests moved to `ecosystem_dispatch.rs`) | ready; CI (ci-ok) and Bugbot green |
2526

2627
#### Merged
2728
_None._
@@ -33,7 +34,7 @@ Structural, scored `3·B + 2·U + 2·D + 2·C − risk`. Nothing merged since 20
3334
3. T55 (no issue yet), test helpers across binaries (`stderr_chatter` 5×, dir snapshot ~8×): ~6 once filed; includes a `run_bin_with_env` `extras` param so `apply_fixture::run_gem` stops copying it.
3435
A26 #1867, A46 #1917, A44 #1918 score ~4.
3536

36-
Next sweep files, in order: `vex_consumed.rs`, `vex_sources.rs` (free; check callers); `scan/policy.rs`, `scan/render.rs` after #1856/#1884; `python_lock.rs` (2,283), `python_script.rs` (1,768), `api/{blob_fetcher,date,retry,types}.rs`, crawler rows; `group_commit.rs` (2,163, region); `tests/apply/*` rows not covered by #1944 (their notes list fake tests). Held: `vlt_preflight.rs`, `agent_download.rs`, `apply.rs`, `get.rs`, `vendor.rs` (#1698); `rollback.rs` (#1864); `utils/fs.rs`, core `lib.rs` (#1891); `lock_fragments.rs`/`pdm_lock.rs` (#1898); `poetry_lock.rs` (#1865/#1898); `pnpm_workspace.rs` (#1863); `process.rs` (#1895); `go_env.rs` (#1876); `cargo_workspace.rs` (#1866). Leftovers from merged-pending sweeps: `toml_edit_ext` deletion and `uv_workspace` fold (#1923); 7 `build_*_purl` wrappers + `parse_jsr_purl`, purl's PurlKey asserts → `purl_key.rs`, pipenv `installed_major`'s `_root` (#1920); String `read_capped` wrapper, `lock_fragments`/`pdm_lock` `pub mod` → `pub(crate)` (#1914); `CargoCrawler::cargo_home`, `vendor/jvm` digest copies, async `fs::is_symlink` (#1907).
37+
Next sweep files, in order: `scan/policy.rs`, `scan/render.rs` after #1856/#1884; `python_lock.rs` (2,283), `python_script.rs` (1,768), `api/{blob_fetcher,date,retry,types}.rs`, crawler rows; `group_commit.rs` (2,163, region); `tests/apply/*` rows not covered by #1944 (their notes list fake tests). Held: `vlt_preflight.rs`, `agent_download.rs`, `apply.rs`, `get.rs`, `vendor.rs` (#1698); `rollback.rs` (#1864); `utils/fs.rs`, core `lib.rs` (#1891); `lock_fragments.rs`/`pdm_lock.rs` (#1898); `poetry_lock.rs` (#1865/#1898); `pnpm_workspace.rs` (#1863); `process.rs` (#1895); `go_env.rs` (#1876); `cargo_workspace.rs` (#1866). Leftovers from merged-pending sweeps: `toml_edit_ext` deletion and `uv_workspace` fold (#1923); 7 `build_*_purl` wrappers + `parse_jsr_purl`, purl's PurlKey asserts → `purl_key.rs`, pipenv `installed_major`'s `_root` (#1920); String `read_capped` wrapper, `lock_fragments`/`pdm_lock` `pub mod` → `pub(crate)` (#1914); `CargoCrawler::cargo_home`, `vendor/jvm` digest copies, async `fs::is_symlink` (#1907); `api_auth_fallback_warning` → `json_envelope` and `PlanNote` → `RunWarning` (callers in `vendor.rs`/`apply.rs`/`vex.rs`, #1698), `store_variants` test → core `npm_crawler.rs` (#1829/#1891/#1906/#1915) (#1948).
3738

3839
#### Notes
3940
- First-thread PRs: `review/2026-10-v1/register/90-refactor.md`.
@@ -61,3 +62,4 @@ Next sweep files, in order: `vex_consumed.rs`, `vex_sources.rs` (free; check cal
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.
6364
- 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` (drop `records_manifest`) and `stop_on_failure` wait on #1698/#1864/#1875; split `repair()`'s phases.
65+
- /code-review pushes back on inlining a single-caller fn that is the only unit-test seam for a constant (`fetch_concurrency`'s ceiling) or that names a phase of a 350-line fn (`build_candidates`): keep those.

0 commit comments

Comments
 (0)