style: cargo fmt — clear formatting drift blocking the release gate

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
archipelago
2026-07-29 05:53:33 -04:00
co-authored by Claude Fable 5
parent 8e51164321
commit 5c19effdd1
11 changed files with 92 additions and 124 deletions
+10 -13
View File
@@ -420,7 +420,9 @@ pub async fn start_flash_job(
match &result {
Ok(()) => {
bg_job.push_log("Flash completed successfully".to_string()).await;
bg_job
.push_log("Flash completed successfully".to_string())
.await;
bg_job.finish().await;
info!(path = %path, board = ?board, family = %family, "LoRa firmware flash succeeded");
}
@@ -586,7 +588,8 @@ async fn fetch_meshtastic_image(
if tokio::fs::metadata(&zip_path).await.is_err() {
download_to_file(client, &zip_asset.browser_download_url, &zip_path, job).await?;
} else {
job.push_log(format!("Using cached {}", zip_asset.name)).await;
job.push_log(format!("Using cached {}", zip_asset.name))
.await;
}
// "*.factory.bin" is Meshtastic's full merged image (bootloader +
@@ -594,26 +597,20 @@ async fn fetch_meshtastic_image(
// erased chip — confirmed by inspecting the real zip's contents, as
// opposed to the plain "*.bin" OTA-update image which assumes an
// existing bootloader/partition table already on the chip.
let entry_name = format!(
"firmware-{}-{}.factory.bin",
board.meshtastic_id(),
version
);
let entry_name = format!("firmware-{}-{}.factory.bin", board.meshtastic_id(), version);
let out_path = cache.join(&entry_name);
if tokio::fs::metadata(&out_path).await.is_ok() {
return Ok(out_path);
}
job.push_log(format!(
"Extracting {entry_name} from {}",
zip_asset.name
))
.await;
job.push_log(format!("Extracting {entry_name} from {}", zip_asset.name))
.await;
let zip_path_owned = zip_path.clone();
let entry_name_owned = entry_name.clone();
let out_path_owned = out_path.clone();
tokio::task::spawn_blocking(move || -> Result<()> {
let file = std::fs::File::open(&zip_path_owned).context("Opening downloaded firmware zip")?;
let file =
std::fs::File::open(&zip_path_owned).context("Opening downloaded firmware zip")?;
let mut archive = zip::ZipArchive::new(file).context("Reading firmware zip")?;
let mut entry = archive
.by_name(&entry_name_owned)
+18 -14
View File
@@ -802,7 +802,10 @@ impl MeshService {
// the server name — it existed as write-only config with no reader
// until this line, which is why renaming on the Mesh page never
// changed anything on the air.
self.config.advert_name.clone().or_else(|| self.server_name.clone()),
self.config
.advert_name
.clone()
.or_else(|| self.server_name.clone()),
self.config.lora_region.clone(),
self.config.lora_radio_params,
self.config.channel_name.clone(),
@@ -1333,20 +1336,21 @@ impl MeshService {
// federation branch: the fall-through LoRa path twin-resolves the
// routing key via peer_dest_prefix.
let device_connected = self.state.status.read().await.device_connected;
let radio_twin_reachable = is_federation_synthetic && !exceeds_lora && device_connected && {
let peers = self.state.peers.read().await;
peers
.get(&contact_id)
.and_then(|p| p.arch_pubkey_hex.clone())
.map(|arch| {
peers.values().any(|p| {
p.contact_id < FEDERATION_CONTACT_ID_BASE
&& p.reachable
&& p.arch_pubkey_hex.as_deref() == Some(arch.as_str())
let radio_twin_reachable =
is_federation_synthetic && !exceeds_lora && device_connected && {
let peers = self.state.peers.read().await;
peers
.get(&contact_id)
.and_then(|p| p.arch_pubkey_hex.clone())
.map(|arch| {
peers.values().any(|p| {
p.contact_id < FEDERATION_CONTACT_ID_BASE
&& p.reachable
&& p.arch_pubkey_hex.as_deref() == Some(arch.as_str())
})
})
})
.unwrap_or(false)
};
.unwrap_or(false)
};
let mesh_only_mode = load_config(&self.data_dir)
.await
.ok()
+34 -23
View File
@@ -623,12 +623,14 @@ impl ReticulumLink {
dest_pubkey_prefix: &[u8; 6],
payload: &[u8],
) -> Result<()> {
let dest_hash = self.resolve_dest_hash(dest_pubkey_prefix).with_context(|| {
format!(
"Unknown Reticulum prefix {} — peer hasn't announced yet",
hex::encode(dest_pubkey_prefix)
)
})?;
let dest_hash = self
.resolve_dest_hash(dest_pubkey_prefix)
.with_context(|| {
format!(
"Unknown Reticulum prefix {} — peer hasn't announced yet",
hex::encode(dest_pubkey_prefix)
)
})?;
// Typed-envelope payloads (ReadReceipt/Reaction/etc. — anything small
// enough for the single-frame path) are raw binary CBOR, not text.
// `from_utf8_lossy` would irreversibly mangle them since `content`
@@ -663,12 +665,14 @@ impl ReticulumLink {
caption: Option<&str>,
) -> Result<()> {
use base64::{engine::general_purpose::STANDARD as B64, Engine as _};
let dest_hash = self.resolve_dest_hash(dest_pubkey_prefix).with_context(|| {
format!(
"Unknown Reticulum prefix {} — peer hasn't announced yet",
hex::encode(dest_pubkey_prefix)
)
})?;
let dest_hash = self
.resolve_dest_hash(dest_pubkey_prefix)
.with_context(|| {
format!(
"Unknown Reticulum prefix {} — peer hasn't announced yet",
hex::encode(dest_pubkey_prefix)
)
})?;
self.send_rpc(serde_json::json!({
"cmd": "send",
"dest_hash": hex::encode(dest_hash),
@@ -691,12 +695,14 @@ impl ReticulumLink {
/// `handle_event`, not awaited here.
pub async fn send_resource(&mut self, dest_pubkey_prefix: &[u8; 6], data: &[u8]) -> Result<()> {
use base64::{engine::general_purpose::STANDARD as B64, Engine as _};
let dest_hash = self.resolve_dest_hash(dest_pubkey_prefix).with_context(|| {
format!(
"Unknown Reticulum prefix {} — peer hasn't announced yet",
hex::encode(dest_pubkey_prefix)
)
})?;
let dest_hash = self
.resolve_dest_hash(dest_pubkey_prefix)
.with_context(|| {
format!(
"Unknown Reticulum prefix {} — peer hasn't announced yet",
hex::encode(dest_pubkey_prefix)
)
})?;
let req_id = self.next_resource_id();
self.send_rpc(serde_json::json!({
"cmd": "send_resource",
@@ -886,13 +892,15 @@ impl ReticulumLink {
.as_deref()
.and_then(protocol::parse_identity_broadcast);
let is_legacy_blob = legacy_identity.is_some();
let identity_blob_text = explicit_blob.or_else(|| {
app_data_text.clone().filter(|_| is_legacy_blob)
});
let identity_blob_text =
explicit_blob.or_else(|| app_data_text.clone().filter(|_| is_legacy_blob));
let parsed_identity = identity_blob_text
.as_deref()
.and_then(protocol::parse_identity_broadcast);
if let Some(text) = identity_blob_text.as_deref().filter(|_| parsed_identity.is_some()) {
if let Some(text) = identity_blob_text
.as_deref()
.filter(|_| parsed_identity.is_some())
{
let mut data = Vec::with_capacity(7 + text.len());
data.push(0); // channel index — unused by the identity path
data.extend_from_slice(&prefix);
@@ -1387,7 +1395,10 @@ mod tests {
pick_announced_name(None, Some("\u{FFFD}\u{FFFD}Shaza\u{FFFD}".into()), false),
None
);
assert_eq!(pick_announced_name(None, Some("has\u{1}ctl".into()), false), None);
assert_eq!(
pick_announced_name(None, Some("has\u{1}ctl".into()), false),
None
);
// Nothing at all.
assert_eq!(pick_announced_name(None, None, false), None);
}