fallow-engine 3.28.0

Typed analysis engine facade for fallow consumers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
//! Health threshold override resolution and reporting state.

use std::path::{Path, PathBuf};

use fallow_output::ThresholdOverrideDimension;
use rustc_hash::FxHashSet;

#[derive(Debug, Clone, Copy)]
pub(super) struct GlobalHealthThresholds {
    pub(super) cyclomatic: u16,
    pub(super) cognitive: u16,
    pub(super) crap: f64,
    pub(super) unit_size: u32,
}

#[derive(Debug, Clone, Copy)]
pub(super) struct AppliedHealthThresholds {
    pub(super) effective: fallow_output::HealthEffectiveThresholds,
    pub(super) override_index: Option<usize>,
}

pub(super) struct CompiledThresholdOverride {
    index: usize,
    matchers: globset::GlobSet,
    functions: Vec<String>,
    configured: fallow_output::HealthConfiguredThresholds,
    reason: Option<String>,
}

pub(super) struct ThresholdOverrideMatch<'a> {
    entry: &'a CompiledThresholdOverride,
}

pub(super) struct ThresholdOverrideResolver {
    entries: Vec<CompiledThresholdOverride>,
    pub(super) global: GlobalHealthThresholds,
}

impl ThresholdOverrideResolver {
    #[must_use]
    pub(super) fn new(
        overrides: &[fallow_config::HealthThresholdOverride],
        global: GlobalHealthThresholds,
    ) -> Self {
        let entries = overrides
            .iter()
            .enumerate()
            .map(|(index, override_entry)| {
                let mut builder = globset::GlobSetBuilder::new();
                for pattern in &override_entry.files {
                    if let Ok(glob) = globset::Glob::new(pattern) {
                        builder.add(glob);
                    }
                }
                CompiledThresholdOverride {
                    index,
                    matchers: builder
                        .build()
                        .unwrap_or_else(|_| globset::GlobSet::empty()),
                    functions: override_entry.functions.clone(),
                    configured: fallow_output::HealthConfiguredThresholds {
                        max_cyclomatic: override_entry.max_cyclomatic,
                        max_cognitive: override_entry.max_cognitive,
                        max_crap: override_entry.max_crap,
                        max_unit_size: override_entry.max_unit_size,
                    },
                    reason: override_entry.reason.clone(),
                }
            })
            .collect();
        Self { entries, global }
    }

    #[must_use]
    pub(super) fn resolve(
        &self,
        relative: &Path,
        function: &str,
    ) -> (AppliedHealthThresholds, Vec<ThresholdOverrideMatch<'_>>) {
        let mut effective = fallow_output::HealthEffectiveThresholds {
            max_cyclomatic: self.global.cyclomatic,
            max_cognitive: self.global.cognitive,
            max_crap: self.global.crap,
            max_unit_size: self.global.unit_size,
        };
        let mut override_index = None;
        let mut matches = Vec::new();

        for entry in &self.entries {
            if !entry.matchers.is_match(relative) {
                continue;
            }
            if !entry.functions.is_empty() && !entry.functions.iter().any(|f| f == function) {
                continue;
            }
            if let Some(max_cyclomatic) = entry.configured.max_cyclomatic {
                effective.max_cyclomatic = max_cyclomatic;
                override_index = Some(entry.index);
            }
            if let Some(max_cognitive) = entry.configured.max_cognitive {
                effective.max_cognitive = max_cognitive;
                override_index = Some(entry.index);
            }
            if let Some(max_crap) = entry.configured.max_crap {
                effective.max_crap = max_crap;
                override_index = Some(entry.index);
            }
            // The unit-size dimension gates the large-function list, not the
            // complexity findings, so it fills in the effective value without
            // flipping `override_index` (which controls whether a *complexity*
            // finding attaches an effective-thresholds block).
            if let Some(max_unit_size) = entry.configured.max_unit_size {
                effective.max_unit_size = max_unit_size;
            }
            matches.push(ThresholdOverrideMatch { entry });
        }

        (
            AppliedHealthThresholds {
                effective,
                override_index,
            },
            matches,
        )
    }

    /// Resolve the effective unit-size (large-function line-count) ceiling for a
    /// single function, applying the last matching override on top of the global
    /// `health.maxUnitSize` default. Cheaper than [`resolve`](Self::resolve): it
    /// allocates nothing, so it is safe to call in the large-function hot loop.
    #[must_use]
    pub(super) fn effective_max_unit_size(&self, relative: &Path, function: &str) -> u32 {
        let mut effective = self.global.unit_size;
        for entry in &self.entries {
            if !entry.matchers.is_match(relative) {
                continue;
            }
            if !entry.functions.is_empty() && !entry.functions.iter().any(|f| f == function) {
                continue;
            }
            if let Some(max_unit_size) = entry.configured.max_unit_size {
                effective = max_unit_size;
            }
        }
        effective
    }

