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
//! Canonical lint-rationale catalog.
//!
//! `clippy::float_cmp` is denied workspace-wide by the numerics-half
//! policy in the root `Cargo.toml` (`workspace.lints`); the per-site
//! `#[allow(clippy::float_cmp, reason = "...")]` attribute is the
//! documented bypass, and the audit-log requirement in `CLAUDE.md`
//! §"Lints & invariants" mandates a `reason = "..."` justification at
//! every such bypass. This module catalogs the recurring justifications
//! so that the canonical phrasings live in one audit-able place rather
//! than being re-invented per site.
//!
//! Three recurring sub-themes have a single canonical phrasing repeated
//! verbatim across many files; this catalog pins each:
//!
//! - [`clippy_float_cmp::TYPED_RAW_PARITY`] — typed-vs-raw boundary parity
//! tests, where the invariant is "the typed sibling returns the
//! bit-identical `DVec3`/`f64`/`DQuat` that the raw kernel produces".
//! - [`clippy_float_cmp::TIER3_LITERAL_ANALYTIC`] — Tier 3 trajectory
//! cross-validation tests, where literal-built initial conditions and
//! analytic closed-form spot checks must recover bit-exactly.
//! - [`clippy_float_cmp::BEVY_PARITY_STATE_FIELDS`] /
//! [`clippy_float_cmp::BEVY_PARITY_TIME_FIELDS`] — `bevy_parity_*`
//! wrappers, where the lockstep invariant is bit-identity between the
//! `astrodyn_runner` driver and the `astrodyn_bevy` adapter.
//!
//! Two further sub-themes recur as a *pattern* rather than a verbatim
//! string — each call site customizes the noun being tested while the
//! lint-and-pattern stays uniform. These are documented here so a future
//! contributor knows when their bespoke phrasing is on-pattern:
//!
//! - **`BITEXACT_RECOVERY` pattern** — integrator / closed-form
//! round-trip tests where the invariant is "no rounding occurred
//! between the literal input and the recovered output" (e.g. `RK4`
//! `t=0` recovery, `ω·dt` analytic literals, mass / `μ` literal
//! accessor round-trips, default-construction zero checks). The
//! phrasing template is `"<subject> tests assert bit-exact recovery
//! of <literal-or-analytic-source>"`.
//! - **`BITEXACT_SENTINEL` pattern** — bit-exact sentinels used as
//! state-change detectors or as caller fast-path triggers, where a
//! `< eps` window would introduce a discontinuity at the chosen
//! tolerance. The phrasing template is `"bit-exact sentinel <for
//! which fast-path / detector>"`.
//!
//! ## Why call sites still spell the string literally
//!
//! Rust's `reason = "..."` attribute requires a **string-literal** RHS at
//! parse time. A `const` path (`reason = TYPED_RAW_PARITY`) or a macro
//! invocation (`reason = my_macro!()`) is rejected by the compiler:
//!
//! ```text
//! error: expected unsuffixed literal, found `TYPED_RAW_PARITY`
//! --> src/foo.rs:N:M
//! |
//! N | #[allow(clippy::float_cmp, reason = TYPED_RAW_PARITY)]
//! | ^^^^^^^^^^^^^^^^^
//! ```
//!
//! So each `#[allow]` site still spells its rationale verbatim as a string
//! literal. This module is the **canonical reference** for the recurring
//! phrasings: when you add a new bit-exact `#[allow]` whose rationale
//! matches one of the catalog sub-themes, copy the exact string from one
//! of the constants below rather than coining a new one.
//!
//! ## What the coverage test does — and doesn't — catch
//!
//! The `astrodyn_quantities` test `tests/lint_reasons_catalog.rs` walks
//! the workspace, iterates over [`clippy_float_cmp::ALL`], and asserts
//! every cataloged string still appears in at least two `#[allow(...)]`
//! `reason = "..."` attribute literals (the minimum-cluster threshold
//! that justifies centralization).
//!
//! It catches:
//!
//! - A catalog string dropping below `MIN_OCCURRENCES = 2` — e.g. a
//! rename or typo applied at *most* sites that shrinks the verbatim
//! cluster to one or zero remaining matches.
//! - A catalog entry with zero matching attribute literals — a stale
//! constant that no longer corresponds to any real bypass site.
//!
//! It does **not** catch:
//!
//! - Partial drift in a large cluster: if a sub-theme is used at six
//! call sites and a refactor rewords three of them, the remaining
//! three still satisfy `≥ MIN_OCCURRENCES` and the test stays green.
//! The catalog string is then technically still accurate for those
//! three sites, but the other three have silently diverged.
//! - A call site that mistakenly uses a *paraphrased* version of the
//! canonical phrasing — the test scans for the exact catalog string,
//! so a near-miss at a fresh site is invisible to it.
//!
//! Treat the test as a stale-catalog detector and a low-bar typo trip,
//! not as a uniform-wording enforcer. The uniform-wording invariant is
//! enforced by review: when you copy a string from the catalog, copy it
//! verbatim, and when you edit a catalog string, grep the workspace for
//! the old wording and update every match.
//!
//! ## Adding a new entry
//!
//! 1. Verify the new phrasing actually recurs verbatim across multiple
//! files. Single-site rationales stay bespoke and out of the catalog —
//! centralizing them adds indirection without saving anything.
//! 2. The constant name should describe the *invariant being tested*, not
//! the lint being suppressed (which is always `clippy::float_cmp` in
//! this submodule).
//! 3. Add the const here **and** add a `("NAME", NAME)` row to
//! [`clippy_float_cmp::ALL`] so the coverage test in
//! `tests/lint_reasons_catalog.rs` picks it up automatically. A const
//! that is missing from `ALL` will not be checked — see `ALL`'s doc
//! comment for the contract.
/// Canonical rationales for `#[allow(clippy::float_cmp, ...)]` sites.
///
/// Each `pub const` is the exact string used at one of the recurring
/// bypass sites in the physics crates. The string is what appears in the
/// `reason = "..."` attribute at the call site, not a paraphrase.