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
//! The `SystemCheck` trait (AP2.1-7).
//!
//! A system check is a Django-inspired self-diagnostic: a typed,
//! statically-registered unit that inspects one narrow aspect of the
//! application's configuration or runtime state and reports a stable ID, a
//! severity, a human-readable context, and a fix hint. The framework
//! aggregates contributed checks into a
//! [`SystemCheckReport`](crate::system_check::report::SystemCheckReport)
//! consumed by `arc doctor --checks` and, later, the MCP `system_checks`
//! tool (AP2.1-9).
//!
//! # Ownership
//!
//! The trait lives in `arcature` so that **the application** (which depends
//! on `arcature`) and **the framework itself** can contribute checks
//! without depending on the CLI. Subsystem crates (`arcature-db`,
//! `arcature-cache`, …) CANNOT depend on `arcature` (the dependency
//! direction is facade → subsystem, never the reverse — AGENTS.md §16), so
//! a subsystem contributes its checks through the application's bootstrap:
//! the app collects `&'static [SystemCheck]` slices from `arcature` and
//! from each subsystem it uses, then builds one report. This wave ships the
//! trait, the registry, the report shape, and a small set of framework
//! checks; the application-side aggregation and the app-binary subcommand
//! that the CLI shells out to are future work (AP2.1-10 production
//! lifecycle seam).
//!
//! # No business behavior by discovery (AP2.1 §6)
//!
//! A system check INSPECTS and REPORTS. It never invents a route,
//! authorization decision, transaction, or DB mutation (§7). A check that
//! finds a problem reports it; the operator decides what to do. A check
//! MUST NOT mutate state as a side effect of running.
//!
//! # No panic on hostile input (AGENTS.md §17)
//!
//! A check must be total. A check that reads configuration, an
//! environment-supplied path, or a manifest value must not panic on
//! malformed, missing, or oversized input; it reports a warning/error
//! result instead.
use crateCheckCategory;
use crateCheckId;
use crateCheckSeverity;
/// A single self-diagnostic check.
///
/// Implementations are `&'static`-registered (see `registry`): each
/// contributor exposes a `pub const CHECKS: &[&dyn SystemCheck] = &[...]`
/// (or a `&'static [SystemCheck]` slice of concrete check structs), and the
/// aggregator merges the slices into one report.
///
/// A check carries:
/// - a stable [`CheckId`] (e.g. `ARC0001`) — greppable, never renamed;
/// - a [`CheckSeverity`] (Error / Warning / Info);
/// - a [`CheckCategory`] (the area the check inspects);
/// - a short description of what it inspects;
/// - a [`SystemCheck::run`] that returns a [`CheckResult`](super::report::CheckResult).
///
/// The trait object is safe because every implementor must be `Send + Sync
/// 'static` — checks are read from `&'static` slices and may run on any
/// thread.