Skip to content

Commit 42aeffe

Browse files
committed
Merge remote-tracking branch 'origin/main' into merge-origin-main-20260420b
# Conflicts: # lib/crates/fabro-cli/src/commands/doctor.rs # lib/crates/fabro-cli/src/commands/model.rs # lib/crates/fabro-cli/src/commands/provider/login.rs # lib/crates/fabro-cli/src/commands/repo/init.rs # lib/crates/fabro-cli/src/commands/secret/list.rs # lib/crates/fabro-cli/src/commands/secret/rm.rs # lib/crates/fabro-cli/src/commands/secret/set.rs # lib/crates/fabro-cli/src/commands/system/df.rs # lib/crates/fabro-cli/src/commands/system/events.rs # lib/crates/fabro-cli/src/commands/system/info.rs # lib/crates/fabro-cli/src/commands/system/prune.rs # lib/crates/fabro-cli/src/commands/version.rs # lib/crates/fabro-cli/src/server_client.rs # lib/crates/fabro-server/src/csp.rs
2 parents 41135dd + 21c5b7c commit 42aeffe

30 files changed

Lines changed: 312 additions & 320 deletions

File tree

lib/crates/fabro-api/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
mod generated {
1414
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
1515
}
16-
pub use generated::{Client, types};
16+
pub use generated::{Client as ApiClient, types};

lib/crates/fabro-cli/src/command_context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use fabro_util::printer::Printer;
99
use tokio::sync::OnceCell;
1010

1111
use crate::args::{ServerConnectionArgs, ServerTargetArgs};
12-
use crate::server_client::ServerStoreClient;
12+
use crate::server_client::Client;
1313
use crate::{server_client, user_config};
1414

1515
#[derive(Clone, Debug)]
@@ -35,7 +35,7 @@ pub(crate) struct CommandContext {
3535
machine_settings: SettingsLayer,
3636
cli_settings: CliSettings,
3737
server_mode: ServerMode,
38-
server: OnceCell<Arc<ServerStoreClient>>,
38+
server: OnceCell<Arc<Client>>,
3939
}
4040

