Skip to content

Commit 1822d82

Browse files
committed
Revert rustfmt-only churn in files this fix doesn't touch
661c117 ran `cargo fmt --all`, which reformatted 118 files the uv fix never changes. main isn't rustfmt-clean and CI doesn't check formatting, so the sweep adds nothing. It also hides the real change and conflicts with every other open PR that touches those files. Each reverted file is byte-identical to rustfmt's output on the merge-base version, so this drops formatting only. The six files that carry the fix and the ported #878 change keep their formatting. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 064b21d commit 1822d82

118 files changed

Lines changed: 790 additions & 2177 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎crates/socket-patch-cli/src/commands/list.rs‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,7 @@ pub async fn run(args: ListArgs) -> i32 {
431431
detail: detail.clone(),
432432
});
433433
} else if !args.common.silent {
434-
eprintln!(
435-
"Warning: {}",
436-
crate::commands::rollback::capitalize_first(detail)
437-
);
434+
eprintln!("Warning: {}", crate::commands::rollback::capitalize_first(detail));
438435
}
439436
}
440437
let vendor_state = crate::commands::vendor_state_lenient(&loaded.vendor, args.common.silent);
@@ -776,18 +773,12 @@ mod tests {
776773
let listings = HostedListing::from_pins(
777774
&[
778775
pin("pkg:npm/minimist@1.2.2", &record.uuid),
779-
pin(
780-
"pkg:npm/other@1.0.0",
781-
"33333333-3333-4333-8333-333333333333",
782-
),
776+
pin("pkg:npm/other@1.0.0", "33333333-3333-4333-8333-333333333333"),
783777
],
784778
Some(&legacy),
785779
);
786780
assert_eq!(listings[0].record, record);
787-
assert_eq!(
788-
listings[1].record.uuid,
789-
"33333333-3333-4333-8333-333333333333"
790-
);
781+
assert_eq!(listings[1].record.uuid, "33333333-3333-4333-8333-333333333333");
791782
assert!(listings[1].record.vulnerabilities.is_empty());
792783
assert_eq!(listings[1].lockfiles, vec!["yarn.lock".to_string()]);
793784
}

‎crates/socket-patch-cli/src/commands/mod.rs‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
pub mod apply;
22
pub(crate) mod bun_preflight;
3-
pub(crate) mod composer_hints;
43
pub(crate) mod context;
4+
pub(crate) mod composer_hints;
55
pub(crate) mod fetch_stage;
66
pub mod get;
77
pub mod hosted_bundle;
88
pub mod list;
99
pub(crate) mod lock_cli;
1010
pub mod remove;
1111
pub mod repair;
12+
pub(crate) mod vendored_backend;
1213
pub mod rollback;
1314
pub mod scan;
1415
pub mod update;
1516
pub mod vendor;
16-
pub(crate) mod vendored_backend;
1717
pub mod vex;
1818
pub(crate) mod vex_consumed;
1919
pub(crate) mod vex_sources;
@@ -141,11 +141,9 @@ pub(crate) async fn hosted_state_from_lockfiles(
141141
common: &crate::args::GlobalArgs,
142142
root: &Path,
143143
) -> socket_patch_core::patch::redirect::RedirectState {
144-
hosted_state_from_pins(
145-
&socket_patch_core::patch::redirect::upstream::HostedPin::all(
146-
&discover_wiring(common, root).await,
147-
),
148-
)
144+
hosted_state_from_pins(&socket_patch_core::patch::redirect::upstream::HostedPin::all(
145+
&discover_wiring(common, root).await,
146+
))
149147
}
150148

151149
/// [`hosted_state_from_lockfiles`] over already-discovered pins. A purl
@@ -155,17 +153,18 @@ pub(crate) fn hosted_state_from_pins(
155153
) -> socket_patch_core::patch::redirect::RedirectState {
156154
let mut state = socket_patch_core::patch::redirect::RedirectState::new();
157155
for pin in pins {
158-
state.records.entry(pin.purl.clone()).or_insert_with(|| {
159-
socket_patch_core::manifest::schema::PatchRecord {
156+
state
157+
.records
158+
.entry(pin.purl.clone())
159+
.or_insert_with(|| socket_patch_core::manifest::schema::PatchRecord {
160160
uuid: pin.uuid.clone(),
161161
exported_at: String::new(),
162162
files: Default::default(),
163163
vulnerabilities: Default::default(),
164164
description: String::new(),
165165
license: String::new(),
166166
tier: String::new(),
167-
}
168-
});
167+
});
169168
}
170169
state
171170
}
@@ -192,3 +191,4 @@ pub(crate) fn vendor_state_lenient(
192191
}
193192
}
194193
}
194+

