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    /// Wall-clock time of config loading, in milliseconds.
7    pub config_ms: f64,
8    /// Wall-clock time of file discovery, in milliseconds.
9    pub discover_ms: f64,
10    /// Wall-clock time of the parse stage, in milliseconds.
11    pub parse_ms: f64,
12    /// Summed wall-clock time of the actual AST parses across all rayon
13    /// workers (the parse stage's CPU cost). `parse_ms` is the stage's
14    /// wall-clock time. Observational and non-deterministic; do not assert
15    /// against it. `0.0` when `shared_parse` is true (parse was reused).
16    pub parse_cpu_ms: f64,
17    /// Wall-clock time of complexity scoring, in milliseconds.
18    pub complexity_ms: f64,
19    /// Wall-clock time of per-file maintainability scoring, in milliseconds.
20    pub file_scores_ms: f64,
21    /// Wall-clock time of git churn collection, in milliseconds.
22    pub git_churn_ms: f64,
23    /// True when churn data came from the on-disk churn cache.
24    pub git_churn_cache_hit: bool,
25    /// Wall-clock time of hotspot ranking, in milliseconds.
26    pub hotspots_ms: f64,
27    /// Wall-clock time of duplication analysis, in milliseconds.
28    pub duplication_ms: f64,
29    /// Wall-clock time of refactoring-target ranking, in milliseconds.
30    pub targets_ms: f64,
31    /// Wall-clock time of the whole health pipeline, in milliseconds.
32    pub total_ms: f64,
33    /// True when discover + parse were reused from the upstream dead-code
34    /// (check) pass in combined mode, so their timings are `0.0` here and
35    /// the cost is attributed to the `Pipeline Performance` table instead.
36    /// The renderer shows those two stages as `(measured above)`.
37    pub shared_parse: bool,
38}
39
40/// Framework-specific health detector coverage surfaced for agent consumers.
41#[derive(Debug, Clone, serde::Serialize)]
42#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
43pub struct FrameworkHealthDiagnostics {
44    /// Detected framework IDs, sorted and deduplicated.
45    pub detected_frameworks: Vec<String>,
46    /// Detector coverage for the detected frameworks.
47    pub detectors: Vec<FrameworkHealthDetector>,
48}
49
50/// Status for one framework-specific health detector.
51#[derive(Debug, Clone, serde::Serialize)]
52#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
53pub struct FrameworkHealthDetector {
54    /// Rule or detector ID, matching fallow's stable rule names where possible.
55    pub id: String,
56    /// Framework ID that made this detector relevant.
57    pub framework: String,
58    /// Whether the detector ran, was disabled, abstained, or could not be checked.
59    pub status: FrameworkHealthDetectorStatus,
60    /// Stable reason code for non-active statuses.
61    #[serde(default, skip_serializing_if = "Option::is_none")]
62    pub reason: Option<String>,
63}
64
65/// Detector status codes for framework health observability.
66#[derive(Debug, Clone, Copy, serde::Serialize)]
67#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
68#[serde(rename_all = "snake_case")]
69pub enum FrameworkHealthDetectorStatus {
70    /// Detector ran on this analysis.
71    Active,
72    /// Detector was turned off by configuration.
73    DisabledByConfig,
74    /// Detector ran but declined to report for this project.
75    Abstained,
76    /// Detector applicability could not be evaluated.
77    #[allow(dead_code, reason = "reserved for analysis paths that skip a detector")]
78    NotChecked,
79}