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) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-04-16 18:16:06 -04:00
parent 329fe4cd4b
commit 6e670e8b54
No known key found for this signature in database
3 changed files with 38 additions and 32 deletions

View file

@ -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<()> {

View file

@ -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"));

View file

@ -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,