Skip to content

Commit 5a03525

Browse files
committed
refactor: sweep args.rs (PR #1842)
Assisted-by: Claude Code:claude-opus-5-5
1 parent 01e9863 commit 5a03525

3 files changed

Lines changed: 40 additions & 4 deletions

File tree

‎coverage/files.tsv‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
path lines owner audited swept notes
2-
crates/socket-patch-cli/src/args.rs 1810 audit-cli-tests c07af61 2026-10-29 - delete dead --vendor-source plumbing + 2 fake tests (C23); inline unsupported_ecosystem_message, telemetry_credentials, refuse_unloaded_deno_prefix; drop api_client_overrides empty filter; validate_paths: one require_dir for --cwd/--global-prefix; delete 6 inline tests duplicating tests/cli_global_args.rs; ~75 comment lines; env lists T03
2+
crates/socket-patch-cli/src/args.rs 1810 audit-cli-tests c07af61 2026-10-29 PR #1842 delete dead --vendor-source plumbing + 2 fake tests (C23); inline unsupported_ecosystem_message, telemetry_credentials, refuse_unloaded_deno_prefix; drop api_client_overrides empty filter; validate_paths: one require_dir for --cwd/--global-prefix; delete 6 inline tests duplicating tests/cli_global_args.rs; ~75 comment lines; env lists T03
33
crates/socket-patch-cli/src/commands/agent_download.rs 1909 audit-cli-tests c07af61 2026-10-29 - inline severity_rank, files_with_both_hashes, format_save_summary, sort_by_purl, record_apply_skip, nested_apply_args_from_params, write_blob_entry; drop run_outcome, claimed_purls, release_warnings; dead FetchBatch.already_recorded, into_envelope failed slot; derive persist_blobs from RecordStore; write_all_patch_blobs: return the error, not (); ~110 comment lines; see T01 T02 T05 T09
44
crates/socket-patch-cli/src/commands/apply.rs 4324 audit-cli-tests c07af61 2026-10-29 - fix missing \ continuations in gradle_m2_may_be_unconsumed detail (L3111: 17-space runs); delete dead args.check branch L1287, dead conjuncts L2799-2801, dead _ arm L2421/L2497; inline lock_resolution_is_calm, expected_hash_label, format_patched_line, format_mismatch_warning; drop refuse_yarn_pnp wrapper; RunWarning::new (12 literals), ui::print_json (8 println); ~250 comment lines; see T06-T08
55
crates/socket-patch-cli/src/commands/bun_preflight.rs 425 audit-cli-tests c07af61 2026-10-29 - collapse 3 one-line forwarders (bun_vendor_preflight, _with_ledger, _pairs); delete Option<LedgerLoad> lazy-load mode (only caller loads it anyway); inline refusal_with_exemptions (repeats applies_to npm filter); ~25 comment lines; merge with vlt_preflight: T05
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[agent] 2026-10-29: architecture refactor (sweep)
2+
3+
`main` @ `c07af61`. This is the first run of the refactor routine on this thread. No earlier entry existed and no maintainer steering was posted, so I swept the first audited, unswept row in `coverage/files.tsv`: `crates/socket-patch-cli/src/args.rs` (1810 lines). Open PRs don't touch it. #1698 touches `agent_download.rs`, `apply.rs` and `get.rs`, so those wait.
4+
5+
**PR:** [#1842](https://github.com/SocketDev/socket-patch/pull/1842), ready for review, with CI and Bugbot pending.
6+
7+
### args.rs
8+
- **Inlined: 3 functions.** `unsupported_ecosystem_message`, `telemetry_credentials`, and `refuse_unloaded_deno_prefix` (into its one caller, `Commands::validate_paths`).
9+
- **Flattened: 1.** `validate_paths` uses one `require_dir` instead of two copies of the same block.
10+
- **Comments: about 110 lines removed.** These were history notes, bare `#444` / `#745` / `#1123` references and text that restated the code. `--help` doc comments are untouched.
11+
- **Tests: 12 deleted, 4 fixed.**
12+
- 9 deleted as duplicates of `tests/cli_global_args.rs` or of another inline test.
13+
- 3 deleted because they can't fail: two assert constant `VendorSource` predicates, and one checks a hand-written list against itself.
14+
- The 4 fixed tests (ecosystem messages, `telemetry_auth`, `use_public_proxy` threading, and the `vendor-source` test name and comments) each fail when the code is broken; I checked that for the non-trivial ones.
15+
- **Net lines:** production −94 (`args.rs` −117, `lib.rs` +23), tests −232.
16+
17+
### Merges recorded
18+
None.
19+
20+
### Lessons
21+
- The coverage note "drop api_client_overrides empty filter" was wrong. `build_proxy_fallback_client` uses `proxy_url` without filtering empties, so the filter is load-bearing. I kept it and documented why.
22+
- Clap field doc comments are `--help` text, so a sweep must not trim them.
23+
24+
### Next
25+
Structural work, per the alternation rule. The top candidates are A01 (#1832) and A02 (#1833), both scoring 7.

‎register/90-refactor.md‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
### Refactor routine
2-
_Last updated 2026-10-29 · main @ b291caa_
2+
_Last updated 2026-10-29T17:15Z · main @ c07af61_
33

44
#### In flight
5-
_None._
5+
| PR | Kind | Scope | State |
6+
|---|---|---|---|
7+
| [#1842](https://github.com/SocketDev/socket-patch/pull/1842) | sweep | `cli/src/args.rs` (+ the Deno guard moved into `lib.rs`) | ready; CI and Bugbot pending |
68

79
#### Merged
810
_None._
911

1012
#### Queue
11-
_Not ranked yet. The first sweeps wait until the auditors have audited files._
13+
Structural candidates, scored `3·B + 2·U + 2·D + 2·C − risk`:
14+
1. A01 [#1832](https://github.com/SocketDev/socket-patch/issues/1832), cargo config chain read twice (bug): B1 D1 C1, risk L. **7**
15+
2. A02 [#1833](https://github.com/SocketDev/socket-patch/issues/1833), three segment glob matchers (bug): B1 D1 C1, risk L. **7**
16+
3. T01, `get <uuid>` re-implements `download_and_apply_patches_into`: D2.2 C2, risk M. **~6.4** (blocked while #1698 touches `get.rs` / `agent_download.rs`)
17+
4. A03 [#1834](https://github.com/SocketDev/socket-patch/issues/1834), GOMODCACHE rule twice: D1 C1, risk L. **4**
18+
5. T03 [#1837](https://github.com/SocketDev/socket-patch/issues/1837), hand-written env var lists: D1 C1, risk L. **4**
19+
20+
The next run is structural (the previous run was a sweep). Next sweep files, in order: `commands/bun_preflight.rs`, `commands/composer_hints.rs`, `commands/context.rs`, `commands/fetch_stage.rs`. Skip `agent_download.rs`, `apply.rs` and `get.rs` while #1698 is open.
1221

1322
#### Notes
1423
- The PRs of the first thread (`arch-refactor/<issue>-*`) are listed in `review/2026-10-v1/register/90-refactor.md`.
24+
- The `args.rs` note "drop api_client_overrides empty filter" was wrong: core `build_proxy_fallback_client` uses `overrides.proxy_url` unfiltered, so the CLI filter is load-bearing. Check every "redundant filter" note against all consumers of the value.
25+
- Field doc comments on clap structs are `--help` output. Trimming them changes output bytes, so sweeps leave them alone.

0 commit comments

Comments
 (0)