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
//! Approximation ledger.
//!
//! A small classification scheme for the deliberate departures from "exact
//! arithmetic on the stated statistical model" that show up across the solver
//! and family code. The point is to make hand-wavy markers like "bandaid",
//! "hack", or "magic" carry a meaningful contract instead of just a vibe:
//! every such marker in the source must sit next to an [`ApproxKind`]
//! annotation that names which kind of approximation it actually is, so a
//! reader (or a downstream caller, or `build.rs`) can tell at a glance
//! whether the deviation is a bounded numerical detail, a controlled
//! statistical estimator, a surrogate objective, or a temporary damping that
//! goes away as the solver converges.
//!
//! The taxonomy is deliberately closed (five variants) so that adding a new
//! category is a deliberate act, not a drift. The annotation does not change
//! runtime behavior — it exists as a `const` marker that callers and tests
//! can read, and as a syntactic anchor that `build.rs` matches against.
//!
//! ## Marker convention
//!
//! Hand-wavy words ("bandaid", "hack", "magic", "FIXME") are allowed in
//! source comments only when the same comment block (within `LEDGER_WINDOW`
//! lines) also references one of the variants below by its bare identifier:
//! `Exact`, `NumericalApproximation`, `StatisticalApproximation`,
//! `SurrogateObjective`, `TemporarySolverDamping`. The build script
//! enforces this; see `build.rs` for the scanner.
/// One classification entry. Five variants, each with a short payload that
/// names the bound or contract that justifies the approximation.
/// Window (in lines) inside which a hand-wavy marker comment must reference
/// an `ApproxKind` variant to be considered annotated. Kept generous so
/// long comment blocks above a marker still satisfy the scanner.
pub const LEDGER_WINDOW: usize = 8;
/// Compile-time site annotation. Carries no runtime state; its presence as
/// a `const` in the source serves as both documentation and as a syntactic
/// anchor that mirrors the comment-level annotation.