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
//! The kernel ratio guard (REL8-1969): every traversal kernel must beat
//! the stood-down general engine by [`MIN_RATIO`] or more on its own
//! engaging shape, or it is dead weight the repo still maintains and
//! reviews. Each case runs its statement twice — the default routing
//! (the kernel) and the stood-down lane ([`walk_only`]'s twin graph, the
//! `RELATE_PATTERN_ENGINE=walk` switch's in-process spelling: the chain,
//! hub-star and frontier kernels all stand down, the per-row walker
//! serves) — and asserts three things:
//!
//! 1. **Engagement**: the kernel took the clause on the default lane
//! (exactly one engagement — the case's shape is the kernel's own)
//! and nothing on the stood-down lane. Without this pin a routing
//! regression turns the case into a vacuous A/A comparison.
//! 2. **Parity**: both lanes answer the same rows (a correctness
//! cross-check for free).
//! 3. **Ratio**: the stood-down lane's median ([`percentile`] at 0.50)
//! is at least [`MIN_RATIO`] times the default lane's median, over
//! interleaved timed rounds so both lanes share whatever drift the
//! host adds mid-test. The ratio cancels CI-host variance inside the
//! pair; an absolute bound cannot (the house style's generous
//! absolute bounds guard *stalls*, not crossovers).
//!
//! When general-engine work (a faster walker, a better rung) closes a
//! gap, this guard fails loudly and the decision becomes retire-or-widen
//! instead of a silent crossover. Every new traversal kernel joins this
//! suite in the PR it lands in. The floor is raised, never lowered,
//! without numbers.
//!
//! **Measured at landing** (this box, `cargo test`'s optimized test
//! profile): chain count fold 51x, hub-star 24-28x, frontier count
//! ~2500x — every case clears the floor with margin. Two shapes were
//! measured and deliberately **excluded**, with their numbers on the
//! ticket: the chain kernel's two-hop *rows* shape pays only 1.34-1.50x
//! (at the crossover — a retire-or-widen finding, not a guardable case;
//! a case asserting 1.5x there would flake on host noise), and the batch
//! scan-filter chain pays 0.92-1.0x standalone (it is the substrate the
//! traversal kernels ride, not a standalone winner over the per-row scan
//! — its correctness differential stays in `exec/batch_tests.rs`).
use ;
use percentile;
use crate;
use crateGraph;
use take_kernel_engagements;
/// The ratio floor: a kernel paying less than 1.5x over the stood-down
/// lane on its own engaging shape is not paying for its maintenance.
/// Raise with numbers, never lower.
const MIN_RATIO: f64 = 1.5;
/// One lane of a guard case: its graph and its timed samples. The two
/// lanes live in one table — lane 0 the default routing, lane 1 its
/// stood-down twin — so every step below runs per lane and no future
/// change can land on one lane and be missed on the other.
/// One guard case: the engagement and parity pins, then the interleaved
/// A/B medians. One warmup pass pages both fixtures in before `rounds`
/// timed pairs, each pair running lane 0 first so the pair's two
/// measurements share one moment of host state.
/// The chain kernel's count fold (ADR-0473, LABS-1293): a starred exact
/// hop count over a width-60 fan is 216,000 trails the fold tallies
/// columnar while the walker emits one row each.
/// The hub-star kernel (ADR-0473): a shared-terminal star whose per-hub
/// combination is one reused buffer against the walker's per-row walks.
/// The frontier family's count contraction (ADR-0478): a nine-level
/// layered graph is 349,525 walks the stood-down walker emits one row
/// each and the contraction never enumerates — the widest gap the guard
/// carries, so three rounds suffice.