4141
impl CommandContext {
@@ -135,7 +135,7 @@ impl CommandContext {
135135
&self.cli_settings
136136
}
137137

138-
pub(crate) async fn server(&self) -> Result<Arc<ServerStoreClient>> {
138+
pub(crate) async fn server(&self) -> Result<Arc<Client>> {
139139
let server_mode = self.server_mode.clone();
140140
let base_config_path = self.base_config_path.clone();
141141
let machine_settings = self.machine_settings.clone();

lib/crates/fabro-cli/src/commands/artifact/cp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use fabro_types::settings::cli::{CliLayer, OutputFormat};
1111
use fabro_util::printer::Printer;
1212

1313
use crate::args::ArtifactCpArgs;
14-
use crate::server_client::ServerStoreClient;
14+
use crate::server_client::Client;
1515
use crate::shared::{print_json_pretty, split_run_path};
1616

1717
pub(super) async fn cp_command(
@@ -140,7 +140,7 @@ pub(super) async fn cp_command(
140140
}
141141

142142
async fn write_artifact_file(
143-
client: &ServerStoreClient,
143+
client: &Client,
144144
run_id: &fabro_types::RunId,
145145
entry: &super::ArtifactEntry,
146146
dest_file: &Path,

lib/crates/fabro-cli/src/commands/artifact/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use fabro_util::printer::Printer;
99

1010
use crate::args::{ArtifactCommand, ArtifactNamespace, ServerTargetArgs};
1111
use crate::command_context::CommandContext;
12-
use crate::server_client::ServerStoreClient;
12+
use crate::server_client::Client;
1313

1414
#[derive(Clone, Debug, serde::Serialize)]
1515
pub(super) struct ArtifactEntry {
@@ -29,7 +29,7 @@ pub(super) async fn resolve_artifacts(
2929
cli: &CliSettings,
3030
cli_layer: &CliLayer,
3131
printer: Printer,
32-
) -> Result<(RunId, ServerStoreClient, Vec<ArtifactEntry>)> {
32+
) -> Result<(RunId, Client, Vec<ArtifactEntry>)> {
3333
let ctx = CommandContext::for_target(server, printer, cli.clone(), cli_layer)?;
3434
let client = ctx.server().await?;
3535
let run_id = client.resolve_run(run_selector).await?.run_id;

lib/crates/fabro-cli/src/commands/auth/login.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub(super) async fn login_command(
132132
#[cfg(unix)]
133133
async fn fetch_cli_auth_config(target: &ServerTarget) -> Result<types::CliAuthConfig> {
134134
let (http_client, base_url) = user_config::build_public_http_client(target)?;
135-
let client = fabro_api::Client::new_with_client(&base_url, http_client);
135+
let client = fabro_api::ApiClient::new_with_client(&base_url, http_client);
136136
client
137137
.get_cli_auth_config()
138138
.send()

lib/crates/fabro-cli/src/commands/doctor.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,7 @@ pub(crate) async fn run_doctor(
312312
}
313313
};
314314

315-
if let Err(err) = server
316-
.send_api(|client| async move { client.get_health().send().await })
317-
.await
318-
{
315+
if let Err(err) = server.get_health().await {
319316
report.sections.push(CheckSection {
320317
title: "Server".to_string(),
321318
checks: vec![CheckResult {
@@ -352,12 +349,8 @@ pub(crate) async fn run_doctor(
352349
}],
353350
});
354351

355-
match server
356-
.send_api(|client| async move { client.run_diagnostics().send().await })
357-
.await
358-
{
359-
Ok(response) => {
360-
let diagnostics = response.into_inner();
352+
match server.run_diagnostics().await {
353+
Ok(diagnostics) => {
361354
report.sections[0]
362355
.checks
363356
.push(check_version_parity(&diagnostics.version));

lib/crates/fabro-cli/src/commands/install.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,19 +1094,17 @@ async fn setup_github_app(
10941094
}
10951095

10961096
async fn persist_vault_secrets_via_server(
1097-
client: &fabro_api::Client,
1097+
client: &server_client::Client,
10981098
secrets: &[CreateSecretRequest],
10991099
) -> Result<()> {
11001100
for secret in secrets {
11011101
client
1102-
.create_secret()
1103-
.body(CreateSecretRequest {
1102+
.create_secret(CreateSecretRequest {
11041103
name: secret.name.clone(),
11051104
value: secret.value.clone(),
11061105
type_: secret.type_,
11071106
description: secret.description.clone(),
11081107
})
1109-
.send()
11101108
.await?;
11111109
}
11121110

@@ -1117,14 +1115,14 @@ async fn persist_vault_secrets_with(
11171115
storage_dir: &Path,
11181116
secrets: &[CreateSecretRequest],
11191117
server_was_running: bool,
1120-
connect_api_client: impl for<'a> Fn(&'a Path) -> BoxFuture<'a, Result<fabro_api::Client>>,
1118+
connect_server: impl for<'a> Fn(&'a Path) -> BoxFuture<'a, Result<server_client::Client>>,
11211119
stop_server: impl for<'a> Fn(&'a Path, Duration) -> BoxFuture<'a, bool>,
11221120
) -> Result<()> {
11231121
if secrets.is_empty() {
11241122
return Ok(());
11251123
}
11261124

1127-
let client = match connect_api_client(storage_dir).await {
1125+
let client = match connect_server(storage_dir).await {
11281126
Ok(client) => client,
11291127
Err(err) => {
11301128
if !server_was_running {
@@ -1173,7 +1171,7 @@ async fn persist_install_outputs(
11731171
vault_secrets,
11741172
settings_write,
11751173
server_was_running,
1176-
|path| Box::pin(server_client::connect_api_client(path)),
1174+
|path| Box::pin(server_client::connect_server(path)),
11771175
|path, timeout| {
11781176
Box::pin(async move { stop::stop_server(path, timeout).await.unwrap_or(false) })
11791177
},
@@ -1303,7 +1301,7 @@ async fn persist_install_outputs_with_settings(
13031301
vault_secrets: &[CreateSecretRequest],
13041302
settings_write: Option<PendingSettingsWrite<'_>>,
13051303
server_was_running: bool,
1306-
connect_api_client: impl for<'a> Fn(&'a Path) -> BoxFuture<'a, Result<fabro_api::Client>>,
1304+
connect_server: impl for<'a> Fn(&'a Path) -> BoxFuture<'a, Result<server_client::Client>>,
13071305
stop_server: impl for<'a> Fn(&'a Path, Duration) -> BoxFuture<'a, bool>,
13081306
) -> Result<()> {
13091307
persist_server_env_secrets(storage_dir, server_env_secrets)?;
@@ -1317,7 +1315,7 @@ async fn persist_install_outputs_with_settings(
13171315
storage_dir,
13181316
vault_secrets,
13191317
server_was_running,
1320-
connect_api_client,
1318+
connect_server,
13211319
stop_server,
13221320
)
13231321
.await;
@@ -2486,10 +2484,7 @@ client_id = "client-id"
24862484
&vault_secrets,
24872485
false,
24882486
|_| {
2489-
let client = fabro_api::Client::new_with_client(
2490-
&server.base_url(),
2491-
fabro_test::test_http_client(),
2492-
);
2487+
let client = server_client::Client::new_no_proxy(&server.base_url()).unwrap();
24932488
Box::pin(async move { Ok(client) })
24942489
},
24952490
{
@@ -2548,10 +2543,7 @@ client_id = "client-id"
25482543
&vault_secrets,
25492544
true,
25502545
|_| {
2551-
let client = fabro_api::Client::new_with_client(
2552-
&server.base_url(),
2553-
fabro_test::test_http_client(),
2554-
);
2546+
let client = server_client::Client::new_no_proxy(&server.base_url()).unwrap();
25552547
Box::pin(async move { Ok(client) })
25562548
},
25572549
{

0 commit comments

Comments
 (0)