From b15b16029452f4344d9268b3295e7afdea686a9e Mon Sep 17 00:00:00 2001 From: archipelago Date: Mon, 3 Aug 2026 01:34:23 -0400 Subject: [PATCH] style: rustfmt the code added in 01-04 and the reconcile fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The release gate's cargo-fmt stage failed on my own additions — the tests in message_types.rs and lnd/info.rs and the reconcile branch in prod_orchestrator.rs were written programmatically and never passed through rustfmt. Formatting only; rustfmt is semantics-preserving and the gate re-runs the suites before building. Caught by the gate rather than in review, which is the gate working. Also a reminder that a piped command's exit code is the pipe's, not the script's: the task notification reported success while the log said CREATE_RELEASE_EXIT=1. Co-Authored-By: Claude Opus 5 (1M context) --- core/archipelago/src/api/rpc/lnd/info.rs | 9 ++++-- .../src/container/prod_orchestrator.rs | 4 ++- core/archipelago/src/mesh/message_types.rs | 32 +++++++++++-------- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/core/archipelago/src/api/rpc/lnd/info.rs b/core/archipelago/src/api/rpc/lnd/info.rs index 4f67a7a0..a830bdbb 100644 --- a/core/archipelago/src/api/rpc/lnd/info.rs +++ b/core/archipelago/src/api/rpc/lnd/info.rs @@ -269,8 +269,7 @@ mod tests { use super::*; /// A real compressed secp256k1 pubkey shape: 66 hex characters. - const GOOD_PUBKEY: &str = - "03a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90"; + const GOOD_PUBKEY: &str = "03a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90"; fn parse(body: &str) -> LndGetInfoResponse { serde_json::from_str(body).expect("LND getinfo body must deserialize") @@ -285,7 +284,11 @@ mod tests { let (pubkey, uris) = map_identity(&parsed); assert_eq!(pubkey.as_deref(), Some(GOOD_PUBKEY)); - assert_eq!(uris.len(), 2, "both advertised URIs must survive the mapping"); + assert_eq!( + uris.len(), + 2, + "both advertised URIs must survive the mapping" + ); assert!(uris[0].starts_with(GOOD_PUBKEY)); } diff --git a/core/archipelago/src/container/prod_orchestrator.rs b/core/archipelago/src/container/prod_orchestrator.rs index b426377b..240f489a 100644 --- a/core/archipelago/src/container/prod_orchestrator.rs +++ b/core/archipelago/src/container/prod_orchestrator.rs @@ -6085,7 +6085,9 @@ app: // Rewriting the file is not enough — nginx only loads it on restart. let calls = rt.calls(); assert!( - calls.iter().any(|c| c == "start_container:archy-bitcoin-ui"), + calls + .iter() + .any(|c| c == "start_container:archy-bitcoin-ui"), "container must be restarted so nginx picks the new config up: {calls:?}" ); assert_eq!( diff --git a/core/archipelago/src/mesh/message_types.rs b/core/archipelago/src/mesh/message_types.rs index 9e07d280..f10f8ea8 100644 --- a/core/archipelago/src/mesh/message_types.rs +++ b/core/archipelago/src/mesh/message_types.rs @@ -1024,12 +1024,14 @@ mod tests { assert_eq!(decoded.height, 890412); } - const LN_PUBKEY: &str = - "03a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90"; + const LN_PUBKEY: &str = "03a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90"; #[test] fn lightning_info_round_trips_through_u8_label_and_back() { - assert_eq!(MeshMessageType::from_u8(26), Some(MeshMessageType::LightningInfo)); + assert_eq!( + MeshMessageType::from_u8(26), + Some(MeshMessageType::LightningInfo) + ); assert_eq!(MeshMessageType::LightningInfo.label(), "lightning_info"); assert_eq!( MeshMessageType::from_label("lightning_info"), @@ -1077,10 +1079,14 @@ mod tests { #[test] fn valid_lightning_uris_are_accepted() { assert!(is_valid_lightning_uri(&format!("{LN_PUBKEY}@1.2.3.4:9735"))); - assert!(is_valid_lightning_uri(&format!("{LN_PUBKEY}@example.com:9735"))); + assert!(is_valid_lightning_uri(&format!( + "{LN_PUBKEY}@example.com:9735" + ))); // The :port suffix is optional. assert!(is_valid_lightning_uri(&format!("{LN_PUBKEY}@1.2.3.4"))); - assert!(is_valid_lightning_uri(&format!("{LN_PUBKEY}@abcdefghij.onion:9735"))); + assert!(is_valid_lightning_uri(&format!( + "{LN_PUBKEY}@abcdefghij.onion:9735" + ))); } #[test] @@ -1088,16 +1094,16 @@ mod tests { let bad = [ "".to_string(), "no-at-sign".to_string(), - LN_PUBKEY.to_string(), // no host at all - format!("{LN_PUBKEY}@"), // empty host - "@1.2.3.4:9735".to_string(), // no pubkey - format!("{}@1.2.3.4:9735", &LN_PUBKEY[..65]), // pubkey too short + LN_PUBKEY.to_string(), // no host at all + format!("{LN_PUBKEY}@"), // empty host + "@1.2.3.4:9735".to_string(), // no pubkey + format!("{}@1.2.3.4:9735", &LN_PUBKEY[..65]), // pubkey too short format!("{}z@1.2.3.4:9735", &LN_PUBKEY[..65]), // pubkey not hex - format!("{LN_PUBKEY}@1.2.3.4:99999"), // port out of u16 range - format!("{LN_PUBKEY}@1.2.3.4:"), // empty port - format!("{LN_PUBKEY}@1.2.3.4:http"), // non-numeric port + format!("{LN_PUBKEY}@1.2.3.4:99999"), // port out of u16 range + format!("{LN_PUBKEY}@1.2.3.4:"), // empty port + format!("{LN_PUBKEY}@1.2.3.4:http"), // non-numeric port format!("{LN_PUBKEY}@host with spaces:9735"), - format!("{LN_PUBKEY}@a@b:9735"), // two '@' + format!("{LN_PUBKEY}@a@b:9735"), // two '@' ]; for uri in bad { assert!(