Skip to content

Commit ceb773f

Browse files
committed
format
1 parent db1d1ba commit ceb773f

File tree

5 files changed

+60
-25
lines changed

5 files changed

+60
-25
lines changed

backend/src/commands/blocks.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,9 @@ pub async fn notify_block_kv_value_changed(
369369
key: String,
370370
_value: serde_json::Value,
371371
) -> Result<(), String> {
372-
log::debug!("notify_block_kv_value_changed: document={document_id}, block={block_id}, key={key}");
372+
log::debug!(
373+
"notify_block_kv_value_changed: document={document_id}, block={block_id}, key={key}"
374+
);
373375

374376
let documents = state.documents.read().await;
375377
let document = documents.get(&document_id).ok_or("Document not found")?;

crates/atuin-desktop-runtime/src/blocks/ssh_connect.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use crate::{
22
blocks::{Block, BlockBehavior, FromDocument},
33
client::LocalValueProvider,
4-
context::{BlockContext, ContextResolver, DocumentSshConfig, DocumentSshHost, SshIdentityKeyConfig},
4+
context::{
5+
BlockContext, ContextResolver, DocumentSshConfig, DocumentSshHost, SshIdentityKeyConfig,
6+
},
57
};
68
use async_trait::async_trait;
79
use serde::{Deserialize, Serialize};
@@ -69,9 +71,7 @@ impl FromDocument for SshConnect {
6971
Some(v) => match v.as_u64() {
7072
Some(0) => None, // 0 means "not set"
7173
Some(p) if p <= 65535 => Some(p as u16),
72-
Some(p) => {
73-
return Err(format!("Invalid SSH port: {} (must be 1-65535)", p).into())
74-
}
74+
Some(p) => return Err(format!("Invalid SSH port: {} (must be 1-65535)", p).into()),
7575
None => return Err("Invalid SSH port: expected a number".into()),
7676
},
7777
None => None,
@@ -102,14 +102,18 @@ impl SshConnect {
102102
if key_value.is_empty() {
103103
None
104104
} else {
105-
Some(SshIdentityKeyConfig::Paste { content: key_value.to_string() })
105+
Some(SshIdentityKeyConfig::Paste {
106+
content: key_value.to_string(),
107+
})
106108
}
107109
}
108110
"path" => {
109111
if key_value.is_empty() {
110112
None
111113
} else {
112-
Some(SshIdentityKeyConfig::Path { path: key_value.to_string() })
114+
Some(SshIdentityKeyConfig::Path {
115+
path: key_value.to_string(),
116+
})
113117
}
114118
}
115119
_ => None,
@@ -241,11 +245,7 @@ impl BlockBehavior for SshConnect {
241245
let identity_key = if let Some(provider) = block_local_value_provider {
242246
match provider.get_block_local_value(self.id, "identityKey").await {
243247
Ok(Some(value)) => {
244-
tracing::debug!(
245-
"Block {} read identityKey from KV: {}",
246-
self.id,
247-
value
248-
);
248+
tracing::debug!("Block {} read identityKey from KV: {}", self.id, value);
249249
Self::parse_identity_key_from_local(&value)
250250
}
251251
Ok(None) => {
@@ -642,7 +642,8 @@ mod tests {
642642
assert!(result.is_none());
643643

644644
// Unknown mode
645-
let result = SshConnect::parse_identity_key_from_local(r#"{"mode": "unknown", "value": "test"}"#);
645+
let result =
646+
SshConnect::parse_identity_key_from_local(r#"{"mode": "unknown", "value": "test"}"#);
646647
assert!(result.is_none());
647648
}
648649

crates/atuin-desktop-runtime/src/ssh/pool.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ impl Pool {
3939
auth: Option<Authentication>,
4040
cancellation_rx: Option<oneshot::Receiver<()>>,
4141
) -> Result<Arc<Session>> {
42-
self.connect_with_config(host, username, auth, cancellation_rx, None).await
42+
self.connect_with_config(host, username, auth, cancellation_rx, None)
43+
.await
4344
}
4445

4546
/// Connect to a host with optional block configuration overrides
@@ -78,8 +79,7 @@ impl Pool {
7879
}
7980
}
8081

81-
let identity_key_config = ssh_config_override
82-
.and_then(|cfg| cfg.identity_key.as_ref());
82+
let identity_key_config = ssh_config_override.and_then(|cfg| cfg.identity_key.as_ref());
8383
tracing::debug!(
8484
"Pool connect_with_config: ssh_config_override={:?}, identity_key_config={:?}",
8585
ssh_config_override,
@@ -88,7 +88,9 @@ impl Pool {
8888

8989
let async_session = async {
9090
let mut session = Session::open_with_config(host, ssh_config_override).await?;
91-
session.authenticate_with_config(auth, Some(&username), identity_key_config).await?;
91+
session
92+
.authenticate_with_config(auth, Some(&username), identity_key_config)
93+
.await?;
9294
Ok::<_, eyre::Report>(session)
9395
};
9496

crates/atuin-desktop-runtime/src/ssh/session.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,10 @@ impl Session {
485485

486486
/// Open a new SSH session with optional configuration overrides from block settings.
487487
/// Block settings take precedence over SSH config file.
488-
pub async fn open_with_config(host: &str, config_override: Option<&DocumentSshConfig>) -> Result<Self> {
488+
pub async fn open_with_config(
489+
host: &str,
490+
config_override: Option<&DocumentSshConfig>,
491+
) -> Result<Self> {
489492
let mut ssh_config = Self::resolve_ssh_config(host);
490493

491494
// Apply block-level overrides if provided
@@ -833,11 +836,16 @@ impl Session {
833836

834837
// Step 0: Try block-provided identity key FIRST (overrides everything)
835838
// If an explicit key is configured and fails, we do NOT fall back to agent/defaults
836-
tracing::debug!("authenticate_with_config called with identity_key_config: {:?}", identity_key_config);
839+
tracing::debug!(
840+
"authenticate_with_config called with identity_key_config: {:?}",
841+
identity_key_config
842+
);
837843
if let Some(key_config) = identity_key_config {
838844
match key_config {
839845
SshIdentityKeyConfig::None => {
840-
tracing::debug!("Block identity key config is SshIdentityKeyConfig::None, using defaults");
846+
tracing::debug!(
847+
"Block identity key config is SshIdentityKeyConfig::None, using defaults"
848+
);
841849
}
842850
SshIdentityKeyConfig::Paste { content } => {
843851
tracing::info!("Step 0: Trying block-provided pasted key");
@@ -907,7 +915,9 @@ impl Session {
907915
remaining_methods,
908916
partial_success
909917
);
910-
Err(eyre::eyre!("Pasted key authentication failed: server rejected key"))
918+
Err(eyre::eyre!(
919+
"Pasted key authentication failed: server rejected key"
920+
))
911921
}
912922
}
913923
}

crates/atuin-desktop-runtime/src/ssh/ssh_pool.rs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ impl SshPoolHandle {
201201

202202
/// Disconnect all connections to a given host, regardless of username.
203203
pub async fn disconnect_by_host(&self, host: &str) -> Result<()> {
204-
let connections = self.list_connections().await.map_err(|_| eyre::eyre!("Failed to list connections"))?;
204+
let connections = self
205+
.list_connections()
206+
.await
207+
.map_err(|_| eyre::eyre!("Failed to list connections"))?;
205208

206209
for key in connections {
207210
// Connection keys are "username@host" - split and match host exactly
@@ -246,7 +249,17 @@ impl SshPoolHandle {
246249
output_stream: mpsc::Sender<OutputLine>,
247250
result_tx: oneshot::Sender<()>,
248251
) -> Result<()> {
249-
self.exec_with_config(host, username, interpreter, command, channel, output_stream, result_tx, None).await
252+
self.exec_with_config(
253+
host,
254+
username,
255+
interpreter,
256+
command,
257+
channel,
258+
output_stream,
259+
result_tx,
260+
None,
261+
)
262+
.await
250263
}
251264

252265
#[allow(clippy::too_many_arguments)]
@@ -307,7 +320,8 @@ impl SshPoolHandle {
307320
width: u16,
308321
height: u16,
309322
) -> Result<(mpsc::Sender<Bytes>, mpsc::Sender<(u16, u16)>)> {
310-
self.open_pty_with_config(host, username, channel, output_stream, width, height, None).await
323+
self.open_pty_with_config(host, username, channel, output_stream, width, height, None)
324+
.await
311325
}
312326

313327
#[allow(clippy::too_many_arguments)]
@@ -703,7 +717,13 @@ impl SshPool {
703717
.pool
704718
.write()
705719
.await
706-
.connect_with_config(&host, Some(username.as_str()), None, None, ssh_config.as_ref())
720+
.connect_with_config(
721+
&host,
722+
Some(username.as_str()),
723+
None,
724+
None,
725+
ssh_config.as_ref(),
726+
)
707727
.await;
708728

709729
let session = match session {

0 commit comments

Comments
 (0)