Skip to content

Commit 1474ba2

Browse files
committed
format only changes -- ran cargo fmt for PR 418 files
1 parent 80c8291 commit 1474ba2

14 files changed

Lines changed: 195 additions & 194 deletions

File tree

host/conductora/plugins/tauri-plugin-holochain/holochain_runtime/src/launch.rs

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ pub(crate) async fn launch_holochain_runtime(
3030
) -> crate::error::Result<HolochainRuntime> {
3131
let t_total = std::time::Instant::now();
3232
tracing::info!("[LAUNCH] Starting holochain runtime (dev_mode={})", config.dev_mode);
33-
if rustls::crypto::aws_lc_rs::default_provider()
34-
.install_default()
35-
.is_err()
36-
{
33+
if rustls::crypto::aws_lc_rs::default_provider().install_default().is_err() {
3734
tracing::error!("could not set crypto provider for tls");
3835
}
3936

@@ -50,7 +47,9 @@ pub(crate) async fn launch_holochain_runtime(
5047
// Dev mode: skip the WAN signal check entirely (avoids 1-5s TCP handshake/timeout).
5148
// Spin up an instant loopback signal server instead — the conductor needs *some*
5249
// signal URL in its network config, but it never actually needs to reach the internet.
53-
tracing::info!("[LAUNCH] DEV MODE: skipping WAN signal check, starting local loopback signal server");
50+
tracing::info!(
51+
"[LAUNCH] DEV MODE: skipping WAN signal check, starting local loopback signal server"
52+
);
5453
let loopback = std::net::IpAddr::V4(std::net::Ipv4Addr::LOCALHOST);
5554
let port = portpicker::pick_unused_port().expect("No ports free");
5655
let signal_handle = run_local_signal_service(loopback.to_string(), port).await?;
@@ -104,10 +103,7 @@ pub(crate) async fn launch_holochain_runtime(
104103
clean_dev_conductor_state(&dev_dir);
105104

106105
// DangerTestKeystore is set in the config; no lair process needed.
107-
Conductor::builder()
108-
.config(conductor_config)
109-
.build()
110-
.await?
106+
Conductor::builder().config(conductor_config).build().await?
111107
} else {
112108
tracing::info!("[LAUNCH] Spawning lair keystore (in-proc)...");
113109
let t0 = std::time::Instant::now();
@@ -117,20 +113,13 @@ pub(crate) async fn launch_holochain_runtime(
117113
.map_err(|err| crate::Error::LairError(err))?;
118114
tracing::info!("[LAUNCH] Lair keystore ready in {:.1}s", t0.elapsed().as_secs_f64());
119115

120-
let seed_already_exists = keystore
121-
.lair_client()
122-
.get_entry(DEVICE_SEED_LAIR_KEYSTORE_TAG.into())
123-
.await
124-
.is_ok();
116+
let seed_already_exists =
117+
keystore.lair_client().get_entry(DEVICE_SEED_LAIR_KEYSTORE_TAG.into()).await.is_ok();
125118

126119
if !seed_already_exists {
127120
keystore
128121
.lair_client()
129-
.new_seed(
130-
DEVICE_SEED_LAIR_KEYSTORE_TAG.into(),
131-
None,
132-
true,
133-
)
122+
.new_seed(DEVICE_SEED_LAIR_KEYSTORE_TAG.into(), None, true)
134123
.await
135124
.map_err(|err| crate::Error::LairError(err))?;
136125
}
@@ -155,7 +144,10 @@ pub(crate) async fn launch_holochain_runtime(
155144

156145
// *lock = Some(info.clone());
157146

158-
tracing::info!("[LAUNCH] Total launch_holochain_runtime: {:.1}s", t_total.elapsed().as_secs_f64());
147+
tracing::info!(
148+
"[LAUNCH] Total launch_holochain_runtime: {:.1}s",
149+
t_total.elapsed().as_secs_f64()
150+
);
159151
Ok(HolochainRuntime {
160152
filesystem,
161153
apps_websockets_auths: Arc::new(Mutex::new(Vec::new())),
@@ -192,8 +184,8 @@ fn get_local_ip_address() -> std::net::IpAddr {
192184
}
193185

194186
fn try_connect_method() -> Result<std::net::IpAddr, Box<dyn std::error::Error>> {
195-
use std::net::{UdpSocket}; //SocketAddr
196-
187+
use std::net::UdpSocket; //SocketAddr
188+
197189
let socket = UdpSocket::bind("0.0.0.0:0")?;
198190
socket.connect("1.1.1.1:80")?; // Cloudflare DNS
199191
Ok(socket.local_addr()?.ip())
@@ -288,13 +280,19 @@ fn clean_dev_conductor_state(conductor_dir: &std::path::Path) {
288280
continue; // keep
289281
}
290282
let p = db_entry.path();
291-
if p.is_dir() { let _ = std::fs::remove_dir_all(&p); }
292-
else { let _ = std::fs::remove_file(&p); }
283+
if p.is_dir() {
284+
let _ = std::fs::remove_dir_all(&p);
285+
} else {
286+
let _ = std::fs::remove_file(&p);
287+
}
293288
}
294289
}
295290
} else {
296-
if path.is_dir() { let _ = std::fs::remove_dir_all(&path); }
297-
else { let _ = std::fs::remove_file(&path); }
291+
if path.is_dir() {
292+
let _ = std::fs::remove_dir_all(&path);
293+
} else {
294+
let _ = std::fs::remove_file(&path);
295+
}
298296
}
299297
}
300298
}

host/conductora/plugins/tauri-plugin-holochain/holochain_runtime/src/launch/config.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ pub fn conductor_config(
3939
config.danger_generate_throwaway_device_seed = true;
4040
} else {
4141
config.data_root_path = Some(fs.conductor_dir().into());
42-
config.keystore = KeystoreConfig::LairServerInProc {
43-
lair_root: Some(lair_root),
44-
};
42+
config.keystore = KeystoreConfig::LairServerInProc { lair_root: Some(lair_root) };
4543
config.device_seed_lair_tag = Some(DEVICE_SEED_LAIR_KEYSTORE_TAG.into());
4644
}
4745

@@ -94,10 +92,7 @@ pub fn conductor_config(
9492
let allowed_origins = AllowedOrigins::Any;
9593

9694
config.admin_interfaces = Some(vec![AdminInterfaceConfig {
97-
driver: InterfaceDriver::Websocket {
98-
port: admin_port,
99-
allowed_origins,
100-
},
95+
driver: InterfaceDriver::Websocket { port: admin_port, allowed_origins },
10196
}]);
10297

10398
config

host/conductora/src/logging.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,4 @@ fn push_holochain_noise_filter(parts: &mut Vec<String>) {
198198
for (krate, level) in HOLOCHAIN_NOISY_CRATES {
199199
parts.push(format!("{krate}={level}"));
200200
}
201-
}
201+
}

host/conductora/src/setup/providers/holochain_setup.rs

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use crate::config::providers::holochain::*;
22
use crate::config::StorageProvider;
33
use crate::setup::common_setup::{create_snapshot_store, serialize_props};
4-
use std::sync::{Arc, Mutex};
54
use crate::setup::receptor_config_registry::ReceptorConfigRegistry;
65
use crate::setup::window_setup::ProviderWindowSetup;
76
use async_trait::async_trait;
87
use holochain_client::{AdminWebsocket, AppInfo, AppWebsocket};
98
use holochain_receptor::HolochainConductorClient;
109
use holons_client::shared_types::base_receptor::BaseReceptor;
10+
use std::sync::{Arc, Mutex};
1111
use tauri::{AppHandle, Manager, Theme};
1212
use tauri_plugin_holochain::AgentPubKey;
1313
use tauri_plugin_holochain::{AppBundle, HolochainExt};
@@ -37,11 +37,17 @@ impl HolochainSetup {
3737
return Err(anyhow::anyhow!("Failed to load happ bundle: {}", e));
3838
}
3939
};
40-
tracing::info!("[HOLOCHAIN SETUP] happ bundle loaded in {:.1}s", t_setup.elapsed().as_secs_f64());
40+
tracing::info!(
41+
"[HOLOCHAIN SETUP] happ bundle loaded in {:.1}s",
42+
t_setup.elapsed().as_secs_f64()
43+
);
4144

4245
let t_admin = std::time::Instant::now();
4346
let admin_ws = handle.holochain()?.admin_websocket().await?;
44-
tracing::info!("[HOLOCHAIN SETUP] Admin websocket obtained in {:.1}s", t_admin.elapsed().as_secs_f64());
47+
tracing::info!(
48+
"[HOLOCHAIN SETUP] Admin websocket obtained in {:.1}s",
49+
t_admin.elapsed().as_secs_f64()
50+
);
4551

4652
let installed_apps = admin_ws
4753
.list_apps(None)
@@ -59,40 +65,40 @@ impl HolochainSetup {
5965
// Dev mode: conductor state (except wasm.db) was wiped before the
6066
// conductor started (see clean_dev_conductor_state in launch.rs), so
6167
// there is no stale app record. Install fresh with an ephemeral key.
62-
Self::handle_new_app_installation(
63-
&handle,
64-
&admin_ws,
65-
happ,
66-
app_id.clone(),
67-
true,
68-
)
69-
.await?;
68+
Self::handle_new_app_installation(&handle, &admin_ws, happ, app_id.clone(), true)
69+
.await?;
7070
} else if Self::is_app_installed(&installed_apps, app_id.clone()) {
7171
Self::handle_existing_app(&handle, happ, app_id.clone()).await?;
7272
} else {
73-
Self::handle_new_app_installation(
74-
&handle,
75-
&admin_ws,
76-
happ,
77-
app_id.clone(),
78-
false,
79-
)
80-
.await?;
73+
Self::handle_new_app_installation(&handle, &admin_ws, happ, app_id.clone(), false)
74+
.await?;
8175
}
82-
tracing::info!("[HOLOCHAIN SETUP] App install/update done in {:.1}s", t_install.elapsed().as_secs_f64());
76+
tracing::info!(
77+
"[HOLOCHAIN SETUP] App install/update done in {:.1}s",
78+
t_install.elapsed().as_secs_f64()
79+
);
8380

8481
let t_appws = std::time::Instant::now();
8582
let app_ws = handle.holochain()?.app_websocket(app_id.clone()).await?;
86-
tracing::info!("[HOLOCHAIN SETUP] App websocket obtained in {:.1}s", t_appws.elapsed().as_secs_f64());
83+
tracing::info!(
84+
"[HOLOCHAIN SETUP] App websocket obtained in {:.1}s",
85+
t_appws.elapsed().as_secs_f64()
86+
);
8787

8888
// After successful setup, build and register the base receptor
8989
let t_receptor = std::time::Instant::now();
9090
let receptor_cfg: BaseReceptor =
9191
Self::build_receptor(app_ws, admin_ws, &handle, name, hc_cfg).await?;
9292
Self::register_receptor(&handle, receptor_cfg).await?;
93-
tracing::info!("[HOLOCHAIN SETUP] Base receptor built in {:.1}s", t_receptor.elapsed().as_secs_f64());
93+
tracing::info!(
94+
"[HOLOCHAIN SETUP] Base receptor built in {:.1}s",
95+
t_receptor.elapsed().as_secs_f64()
96+
);
9497

95-
tracing::info!("[HOLOCHAIN SETUP] Total setup time: {:.1}s", t_setup.elapsed().as_secs_f64());
98+
tracing::info!(
99+
"[HOLOCHAIN SETUP] Total setup time: {:.1}s",
100+
t_setup.elapsed().as_secs_f64()
101+
);
96102
Ok(())
97103
}
98104

host/crates/holochain_receptor/src/holochain_conductor_client.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use holochain_client::{
1111
AdminWebsocket, AgentPubKey, AppInfo, AppWebsocket, CellInfo, ExternIO, SerializedBytes,
1212
ZomeCallTarget,
1313
};
14-
use holons_client::shared_types::holon_space::{HolonSpace, SpaceInfo};
1514
use holons_boundary::envelopes::{InternalDanceRequestEnvelope, InternalDanceResponseEnvelope};
1615
use holons_boundary::{DanceResponseWire, ResponseBodyWire};
16+
use holons_client::shared_types::holon_space::{HolonSpace, SpaceInfo};
1717
use holons_core::dances::ResponseStatusCode;
1818
use holons_trust_channel::DanceEnvelopeTransport;
1919

@@ -51,7 +51,10 @@ impl HolochainConductorClient {
5151
Ok(Some(app_info)) => {
5252
// Successfully retrieved AppInfo, now convert it.
5353
let space_info = convert_to_space_info(app_info)?;
54-
tracing::info!("[ReceptorService] Successfully retrieved space info: {:?}", space_info);
54+
tracing::info!(
55+
"[ReceptorService] Successfully retrieved space info: {:?}",
56+
space_info
57+
);
5558
Ok(space_info)
5659
}
5760
Ok(None) => {

host/crates/holochain_receptor/src/holochain_receptor.rs

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ use crate::holochain_conductor_client::HolochainConductorClient;
1010
use base_types::MapString;
1111
use core_types::HolonError;
1212
use holons_client::{
13-
client_context::ClientSession, dances_client::ClientDanceBuilder, init_client_context, shared_types::{
13+
client_context::ClientSession,
14+
dances_client::ClientDanceBuilder,
15+
init_client_context,
16+
shared_types::{
1417
base_receptor::{BaseReceptor, ReceptorBehavior},
1518
holon_space::{HolonSpace, SpaceInfo},
1619
map_request::{MapRequest, MapRequestBody},
1720
map_response::MapResponse,
18-
}
21+
},
1922
};
2023
use holons_core::core_shared_objects::transactions::TransactionContext;
2124
use holons_core::dances::{DanceInitiator, DanceResponse, ResponseBody, ResponseStatusCode};
@@ -60,7 +63,10 @@ impl HolochainReceptor {
6063
// Downcast the stored snapshot store into our concrete recovery store
6164
let session: ClientSession;
6265
if let Some(snapshot_store_any) = base.snapshot_store.as_ref() {
63-
let recovery_store = snapshot_store_any.clone().downcast::<TransactionRecoveryStore>().expect("Failed to deserialize TransactionRecoveryStore");
66+
let recovery_store = snapshot_store_any
67+
.clone()
68+
.downcast::<TransactionRecoveryStore>()
69+
.expect("Failed to deserialize TransactionRecoveryStore");
6470
session = init_client_context(Some(initiator), Some(recovery_store.clone()));
6571
} else {
6672
session = init_client_context(Some(initiator), None);
@@ -95,7 +101,8 @@ impl ReceptorBehavior for HolochainReceptor {
95101
if Self::is_commit_dance_request(request.name.as_str()) {
96102
let _commit_guard = self.session.context.begin_host_commit_ingress_guard()?;
97103
// Preserve request-shape validation before routing to context-owned commit execution.
98-
let _validated_request = ClientDanceBuilder::validate_and_execute(&self.session.context, &request)?;
104+
let _validated_request =
105+
ClientDanceBuilder::validate_and_execute(&self.session.context, &request)?;
99106
let response_reference = self.session.context.commit()?;
100107
let dance_response = DanceResponse::new(
101108
ResponseStatusCode::OK,
@@ -121,7 +128,8 @@ impl ReceptorBehavior for HolochainReceptor {
121128
}
122129
};
123130

124-
let response_reference = load_holons_from_files(self.session.context.clone(), content_set).await?;
131+
let response_reference =
132+
load_holons_from_files(self.session.context.clone(), content_set).await?;
125133
tracing::info!(
126134
"HolochainReceptor: loaded holons with reference: {:?}",
127135
response_reference
@@ -145,15 +153,14 @@ impl ReceptorBehavior for HolochainReceptor {
145153
if !is_read_only {
146154
self.session.context.ensure_host_mutation_entry_allowed()?;
147155
}
148-
let dance_request = ClientDanceBuilder::validate_and_execute(&self.session.context, &request)?;
149-
156+
let dance_request =
157+
ClientDanceBuilder::validate_and_execute(&self.session.context, &request)?;
158+
150159
//here depending on the command we create/undo/redo a snapshot checkpoint
151160
//see tests below for examples
152-
153-
let dance_response = self
154-
.session.context
155-
.initiate_ingress_dance(dance_request, is_read_only)
156-
.await?;
161+
162+
let dance_response =
163+
self.session.context.initiate_ingress_dance(dance_request, is_read_only).await?;
157164

158165
Ok(MapResponse::new_from_dance_response(request.space.id, dance_response))
159166
}
@@ -180,8 +187,6 @@ impl Debug for HolochainReceptor {
180187
mod tests {
181188
use super::HolochainReceptor;
182189
use base_types::{BaseValue, MapString};
183-
use holons_recovery::TransactionRecoveryStore;
184-
use std::{path::Path, sync::Arc};
185190
use core_types::{PropertyMap, PropertyName};
186191
use holons_client::{
187192
dances_client::ClientDanceBuilder,
@@ -192,6 +197,8 @@ mod tests {
192197
},
193198
};
194199
use holons_core::dances::DanceType;
200+
use holons_recovery::TransactionRecoveryStore;
201+
use std::{path::Path, sync::Arc};
195202

196203
/// Helper: open an in-memory recovery store (`:memory:` is a rusqlite built-in).
197204
fn in_memory_store() -> Arc<TransactionRecoveryStore> {
@@ -219,7 +226,11 @@ mod tests {
219226
assert!(undone.is_some(), "undo should return the snapshot that was undone");
220227

221228
let history_after_undo = session.list_undo_history().await;
222-
assert_eq!(history_after_undo.len(), 0, "undo stack should be empty after undoing the only entry");
229+
assert_eq!(
230+
history_after_undo.len(),
231+
0,
232+
"undo stack should be empty after undoing the only entry"
233+
);
223234

224235
// ── 3. Redo restores the entry ────────────────────────────────────
225236
let redone = session.redo().await;
@@ -235,7 +246,8 @@ mod tests {
235246

236247
let history_after_no_undo = session.list_undo_history().await;
237248
assert_eq!(
238-
history_after_no_undo.len(), 1,
249+
history_after_no_undo.len(),
250+
1,
239251
"disable_undo persist must not grow the undo stack"
240252
);
241253

@@ -254,7 +266,6 @@ mod tests {
254266
assert!(after_cleanup.is_none(), "recover_last_snapshot should return None after cleanup");
255267
}
256268

257-
258269
#[test]
259270
fn commit_route_classification_is_exact() {
260271
assert!(HolochainReceptor::is_commit_dance_request("commit"));
@@ -279,7 +290,7 @@ mod tests {
279290

280291
#[test]
281292
fn host_mutation_precheck_blocks_create_new_holon_before_builder_side_effects() {
282-
let session = init_client_context(None,None);
293+
let session = init_client_context(None, None);
283294
let context = session.context.clone();
284295
let _guard = context.begin_host_commit_ingress_guard().expect("guard should acquire");
285296

0 commit comments

Comments
 (0)