Skip to main content

fallow_output/
health_diagnostics.rs

1/// Detailed timing breakdown for the health pipeline.
2///
3/// Only populated when `--performance` is passed.
4#[derive(Debug, Clone, serde::Serialize)]
5pub struct HealthTimings {
6    pub config_ms: f64,
7    pub discover_ms: f64,
8    pub parse_ms: f64,
9    /// Summed wall-clock time of the actual AST parses across all rayon
10    /// workers (the parse stage's CPU cost). `parse_ms` is the stage's
11    /// wall-clock time. Observational and non-deterministic; do not assert
12    /// against it. `0.0` when `shared_parse` is true (parse was reused).
13    pub parse_cpu_ms: f64,
14    pub complexity_ms: f64,
15    pub file_scores_ms: f64,
16    pub git_churn_ms: f64,
17    pub git_churn_cache_hit: bool,
18    pub hotspots_ms: f64,
19    pub duplication_ms: f64,
20    pub targets_ms: f64,
21    pub total_ms: f64,
22    /// True when discover + parse were reused from the upstream dead-code
23    /// (check) pass in combined mode, so their timings are `0.0` here and
24    /// the cost is attributed to the `Pipeline Performance` table instead.
25    /// The renderer shows those two stages as `(measured above)`.
26    pub shared_parse: bool,
27}
28
29/// Framework-specific health detector coverage surfaced for agent consumers.
30#[derive(Debug, Clone, serde::Serialize)]
31#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
32pub struct FrameworkHealthDiagnostics {
33    /// Detected framework IDs, sorted and deduplicated.
34    pub detected_frameworks: Vec<String>,
35    /// Detector coverage for the detected frameworks.
36    pub detectors: Vec<FrameworkHealthDetector>,
37}
38
39/// Status for one framework-specific health detector.
40#[derive(Debug, Clone, serde::Serialize)]
41#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
42pub struct FrameworkHealthDetector {
43    /// Rule or detector ID, matching fallow's stable rule names where possible.
44    pub id: String,
45    /// Framework ID that made this detector relevant.
46    pub framework: String,
47    /// Whether the detector ran, was disabled, abstained, or could not be checked.
48    pub status: FrameworkHealthDetectorStatus,
49    /// Stable reason code for non-active statuses.
50    #[serde(default, skip_serializing_if = "Option::is_none")]
51    pub reason: Option<String>,
52}
53
54/// Detector status codes for framework health observability.
55#[derive(Debug, Clone, Copy, serde::Serialize)]
56#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
57#[serde(rename_all = "snake_case")]
58pub enum FrameworkHealthDetectorStatus {
59    Active,
60    DisabledByConfig,
61    Abstained,
62    #[allow(dead_code, reason = "reserved for analysis paths that skip a detector")]
63    NotChecked,
64}