GeezerVison is showing github.com — Fix filter conflict check to normalize package-prefixed keys · SocketDev/socket-patch@3446b3e
File treeExpand file treeCollapse file tree Open diff view settings in_process_rollback_hosted
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/src/commands/get.rs +9-3Lines changed: 9 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7272,8 +7272,11 @@ mod tests { | 7272 | 7272 | let installed = |name: &str, body: &[u8]| { | 7273 | 7273 | let dist = site.path().join(format!("{name}-1.0.0.dist-info")); | 7274 | 7274 | std::fs::create_dir_all(&dist).unwrap(); | 7275 | | - std::fs::write(dist.join("METADATA"), format!("Name: {name}\nVersion: 1.0.0\n")) | 7276 | | - .unwrap(); | | 7275 | + std::fs::write( | | 7276 | + dist.join("METADATA"), | | 7277 | + format!("Name: {name}\nVersion: 1.0.0\n"), | | 7278 | + ) | | 7279 | + .unwrap(); | 7277 | 7280 | std::fs::write(site.path().join(format!("{name}.py")), body).unwrap(); | 7278 | 7281 | compute_git_sha256_from_bytes(body) | 7279 | 7282 | }; | @@ -7317,7 +7320,10 @@ mod tests { | 7317 | 7320 | mount(uuid("bs"), "beta_sdist.py".into(), "0".repeat(64), 0).await; | 7318 | 7321 | for n in ["gw", "gs"] { | 7319 | 7322 | Mock::given(method("GET")) | 7320 | | - .and(wm_path(format!("/v0/orgs/test-org/patches/view/{}", uuid(n)))) | | 7323 | + .and(wm_path(format!( | | 7324 | + "/v0/orgs/test-org/patches/view/{}", | | 7325 | + uuid(n) | | 7326 | + ))) | 7321 | 7327 | .respond_with(ResponseTemplate::new(500)) | 7322 | 7328 | .expect(0) | 7323 | 7329 | .mount(&server) | |
Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/src/commands/scan/discovery.rs +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -2094,7 +2094,11 @@ mod tests { | 2094 | 2094 | | 2095 | 2095 | std::path::PathBuf::from("/nonexistent"), | 2096 | 2096 | ), | 2097 | | - | | 2097 | + crawled_pkg( | | 2098 | + "alpha", | | 2099 | + | | 2100 | + installed("alpha", "alpha.js"), | | 2101 | + ), | 2098 | 2102 | crawled_pkg( | 2099 | 2103 | "embedded", | 2100 | 2104 | | |
Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/src/commands/setup.rs +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -247,8 +247,7 @@ async fn hooked_vlt_members(found: &PackageJsonFindResult) -> Vec<PathBuf> { | 247 | 247 | } | 248 | 248 | let mut hooked = Vec::new(); | 249 | 249 | for loc in found.files.iter().filter(|loc| !loc.is_root) { | 250 | | - if let Ok(content) = socket_patch_core::utils::fs::read_regular_to_string(&loc.path).await | 251 | | - { | | 250 | + if let Ok(content) = socket_patch_core::utils::fs::read_regular_to_string(&loc.path).await { | 252 | 251 | let status = is_setup_configured_str(&content); | 253 | 252 | if status.postinstall_configured || status.dependencies_configured { | 254 | 253 | hooked.push(loc.path.clone()); | |
Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/src/commands/update.rs +17-4Lines changed: 17 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -159,7 +159,11 @@ fn cancelled_message(current: &semver::Version, target: &semver::Version) -> &'s | 159 | 159 |
| 160 | 160 | /// The result line after a successful install, naming the same action as | 161 | 161 | /// [`confirm_prompt`]. | 162 | | -fn installed_message(current: &semver::Version, target: &semver::Version, path: &std::path::Path) -> String { | | 162 | +fn installed_message( | | 163 | + current: &semver::Version, | | 164 | + target: &semver::Version, | | 165 | + path: &std::path::Path, | | 166 | +) -> String { | 163 | 167 | let path = path.display(); | 164 | 168 | if target < current { | 165 | 169 | format!("Downgraded socket-patch {current} \u{2192} {target} ({path})") | @@ -500,9 +504,18 @@ mod tests { | 500 | 504 |
| 501 | 505 | #[test] | 502 | 506 | fn cancel_and_result_lines_match_the_prompt() { | 503 | | - assert_eq!(cancelled_message(&v("4.0.0"), &v("9.9.9")), "Update cancelled."); | 504 | | - assert_eq!(cancelled_message(&v("4.0.0"), &v("3.0.0")), "Downgrade cancelled."); | 505 | | - assert_eq!(cancelled_message(&v("4.0.0"), &v("4.0.0")), "Reinstall cancelled."); | | 507 | + assert_eq!( | | 508 | + cancelled_message(&v("4.0.0"), &v("9.9.9")), | | 509 | + "Update cancelled." | | 510 | + ); | | 511 | + assert_eq!( | | 512 | + cancelled_message(&v("4.0.0"), &v("3.0.0")), | | 513 | + "Downgrade cancelled." | | 514 | + ); | | 515 | + assert_eq!( | | 516 | + cancelled_message(&v("4.0.0"), &v("4.0.0")), | | 517 | + "Reinstall cancelled." | | 518 | + ); | 506 | 519 | let p = std::path::Path::new("/opt/sp/socket-patch"); | 507 | 520 | assert_eq!( | 508 | 521 | installed_message(&v("4.0.0"), &v("9.9.9"), p), | |
Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/src/commands/vendor.rs +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -3864,7 +3864,11 @@ mod plan_gate_tests { | 3864 | 3864 | .unwrap(); | 3865 | 3865 | let packages = [ | 3866 | 3866 | | 3867 | | - | | 3867 | + ( | | 3868 | + | | 3869 | + "psr/http-message", | | 3870 | + UUID_B, | | 3871 | + ), | 3868 | 3872 | | 3869 | 3873 | ]; | 3870 | 3874 | let mut all_packages: Vec<(String, StagedSource)> = Vec::new(); | |
Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/src/hosted_memory/redirect.rs +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,8 +19,7 @@ use socket_patch_core::patch::redirect::npmrc::{ | 19 | 19 | NPMRC_REL, | 20 | 20 | }; | 21 | 21 | use socket_patch_core::patch::redirect::{ | 22 | | - rewrite_registry_redirect_withholding_vlt, DepOverride, FileEdit, RewriteResult, | 23 | | - RewriteWarning, | | 22 | + rewrite_registry_redirect_withholding_vlt, DepOverride, FileEdit, RewriteResult, RewriteWarning, | 24 | 23 | }; | 25 | 24 | use socket_patch_core::utils::purl::{purl_parts, strip_purl_qualifiers}; | 26 | 25 | use socket_patch_core::vendor::lock_inventory::{MemoryEntry, MemoryProject}; | |
Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/tests/apply_network.rs +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1075,10 +1075,7 @@ async fn mismatch_blob_topup_probes_every_copy_of_a_duplicated_package() { | 1075 | 1075 | v["summary"]["applied"], 1, | 1076 | 1076 | "the drifted nested copy must be warn-overwritten.\nstdout={v:#}" | 1077 | 1077 | ); | 1078 | | - assert_eq!( | 1079 | | - v["summary"]["failed"], 0, | 1080 | | - "no copy may fail.\nstdout={v:#}" | 1081 | | - ); | | 1078 | + assert_eq!(v["summary"]["failed"], 0, "no copy may fail.\nstdout={v:#}"); | 1082 | 1079 |
| 1083 | 1080 | // The nested copy's blob was fetched on demand… | 1084 | 1081 | let requests = mock.received_requests().await.unwrap(); | |
Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/tests/cli_config_fallback.rs +4-3Lines changed: 4 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -59,8 +59,7 @@ fn scan_cmd(project: &Path, data_dir: &Path) -> Command { | 59 | 59 | let mut cmd = Command::new(BINARY); | 60 | 60 | // Human mode: core's proxy advisory (the oracle below) is muted under | 61 | 61 | // `--json`/`--silent`. | 62 | | - cmd.args(["scan", "-e", "npm", "--cwd"]) | 63 | | - .arg(project); | | 62 | + cmd.args(["scan", "-e", "npm", "--cwd"]).arg(project); | 64 | 63 | for (key, _) in std::env::vars_os() { | 65 | 64 | let name = key.to_string_lossy(); | 66 | 65 | if name.starts_with("SOCKET_") { | @@ -298,7 +297,9 @@ async fn corrupt_config_warns_and_keeps_json_stdout_clean() { | 298 | 297 | json_cmd.arg("--json"); | 299 | 298 | let json_out = run(json_cmd); | 300 | 299 | assert!( | 301 | | - json_out.stderr.contains("could not parse socket-cli config"), | | 300 | + json_out | | 301 | + .stderr | | 302 | + .contains("could not parse socket-cli config"), | 302 | 303 | "the parse warning must reach stderr under --json too; got:\n{}", | 303 | 304 | json_out.stderr | 304 | 305 | ); | |
Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/tests/cli_parse_list.rs +8-2Lines changed: 8 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1202,7 +1202,10 @@ fn missing_manifest_with_corrupt_ledger_keeps_warning_in_error_envelope_via_bina | 1202 | 1202 | assert_eq!(v["error"]["code"], "manifest_not_found", "envelope={v}"); | 1203 | 1203 | let warnings = v["warnings"].as_array().expect("warnings[] present"); | 1204 | 1204 | assert_eq!(warnings.len(), 1, "envelope={v}"); | 1205 | | - assert_eq!(warnings[0]["code"], "redirect_ledger_corrupt", "envelope={v}"); | | 1205 | + assert_eq!( | | 1206 | + warnings[0]["code"], "redirect_ledger_corrupt", | | 1207 | + "envelope={v}" | | 1208 | + ); | 1206 | 1209 | assert!( | 1207 | 1210 | out.stderr.is_empty(), | 1208 | 1211 | "--json must keep stderr clean: {}", | @@ -1214,7 +1217,10 @@ fn missing_manifest_with_corrupt_ledger_keeps_warning_in_error_envelope_via_bina | 1214 | 1217 | let stderr = String::from_utf8_lossy(&out.stderr); | 1215 | 1218 | assert_eq!(out.status.code(), Some(1)); | 1216 | 1219 | assert!(stderr.contains("Warning: "), "stderr={stderr}"); | 1217 | | - assert!(stderr.contains("Error: Manifest not found at "), "stderr={stderr}"); | | 1220 | + assert!( | | 1221 | + stderr.contains("Error: Manifest not found at "), | | 1222 | + "stderr={stderr}" | | 1223 | + ); | 1218 | 1224 | } | 1219 | 1225 |
| 1220 | 1226 | #[test] | |
Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/tests/cli_parse_rollback.rs +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -378,7 +378,11 @@ fn bare_bool_does_not_consume_next_token() { | 378 | 378 | /// relied on the rejection get a test-visible flip instead of a silent one. | 379 | 379 | #[test] | 380 | 380 | fn multiple_targets_parse_in_order() { | 381 | | - let args = parse_rollback(&["pkg:npm/foo@1", "packages/api/**", "b0630680-4da6-45f9-bba8-b888e0ffd58c"]); | | 381 | + let args = parse_rollback(&[ | | 382 | + "pkg:npm/foo@1", | | 383 | + "packages/api/**", | | 384 | + "b0630680-4da6-45f9-bba8-b888e0ffd58c", | | 385 | + ]); | 382 | 386 | assert_eq!( | 383 | 387 | args.targets, | 384 | 388 | vec![ | |
|