‎crates/socket-patch-cli/src/commands/scan/discovery.rs‎

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -168,32 +168,29 @@ pub(crate) async fn vendored_ledger_supplement(
168168
}
169169
// `(ledger key, base purl, entry)`; the artifact fallback has no
170170
// entries to probe, so it never reports unwired keys.
171-
let candidates: Vec<(
172-
String,
173-
String,
174-
Option<&socket_patch_core::vendor::VendorEntry>,
175-
)> = match state {
176-
Ok(state) => state
177-
.entries
178-
.iter()
179-
.map(|(key, entry)| {
180-
(
181-
key.clone(),
182-
strip_purl_qualifiers(&entry.base_purl).to_string(),
183-
Some(entry),
184-
)
185-
})
186-
.collect(),
187-
// Corrupt/unreadable ledger (a MISSING file is Ok(empty) above):
188-
// recover the vendored set from the committed artifacts, or
189-
// `scan --prune` (whose ledger exemption also degrades to empty)
190-
// would delete still-vendored packages' manifest entries and blobs.
191-
Err(_) => vendored_purls_from_artifacts(common)
192-
.await
193-
.into_iter()
194-
.map(|base| (base.clone(), base, None))
195-
.collect(),
196-
};
171+
let candidates: Vec<(String, String, Option<&socket_patch_core::vendor::VendorEntry>)> =
172+
match state {
173+
Ok(state) => state
174+
.entries
175+
.iter()
176+
.map(|(key, entry)| {
177+
(
178+
key.clone(),
179+
strip_purl_qualifiers(&entry.base_purl).to_string(),
180+
Some(entry),
181+
)
182+
})
183+
.collect(),
184+
// Corrupt/unreadable ledger (a MISSING file is Ok(empty) above):
185+
// recover the vendored set from the committed artifacts, or
186+
// `scan --prune` (whose ledger exemption also degrades to empty)
187+
// would delete still-vendored packages' manifest entries and blobs.
188+
Err(_) => vendored_purls_from_artifacts(common)
189+
.await
190+
.into_iter()
191+
.map(|base| (base.clone(), base, None))
192+
.collect(),
193+
};
197194
// Composer by release identity: a ledger `@3.0.2.0` is the crawled
198195
// `@3.0.2`, not a second package to supplement.
199196
let key = |p: &str| composer_purl_identity(p).unwrap_or_else(|| normalize_purl(p).into_owned());
@@ -1048,9 +1045,7 @@ mod tests {
10481045
..GlobalArgs::default()
10491046
};
10501047
let state = socket_patch_core::vendor::load_state(root).await;
1051-
vendored_ledger_supplement(&args, crawled, &state)
1052-
.await
1053-
.packages
1048+
vendored_ledger_supplement(&args, crawled, &state).await.packages
10541049
}
10551050

10561051
/// A ledger entry vendored as `@3.0.2.0` is the crawled composer
@@ -1085,9 +1080,7 @@ mod tests {
10851080
out.iter().map(|p| &p.purl).collect::<Vec<_>>()
10861081
);
10871082