    /// Resolve the effective CRAP ceiling for a single function, applying the
    /// last matching override on top of the global `maxCrap` / `--max-crap`
    /// value. Cheaper than [`resolve`](Self::resolve): it allocates nothing, so
    /// it is safe to call in the per-file scoring hot loop.
    #[must_use]
    pub(super) fn effective_max_crap(&self, relative: &Path, function: &str) -> f64 {
        let mut effective = self.global.crap;
        for entry in &self.entries {
            if !entry.matchers.is_match(relative) {
                continue;
            }
            if !entry.functions.is_empty() && !entry.functions.iter().any(|f| f == function) {
                continue;
            }
            if let Some(max_crap) = entry.configured.max_crap {
                effective = max_crap;
            }
        }
        effective
    }

    fn entries(&self) -> &[CompiledThresholdOverride] {
        &self.entries
    }

    /// True when no `thresholdOverrides` entries are configured. Lets callers
    /// on cold paths (suppressed functions) skip `resolve` entirely, so the
    /// common no-override run does zero extra work per suppressed unit.
    #[must_use]
    pub(super) fn is_empty(&self) -> bool {
        self.entries.is_empty()
    }
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
struct ThresholdOverrideStateKey {
    status: &'static str,
    override_index: usize,
    path: Option<PathBuf>,
    function: Option<String>,
    line: Option<u32>,
    col: Option<u32>,
    dimension: ThresholdOverrideDimension,
}

#[derive(Debug, Clone, Copy)]
pub(super) struct MeasuredThresholdMetrics {
    pub(super) cyclomatic: u16,
    pub(super) cognitive: u16,
    pub(super) crap: f64,
}

#[derive(Default)]
pub(super) struct ThresholdOverrideStateTracker {
    matched_indexes: FxHashSet<usize>,
    seen: FxHashSet<ThresholdOverrideStateKey>,
    states: Vec<fallow_output::ThresholdOverrideState>,
}

/// Dimensions a configured entry participates in, in serialization order.
///
/// `complexity` covers the structural ceilings (cyclomatic, cognitive, unit
/// size) and `crap` covers CRAP alone, matching the enum's own contract. Used
/// only by the `no_match` path, where there is no measured function to derive a
/// dimension from. `HealthConfig::validate` rejects an entry that configures no
/// ceiling at all, so this never yields an empty list for a real entry.
fn configured_dimensions(
    configured: fallow_output::HealthConfiguredThresholds,
) -> Vec<ThresholdOverrideDimension> {
    let mut dimensions = Vec::new();
    if configured.max_cyclomatic.is_some()
        || configured.max_cognitive.is_some()
        || configured.max_unit_size.is_some()
    {
        dimensions.push(ThresholdOverrideDimension::Complexity);
    }
    if configured.max_crap.is_some() {
        dimensions.push(ThresholdOverrideDimension::Crap);
    }
    dimensions
}

impl ThresholdOverrideStateTracker {
    /// `effective` is the ceiling set resolved across every matching entry, not
    /// the entry's own configured value. A later entry can supersede an earlier
    /// one, and the finding is emitted against the resolved value, so measuring
    /// the row against anything else lets `insufficient` claim a finding that
    /// never fires (issue #2163).
    pub(super) fn record_complexity(
        &mut self,
        function: ComplexityFunctionContext<'_>,
        matches: &[ThresholdOverrideMatch<'_>],
        global: GlobalHealthThresholds,
        effective: fallow_output::HealthEffectiveThresholds,
    ) {
        let ComplexityFunctionContext {
            path,
            function,
            line,
            col,
            cyclomatic,
            cognitive,
            line_count,
            suppressed,
        } = function;
        for matched in matches {
            let configured = matched.entry.configured;
            // `maxUnitSize` belongs to the complexity dimension, per
            // `configured_dimensions` and the `ThresholdOverrideDimension`
            // contract. Leaving it out made a unit-size-only entry emit no row
            // at all when it matched, while the same entry pointed at a typo
            // glob still emitted `no_match`: silent when in force, loud when
            // inert (issue #2163).
            let touches_unit_size = configured.max_unit_size.is_some();
            let has_complexity_threshold = configured.max_cyclomatic.is_some()
                || configured.max_cognitive.is_some()
                || touches_unit_size;
            if !has_complexity_threshold {
                continue;
            }
            // Marked only once this recorder is committed to emitting a row.
            // Marking on entry made an index count as matched while no recorder
            // produced anything for it, which excluded it from
            // `record_no_match_entries` too: a `maxCrap`-only entry scoped to
            // `<component>` went silent on both paths (issue #2163).
            self.matched_indexes.insert(matched.entry.index);
            // Both sides run the SAME dimension predicate, once against the
            // global ceilings and once against the resolved ones, so `active`,
            // `stale` and `insufficient` all describe the complexity dimension
            // as a whole and agree with the `outstanding` list. Scoring each
            // ceiling in isolation let one row claim the dimension was satisfied
            // while `outstanding` said it still fires (issue #2163): an entry
            // raising only `maxCyclomatic` on a unit that breaches cognitive
            // read `active`, and a `maxUnitSize`-only entry on a unit breaching
            // cyclomatic read `stale`.
            //
            // Unit size is the one narrowed term. It emits no complexity
            // finding, so folding an unrelated long function into the predicate
            // would flip a cyclomatic-only override to `insufficient` with
            // nothing outstanding to point at.
            //
            // Suppression neutralizes only the finding-driven terms: an inline
            // `fallow-ignore` comment hides the complexity finding, so a raised
            // cyclomatic/cognitive ceiling buys nothing there and the row reads
            // `stale`, mirroring `record_crap`. The unit-size term keeps real
            // scoring because suppression covers the finding only, never the
            // large-function list, so a raised `maxUnitSize` still has effect
            // on a suppressed unit (issue #2163 follow-up).
            let breaches = |max_cyclomatic: u16, max_cognitive: u16, max_unit_size: u32| {
                (!suppressed && (cyclomatic > max_cyclomatic || cognitive > max_cognitive))
                    || (touches_unit_size && line_count.is_some_and(|lc| lc > max_unit_size))
            };
            let global_exceeded = breaches(global.cyclomatic, global.cognitive, global.unit_size);
            let local_exceeded = breaches(
                effective.max_cyclomatic,
                effective.max_cognitive,
                effective.max_unit_size,
            );
            let status = if global_exceeded && !local_exceeded {
                fallow_output::ThresholdOverrideStatus::Active
            } else if !global_exceeded {
                fallow_output::ThresholdOverrideStatus::Stale
            } else {
                fallow_output::ThresholdOverrideStatus::Insufficient
            };
            // A surviving unit-size breach has to be seeded here, because
            // `annotate_outstanding_dimensions` derives `outstanding` from the
            // findings list and unit size emits no finding. Without it a
            // unit-size-only entry that raised the ceiling without clearing it
            // read `insufficient` with an empty `outstanding`, the one
            // contradiction a CI gate cannot detect (issue #2163).
            let outstanding =
                if touches_unit_size && line_count.is_some_and(|lc| lc > effective.max_unit_size) {
                    vec![ThresholdOverrideDimension::Complexity]
                } else {
                    Vec::new()
                };
            self.push_state(ThresholdOverrideStateInput {
                status,
                override_index: matched.entry.index,
                outstanding,
                path: Some(path.to_path_buf()),
                function: Some(function.to_string()),
                line: Some(line),
                col: Some(col),
                configured_thresholds: configured,
                effective_thresholds: effective,
                metrics: Some(fallow_output::ThresholdOverrideMetrics {
                    cyclomatic,
                    cognitive,
                    crap: None,
                    line_count,
                }),
                reason: matched.entry.reason.clone(),
                dimension: ThresholdOverrideDimension::Complexity,
            });
        }
    }

    /// `effective` is the resolved CRAP ceiling across every matching entry, for
    /// the same reason as [`record_complexity`](Self::record_complexity): the
    /// finding is emitted against the resolved value, so the row has to be
    /// scored against it too (issue #2163).
    pub(super) fn record_crap(
        &mut self,
        function: CrapFunctionContext<'_>,
        metrics: MeasuredThresholdMetrics,
        matches: &[ThresholdOverrideMatch<'_>],
        global: GlobalHealthThresholds,
        effective: fallow_output::HealthEffectiveThresholds,
    ) {
        let CrapFunctionContext {
            path,
            function,
            line,
            col,
            suppressed,
        } = function;
        for matched in matches {
            if matched.entry.configured.max_crap.is_none() {
                continue;
            }
            self.matched_indexes.insert(matched.entry.index);
            let status = if suppressed || metrics.crap < global.crap {
                fallow_output::ThresholdOverrideStatus::Stale
            } else if metrics.crap < effective.max_crap {
                fallow_output::ThresholdOverrideStatus::Active
            } else {
                fallow_output::ThresholdOverrideStatus::Insufficient
            };
            self.push_state(ThresholdOverrideStateInput {
                status,
                override_index: matched.entry.index,
                outstanding: Vec::new(),
                path: Some(path.to_path_buf()),
                function: Some(function.to_string()),
                line: Some(line),
                col: Some(col),
                configured_thresholds: matched.entry.configured,
                effective_thresholds: effective,
                metrics: Some(fallow_output::ThresholdOverrideMetrics {
                    cyclomatic: metrics.cyclomatic,
                    cognitive: metrics.cognitive,
                    crap: Some(metrics.crap),
                    // The CRAP dimension never scores unit size, so an absent
                    // field keeps the row honest next to a CRAP-breach claim.
                    line_count: None,
                }),
                reason: matched.entry.reason.clone(),
                dimension: ThresholdOverrideDimension::Crap,
            });
        }
    }

    /// Record a matched CRAP-dimension row for a synthetic template-family
    /// unit. Template units are not scored on the CRAP dimension, so the
    /// per-function CRAP loop never reaches them and `record_crap` never
    /// runs; without this entry point a `maxCrap`-only override scoped to
    /// `<template>` (the exact config shape v3.15.0 recommended) regressed
    /// to a first-sorted `no_match` row (issue #2235).
    ///
    /// The row always reads `stale` with an empty `outstanding` list and
    /// `metrics.crap` absent: absent, not `0.0`, because `0.0` would assert
    /// a measurement that was never taken. The renderers pair this shape
    /// with copy saying the unit is not scored on CRAP and the entry can be
    /// removed.
    pub(super) fn record_crap_not_applicable(
        &mut self,
        function: CrapFunctionContext<'_>,
        measured: (u16, u16),
        matches: &[ThresholdOverrideMatch<'_>],
        effective: fallow_output::HealthEffectiveThresholds,
    ) {
        let CrapFunctionContext {
            path,
            function,
            line,
            col,
            suppressed: _,
        } = function;
        let (cyclomatic, cognitive) = measured;
        for matched in matches {
            if matched.entry.configured.max_crap.is_none() {
                continue;
            }
            self.matched_indexes.insert(matched.entry.index);
            self.push_state(ThresholdOverrideStateInput {
                status: fallow_output::ThresholdOverrideStatus::Stale,
                override_index: matched.entry.index,
                outstanding: Vec::new(),
                path: Some(path.to_path_buf()),
                function: Some(function.to_string()),
                line: Some(line),
                col: Some(col),
                configured_thresholds: matched.entry.configured,
                effective_thresholds: effective,
                metrics: Some(fallow_output::ThresholdOverrideMetrics {
                    cyclomatic,
                    cognitive,
                    crap: None,
                    line_count: None,
                }),
                reason: matched.entry.reason.clone(),
                dimension: ThresholdOverrideDimension::Crap,
            });
        }
    }

    pub(super) fn record_no_match_entries(
        &mut self,
        resolver: &ThresholdOverrideResolver,
        should_emit: bool,
    ) {
        if !should_emit {
            return;
        }
        for entry in resolver.entries() {
            if self.matched_indexes.contains(&entry.index) {
                continue;
            }
            let effective = fallow_output::HealthEffectiveThresholds {
                max_cyclomatic: entry
                    .configured
                    .max_cyclomatic
                    .unwrap_or(resolver.global.cyclomatic),
                max_cognitive: entry
                    .configured
                    .max_cognitive
                    .unwrap_or(resolver.global.cognitive),
                max_crap: entry.configured.max_crap.unwrap_or(resolver.global.crap),
                max_unit_size: entry
                    .configured
                    .max_unit_size
                    .unwrap_or(resolver.global.unit_size),
            };
            for dimension in configured_dimensions(entry.configured) {
                self.push_state(ThresholdOverrideStateInput {
                    status: fallow_output::ThresholdOverrideStatus::NoMatch,
                    override_index: entry.index,
                    outstanding: Vec::new(),
                    path: None,
                    function: None,
                    line: None,
                    col: None,
                    configured_thresholds: entry.configured,
                    effective_thresholds: effective,
                    metrics: None,
                    reason: entry.reason.clone(),
                    dimension,
                });
            }
        }
    }

    /// Mutable access to the accumulated rows so the findings pipeline can
    /// annotate `outstanding` once every finding has been collected and merged.
    /// The tracker itself records during collection, before the CRAP merge, so
    /// it cannot know which dimension ultimately kept a finding alive.
    pub(super) fn states_mut(&mut self) -> &mut [fallow_output::ThresholdOverrideState] {
        &mut self.states
    }

    pub(super) fn into_states(mut self) -> Vec<fallow_output::ThresholdOverrideState> {
        self.states.sort_by(|a, b| {
            a.override_index
                .cmp(&b.override_index)
                .then(a.path.cmp(&b.path))
                .then(a.function.cmp(&b.function))
                .then(a.line.cmp(&b.line))
                .then(a.col.cmp(&b.col))
                .then(a.dimension.cmp(&b.dimension))
        });
        self.states
    }

    fn push_state(&mut self, input: ThresholdOverrideStateInput) {
        let status_key = match input.status {
            fallow_output::ThresholdOverrideStatus::Active => "active",
            fallow_output::ThresholdOverrideStatus::Stale => "stale",
            fallow_output::ThresholdOverrideStatus::Insufficient => "insufficient",
            fallow_output::ThresholdOverrideStatus::NoMatch => "no_match",
        };
        let key = ThresholdOverrideStateKey {
            status: status_key,
            override_index: input.override_index,
            path: input.path.clone(),
            function: input.function.clone(),
            line: input.line,
            col: input.col,
            dimension: input.dimension,
        };
        if !self.seen.insert(key) {
            return;
        }
        self.states.push(fallow_output::ThresholdOverrideState {
            status: input.status,
            override_index: input.override_index,
            dimension: input.dimension,
            outstanding: input.outstanding,
            path: input.path,
            function: input.function,
            line: input.line,
            col: input.col,
            configured_thresholds: input.configured_thresholds,
            effective_thresholds: input.effective_thresholds,
            metrics: input.metrics,
            reason: input.reason,
        });
    }
}

/// One function's identity (path, name and position) and measured complexity
/// metrics, bundled so `record_complexity` takes the function descriptor as a
/// single parameter instead of seven.
///
/// `line_count` is here because `maxUnitSize` is part of the complexity
/// dimension: without it a unit-size-only entry has nothing to score its row
/// against. `None` means the caller has no unit-size-scorable span: the
/// `<component>` rollup is never measured against `maxUnitSize`, so a `Some`
/// there would let a row read `insufficient` over a breach no other part of
/// the report can show.
///
/// `suppressed` mirrors [`CrapFunctionContext`]: an inline `fallow-ignore`
/// comment hides the complexity finding, so the row must read `stale` instead
/// of falling through to `no_match` (issue #2163 follow-up).
#[derive(Clone, Copy)]
pub(super) struct ComplexityFunctionContext<'a> {
    pub(super) path: &'a Path,
    pub(super) function: &'a str,
    pub(super) line: u32,
    pub(super) col: u32,
    pub(super) cyclomatic: u16,
    pub(super) cognitive: u16,
    pub(super) line_count: Option<u32>,
    pub(super) suppressed: bool,
}

/// One function's identity and suppression state for the CRAP recorder.
///
/// Position matters: several units in one file can share a name, and the row
/// must stay distinct per unit. `suppressed` reports whether a
/// `fallow-ignore-*` comment already hides the CRAP finding; a suppressed unit
/// emits no finding, so the raised ceiling buys nothing and the row reads
/// `stale`. Without it the row claimed `insufficient` while `outstanding`
/// stayed empty, the one contradiction a CI gate cannot detect (issue #2163).
#[derive(Clone, Copy)]
pub(super) struct CrapFunctionContext<'a> {
    pub(super) path: &'a Path,
    pub(super) function: &'a str,
    pub(super) line: u32,
    pub(super) col: u32,
    pub(super) suppressed: bool,
}

struct ThresholdOverrideStateInput {
    status: fallow_output::ThresholdOverrideStatus,
    override_index: usize,
    /// Dimensions the recorder already knows still breach. Only the unit-size
    /// term lands here; everything else is filled in later from the findings
    /// list by `annotate_outstanding_dimensions`.
    outstanding: Vec<ThresholdOverrideDimension>,
    path: Option<PathBuf>,
    function: Option<String>,
    line: Option<u32>,
    col: Option<u32>,
    configured_thresholds: fallow_output::HealthConfiguredThresholds,
    effective_thresholds: fallow_output::HealthEffectiveThresholds,
    metrics: Option<fallow_output::ThresholdOverrideMetrics>,
    reason: Option<String>,
    dimension: ThresholdOverrideDimension,
}