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
//! Thread-scoped capture of this crate's own tracing output, shared by every
//! test whose subject is what the operator is TOLD.
//!
//! One copy, deliberately — the same trade `store_faults` makes. A capture layer
//! is a rule about which events a test may see at all and about how a captured
//! event is interrogated, and a rule known in two places with nothing forcing
//! agreement has already drifted: the second copy is where one call site starts
//! matching a level with a trailing space while the other matches it with a
//! delimiter, and a test that should have gone red goes green on a rendering
//! difference.
//!
//! "One copy" is a measured claim about THIS crate, and it was false when it was
//! first written: `durability/recorder.rs` still carried a third capture — a
//! `Vec<u8>` writer behind `fmt().with_max_level(WARN)`, interrogated with
//! `output.contains(..)` over the joined rendering — which is exactly the shape
//! condemned two paragraphs down, and which never installed the floor below.
//! It was migrated to this module rather than documented, because the cure for
//! a rule known in two places is SUBTRACTION and a note is not subtraction.
//! Every `tracing` capture inside `aion` now goes through [`LogCapture`]; if a
//! fourth appears, delete it, do not annotate it.
//!
//! 🔴 A captured event is a LEVEL AND A LIST OF FIELDS, not a joined string, and
//! that is the point rather than a convenience. An earlier revision stored the
//! rendering `LEVEL|field=value|…` and left callers to recover a field by
//! splitting on `|` — which is wrong the moment a value contains one, and a
//! store's error text is exactly the value most likely to. The delimiter now
//! exists only in [`CapturedEvent`]'s `Display`, which no assertion parses.
//!
//! 🔴 THREAD-SCOPED ON PURPOSE. The CAPTURE is installed with
//! [`tracing::subscriber::with_default`] or [`tracing::subscriber::set_default`],
//! never as the global default: unit tests run in parallel on one process, and a
//! capturing global subscriber would let any other test's events land in this
//! test's log — and let this test's assertions be satisfied by an emission it
//! did not cause.
//!
//! Thread scope cuts BOTH ways, and only one direction was written down here
//! until 2026-08-06. Outward: an emission made on a DIFFERENT thread (a spawned
//! task, an executor-owned runtime) is invisible here, so a test whose subject
//! is such an emission must drive the emitting code on its own thread rather
//! than through the production spawn. Inward — the direction that actually bit —
//! ANOTHER THREAD CAN MAKE THIS THREAD'S EMISSIONS INVISIBLE, and that is what
//! [`InterestFloor`] exists to prevent.
//!
//! 🔴 WHY A SILENT GLOBAL SUBSCRIBER IS INSTALLED ANYWAY. `tracing` caches one
//! `Interest` per callsite for the whole PROCESS, while a subscriber installed
//! with `set_default` is scoped to one THREAD. `tracing-core`'s
//! `rebuild_callsite_interest` folds the interest of every registered dispatcher
//! and ends `interest.unwrap_or_else(Interest::never)` — so a callsite that
//! registers while the dispatcher registry is EMPTY caches `never` and the
//! `warn!` macro short-circuits on every thread from then on, this one included.
//! `DefaultCallsite::register` takes its snapshot of the registry before it
//! stores the result, so a sibling test hitting a callsite for the first time
//! can overwrite an `always` this module's own installation had just written.
//! Measured 2026-08-06: `at_the_ceiling_every_failing_attempt_states_itself`
//! captured NOTHING from `lifecycle::completion_retry` in 5 of 5 runs under
//! `cargo test -p aion-rs --lib -- lifecycle::completion`, green alone and green
//! under `--test-threads=1`, with `LevelFilter::current()` reading `TRACE` and a
//! canary at a callsite in the test's own file captured normally.
//!
//! [`InterestFloor`] closes it by SUBTRACTION rather than by a second rule: it
//! is registered for the life of the process, so the registry is never empty and
//! no fold can ever reach the `never` default. It answers
//! [`Interest::sometimes`] for every callsite — which survives the fold in both
//! orders — and `false` from `enabled`, so it decides nothing and captures
//! nothing. Every event is then referred to whatever subscriber the EMITTING
//! thread has, which is exactly the thread scoping above.
//!
//! ⚠️ One window is outside this module's reach: a callsite whose one and only
//! registration began before the floor was installed and stores its result after
//! [`LogCapture::new`] has rebuilt the cache. That is a race inside
//! `tracing-core`, it can happen at most once per callsite per process, and it
//! fails LOUD — a capture that comes back empty asserts, it does not pass.
use ;
use ;
use Interest;
use Layer;
use ;
use Registry;
/// Renders one event's fields, enough to pin what the operator is told and
/// which identity is named.
;
/// One captured event: its level and its fields, unjoined.
///
/// Nothing here is a parsed rendering. A field name cannot contain `=` — tracing
/// field names are identifiers — so [`Self::field`] recovers a value by exact
/// prefix over the field list, and no assertion depends on a separator that a
/// value could itself contain.
pub
/// Collects this thread's events.
;
/// The captured log, readable after the subscriber has been installed and the
/// code under test has run.
pub ;
/// A dispatcher that decides nothing, captures nothing, and exists only so the
/// callsite-interest fold described in this module's header can never run over
/// an empty registry.
///
/// `register_callsite` answers [`Interest::sometimes`] rather than
/// [`Interest::always`] deliberately: `always` would let the macro skip
/// `enabled` and dispatch every event process-wide, while `sometimes` refers
/// each event back to the EMITTING thread's own subscriber — which is the whole
/// point of the thread scoping. `enabled` answers `false`, so on a thread with
/// no capture installed the event is dropped here and reaches nothing.
;
/// Installs [`InterestFloor`] once per process, remembering how it went.
static FLOOR: OnceLock = new;
/// Put the floor under the callsite-interest fold, and rebuild the cache so a
/// callsite already poisoned by an empty fold is healed.
///
/// The result is remembered rather than recomputed: `set_global_default` may be
/// called at most once, so a second attempt would fail for a reason that says
/// nothing about whether the floor is in place. A failure is REPORTED rather
/// than ignored — if some other global default owns the process, this module's
/// central claim does not hold and a caller must not be told it does.