1088-
let out = vendored_ledger_supplement(&args, &[], &Ok(state))
1089-
.await
1090-
.packages;
1083+
let out = vendored_ledger_supplement(&args, &[], &Ok(state)).await.packages;
10911084
assert_eq!(
10921085
out.iter().map(|p| p.purl.as_str()).collect::<Vec<_>>(),
10931086
vec!["pkg:composer/psr/log@3.0.2.0"]
@@ -1190,10 +1183,7 @@ mod tests {
11901183
let state = npm_ledger_with_lock(tmp.path(), lock.as_deref()).await;
11911184
let out = vendored_ledger_supplement(&args, &[], &state).await;
11921185
assert_eq!(
1193-
out.packages
1194-
.iter()
1195-
.map(|p| p.purl.as_str())
1196-
.collect::<Vec<_>>(),
1186+
out.packages.iter().map(|p| p.purl.as_str()).collect::<Vec<_>>(),
11971187
vec!["pkg:npm/left-pad@1.3.0"],
11981188
"lock={lock:?}"
11991189
);

‎crates/socket-patch-cli/src/commands/scan/hosted.rs‎

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,7 @@ pub(crate) async fn run_redirect_selected(
982982
socket_patch_core::utils::fs::read_regular_to_string_sync(path).ok()
983983
})
984984
};
985-
let rewrite_options = || {
986-
RewriteOptions {
985+
let rewrite_options = || RewriteOptions {
987986
dry_run: common.dry_run,
988987
targets_pipenv_lock,
989988
pipenv_major,
@@ -995,7 +994,6 @@ pub(crate) async fn run_redirect_selected(
995994
npm_allow_remote_config: !common.no_npm_allow_remote_config,
996995
npm_outer: &npm_outer,
997996
blocking: true,
998-
}
999997
};
1000998
// The rollout gate plans again without its deferred rows: keep what
1001999
// the second pass needs.
@@ -2433,19 +2431,13 @@ fn join_names(names: &[String], max: usize) -> String {
24332431
/// artifacts, then verify with `vex`. After a vendored→hosted takeover
24342432
/// (`vendored_removed`) the commit also has to carry the deleted vendored
24352433
/// ledger entries and artifacts.
2436-
fn format_next_steps(
2437-
files: &[String],
2438-
edits: &[socket_patch_core::patch::redirect::FileEdit],
2439-
vendored_removed: bool,
2440-
) -> Vec<String> {
2434+
fn format_next_steps(files: &[String], edits: &[socket_patch_core::patch::redirect::FileEdit], vendored_removed: bool) -> Vec<String> {
24412435
if files.is_empty() && !vendored_removed {
24422436
return Vec::new();
24432437
}
24442438
let mut commit: Vec<String> = Vec::new();
24452439
if vendored_removed {
2446-
commit.push(
2447-
".socket/vendor/ (the removed vendored ledger entries and artifacts)".to_string(),
2448-
);
2440+
commit.push(".socket/vendor/ (the removed vendored ledger entries and artifacts)".to_string());
24492441
}
24502442
commit.extend(files.iter().cloned());
24512443
let npm = files
@@ -4632,43 +4624,19 @@ mod tests {
46324624
use super::npm_allow_remote_one_line;
46334625
let hosts = ["patch.socket.dev"];
46344626
let cases = [
4635-
(
4636-
npm_allow_remote_configured_detail(&hosts, true, false),
4637-
"Note: set",
4638-
),
4639-
(
4640-
npm_allow_remote_configured_detail(&hosts, false, false),
4641-
"Note: set",
4642-
),
4643-
(
4644-
npm_allow_remote_configured_detail(&hosts, true, true),
4645-
"Note: would set",
4646-
),
4647-
(
4648-
npm_allow_remote_already_detail(&hosts),
4649-
"Note: .npmrc already",
4650-
),
4651-
(
4652-
npm_allow_remote_user_set_detail(&hosts, "none"),
4653-
"Warning: npm >=12",
4654-
),
4655-
(
4656-
npm_allow_remote_env_set_detail(&hosts, "npm_config_allow_remote", "none"),
4657-
"Warning: npm >=12",
4658-
),
4627+
(npm_allow_remote_configured_detail(&hosts, true, false), "Note: set"),
4628+
(npm_allow_remote_configured_detail(&hosts, false, false), "Note: set"),
4629+
(npm_allow_remote_configured_detail(&hosts, true, true), "Note: would set"),
4630+
(npm_allow_remote_already_detail(&hosts), "Note: .npmrc already"),
4631+
(npm_allow_remote_user_set_detail(&hosts, "none"), "Warning: npm >=12"),
4632+
(npm_allow_remote_env_set_detail(&hosts, "npm_config_allow_remote", "none"), "Warning: npm >=12"),
46594633
(npm_allow_remote_manual_detail(&hosts), "Warning: npm >=12"),
4660-
(
4661-
npm_allow_remote_unreadable_detail(&hosts, "is a symlink"),
4662-
"Warning: npm >=12",
4663-
),
4634+
(npm_allow_remote_unreadable_detail(&hosts, "is a symlink"), "Warning: npm >=12"),
46644635
];
46654636
for (detail, start) in cases {
46664637
let line = npm_allow_remote_one_line(&detail);
46674638
assert!(line.starts_with(start), "{line}");
4668-
assert!(
4669-
!line.contains('\n') && line.ends_with("(details: --verbose)."),
4670-
"{line}"
4671-
);
4639+
assert!(!line.contains('\n') && line.ends_with("(details: --verbose)."), "{line}");
46724640
}
46734641
}
46744642
}

0 commit comments

Comments
 (0)