From 6e670e8b543e69e010540180fa3f83fbeab03f1d Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 16 Apr 2026 18:16:06 -0400 Subject: [PATCH] fix: unblock clippy and nextest on main - serve.rs: annotate debug-only `bun run dev` spawn with #[expect(clippy::disallowed_methods, ...)] and add the missing watch_web field to three ServeArgs test fixtures. - install.rs: replace absolute `fabro_server::serve::DEFAULT_TCP_PORT` path with `serve::DEFAULT_TCP_PORT` (use is already imported) to satisfy clippy::absolute_paths. - pagination test: request an explicit page[limit]=100 for the "fits in one page" case instead of relying on the server default, so the test stays robust as the built-in model catalog grows. Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/crates/fabro-cli/src/commands/install.rs | 2 +- lib/crates/fabro-server/src/serve.rs | 52 +++++++++++-------- .../fabro-server/tests/it/pagination.rs | 16 +++--- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/lib/crates/fabro-cli/src/commands/install.rs b/lib/crates/fabro-cli/src/commands/install.rs index ae35373ca..b4ddb723d 100644 --- a/lib/crates/fabro-cli/src/commands/install.rs +++ b/lib/crates/fabro-cli/src/commands/install.rs @@ -158,7 +158,7 @@ fn ensure_table<'a>(table: &'a mut toml::Table, key: &str) -> Result<&'a mut tom /// Default web URL used by `fabro install` when `--web-url` is omitted. pub(crate) fn default_web_url() -> String { - format!("http://127.0.0.1:{}", fabro_server::serve::DEFAULT_TCP_PORT) + format!("http://127.0.0.1:{}", serve::DEFAULT_TCP_PORT) } fn merge_server_settings(doc: &mut toml::Value, web_url: &str) -> Result<()> { diff --git a/lib/crates/fabro-server/src/serve.rs b/lib/crates/fabro-server/src/serve.rs index 659b09de0..728b22e32 100644 --- a/lib/crates/fabro-server/src/serve.rs +++ b/lib/crates/fabro-server/src/serve.rs @@ -501,6 +501,10 @@ where let mut watch_web_child = if watch_web { let web_dir = std::env::current_dir()?.join("apps/fabro-web"); info!(dir = %web_dir.display(), "Starting bun run dev (--watch-web)"); + #[expect( + clippy::disallowed_methods, + reason = "Debug-only --watch-web spawns a long-lived `bun run dev` child that is kill/wait'd on shutdown; std::process::Command is sufficient and avoids pulling tokio::process into this path." + )] let child = std::process::Command::new("bun") .args(["run", "dev"]) .current_dir(&web_dir) @@ -719,14 +723,16 @@ mod tests { fn apply_runtime_settings_preserves_storage_dir() { let base = SettingsLayer::default(); let args = ServeArgs { - bind: None, - model: None, - provider: None, - sandbox: None, - web: false, - no_web: false, + bind: None, + model: None, + provider: None, + sandbox: None, + web: false, + no_web: false, max_concurrent_runs: None, - config: None, + config: None, + #[cfg(debug_assertions)] + watch_web: false, }; let resolved = apply_runtime_settings(&base, &args, &PathBuf::from("/srv/fabro-storage")); @@ -751,14 +757,16 @@ enabled = false ", ); let args = ServeArgs { - bind: None, - model: None, - provider: None, - sandbox: None, - web: true, - no_web: false, + bind: None, + model: None, + provider: None, + sandbox: None, + web: true, + no_web: false, max_concurrent_runs: None, - config: None, + config: None, + #[cfg(debug_assertions)] + watch_web: false, }; let resolved = apply_runtime_settings(&base, &args, &PathBuf::from("/srv/fabro")); @@ -777,14 +785,16 @@ enabled = false fn apply_runtime_settings_disables_web_from_cli_flag() { let base = SettingsLayer::default(); let args = ServeArgs { - bind: None, - model: None, - provider: None, - sandbox: None, - web: false, - no_web: true, + bind: None, + model: None, + provider: None, + sandbox: None, + web: false, + no_web: true, max_concurrent_runs: None, - config: None, + config: None, + #[cfg(debug_assertions)] + watch_web: false, }; let resolved = apply_runtime_settings(&base, &args, &PathBuf::from("/srv/fabro")); diff --git a/lib/crates/fabro-server/tests/it/pagination.rs b/lib/crates/fabro-server/tests/it/pagination.rs index 723fa063e..847502127 100644 --- a/lib/crates/fabro-server/tests/it/pagination.rs +++ b/lib/crates/fabro-server/tests/it/pagination.rs @@ -79,23 +79,19 @@ async fn paginated_endpoints_return_correct_shape() { let app = build_router(state, AuthMode::Disabled); for ep in ENDPOINTS { - // Default request: paginated shape, has_more = false (fixtures fit in default - // page) - let json = get_json(app.clone(), ep.path).await; + // Large limit: paginated shape, has_more = false (all fixture items fit). + // Using an explicit large limit instead of the server default so the test + // stays robust when datasets (e.g. the built-in model catalog) grow. + let json = get_json(app.clone(), &format!("{}?page[limit]=100", ep.path)).await; assert_paginated_shape(&json, ep.name); assert_eq!( json["meta"]["has_more"], false, - "{}: default request should have has_more=false", + "{}: large limit should have has_more=false", ep.name ); // limit=1: at most 1 item, has_more = true (all fixtures have >1 item) - let uri = if ep.path.contains('?') { - format!("{}&page[limit]=1", ep.path) - } else { - format!("{}?page[limit]=1", ep.path) - }; - let json = get_json(app.clone(), &uri).await; + let json = get_json(app.clone(), &format!("{}?page[limit]=1", ep.path)).await; assert_paginated_shape(&json, &format!("{} limit=1", ep.name)); assert!( json["data"].as_array().unwrap().len() <= 1,