Fix clippy warnings and date-sensitive snapshot tests from --json rollout

Resolve clippy errors (absolute paths in main.rs/preflight.rs, collapsible
if in cli.rs, missing print_stdout allow) and stabilize snapshot tests that
hardcoded a date in dir_name by replacing with a date-prefix filter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-31 09:07:06 -04:00
parent e99ebfa3f2
commit 8875bbf69d
5 changed files with 14 additions and 15 deletions

View file

@ -9,6 +9,7 @@ use fabro_llm::client::Client as LlmClient;
use fabro_model::{Catalog, Provider};
use fabro_sandbox::daytona::{DaytonaConfig, detect_repo_info};
use fabro_sandbox::{DockerSandboxConfig, Sandbox, SandboxProvider, SandboxSpec};
use fabro_util::check_report::CheckReport;
use fabro_util::terminal::Styles;
use fabro_workflow::git::{GitSyncStatus, sync_status};
use fabro_workflow::operations::{ValidateInput, WorkflowInput, validate};
@ -205,7 +206,7 @@ async fn run_preflight(
github_app: Option<fabro_github::GitHubAppCredentials>,
origin_url: Option<&str>,
show_progress: bool,
) -> anyhow::Result<(fabro_util::check_report::CheckReport, bool)> {
) -> anyhow::Result<(CheckReport, bool)> {
use fabro_util::check_report::{
CheckDetail, CheckReport, CheckResult, CheckSection, CheckStatus,
};

View file

@ -201,7 +201,7 @@ async fn main_inner() -> (String, Result<()>) {
}
Commands::Discord => {
if globals.json {
crate::shared::print_json_pretty(&serde_json::json!({
shared::print_json_pretty(&serde_json::json!({
"url": "https://fabro.sh/discord",
}))?;
} else {
@ -210,7 +210,7 @@ async fn main_inner() -> (String, Result<()>) {
}
Commands::Docs => {
if globals.json {
crate::shared::print_json_pretty(&serde_json::json!({
shared::print_json_pretty(&serde_json::json!({
"url": "https://docs.fabro.sh/",
}))?;
} else {

View file

@ -61,6 +61,7 @@ fn ps_all_json_lists_created_and_completed_runs() {
r#""duration_ms":\s*\d+"#.to_string(),
r#""duration_ms": [DURATION_MS]"#.to_string(),
));
filters.push((r"\d{8}-dry-run-".to_string(), "[DATE]-dry-run-".to_string()));
let mut cmd = context.ps();
cmd.args(["-a", "--json"]);
@ -71,7 +72,7 @@ fn ps_all_json_lists_created_and_completed_runs() {
[
{
"run_id": "[ULID]",
"dir_name": "20260330-dry-run-[ULID]",
"dir_name": "[DATE]-dry-run-[ULID]",
"workflow_name": "Simple",
"workflow_slug": "simple",
"status": "submitted",
@ -82,7 +83,7 @@ fn ps_all_json_lists_created_and_completed_runs() {
},
{
"run_id": "[ULID]",
"dir_name": "20260330-dry-run-[ULID]",
"dir_name": "[DATE]-dry-run-[ULID]",
"workflow_name": "Simple",
"workflow_slug": "simple",
"status": "succeeded",
@ -156,6 +157,7 @@ fn ps_filters_by_workflow_and_label() {
r#""duration_ms":\s*\d+"#.to_string(),
r#""duration_ms": [DURATION_MS]"#.to_string(),
));
filters.push((r"\d{8}-dry-run-".to_string(), "[DATE]-dry-run-".to_string()));
let mut cmd = context.ps();
cmd.args([
"-a",
@ -173,7 +175,7 @@ fn ps_filters_by_workflow_and_label() {
[
{
"run_id": "[ULID]",
"dir_name": "20260330-dry-run-[ULID]",
"dir_name": "[DATE]-dry-run-[ULID]",
"workflow_name": "Simple",
"workflow_slug": "simple",
"status": "succeeded",

View file

@ -38,10 +38,7 @@ fn system_prune_dry_run_lists_matching_runs_without_deleting() {
let context = test_context!();
let run = setup_completed_dry_run(&context);
let mut filters = context.filters();
filters.push((
r"\b\d{8}-dry-run-[0-9A-HJKMNP-TV-Z]{26}\b".to_string(),
"[RUN_DIR]".to_string(),
));
filters.push((r"\d{8}-dry-run-".to_string(), "[DATE]-dry-run-".to_string()));
filters.push((
r"\b\d+(\.\d+)?\s(?:[KMGT]?B|B)\b".to_string(),
"[SIZE]".to_string(),
@ -53,7 +50,7 @@ fn system_prune_dry_run_lists_matching_runs_without_deleting() {
success: true
exit_code: 0
----- stdout -----
would delete: 20260330-dry-run-[ULID] (Simple)
would delete: [DATE]-dry-run-[ULID] (Simple)
----- stderr -----
1 run(s) would be deleted ([SIZE] freed). Pass --yes to confirm.

View file

@ -1089,10 +1089,8 @@ async fn test_models_via_server(
s: &Styles,
json_output: bool,
) -> Result<()> {
if deep {
if !json_output {
eprintln!("Warning: --deep is not supported in server mode");
}
if deep && !json_output {
eprintln!("Warning: --deep is not supported in server mode");
}
let models_to_test = if let Some(model_id) = model {
let all = fetch_models_from_server(&server.client, &server.base_url, None).await?;
@ -1182,6 +1180,7 @@ async fn test_models_via_server(
Ok(())
}
#[allow(clippy::print_stdout)]
pub async fn run_models(
command: Option<ModelsCommand>,
server: Option<ServerConnection>,