tier: per-path probe diagnostics — surface read errors / parse status in TierInfo.searched

This commit is contained in:
megaproxy 2026-05-09 01:19:52 +01:00
parent c5c38d1ce5
commit 18e55cd139
2 changed files with 80 additions and 38 deletions

View file

@ -5,7 +5,7 @@ use std::path::PathBuf;
use crate::paths::{list_wsl_distros, resolve_roots, ResolvedRoots};
use crate::settings::{save as save_settings, Caps, Settings};
use crate::state::SharedState;
use crate::tier::{detect_in as detect_tier_in, PlanTier};
use crate::tier::{detect_in_with_diagnostics, PlanTier};
use crate::usage::{build_snapshot, UsageSnapshot};
use crate::watch::refresh_and_emit;
@ -111,12 +111,8 @@ pub async fn detect_plan_tier(
candidates.sort();
candidates.dedup();
let tier = detect_tier_in(&candidates);
let (tier, diagnostics) = detect_in_with_diagnostics(&candidates);
let label = tier.label();
let recommended_caps = tier.caps();
Ok(TierInfo { tier, label, recommended_caps, searched: paths_to_strings(&candidates) })
}
fn paths_to_strings(paths: &[PathBuf]) -> Vec<String> {
paths.iter().map(|p| p.display().to_string()).collect()
Ok(TierInfo { tier, label, recommended_caps, searched: diagnostics })
}