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
// SPDX-License-Identifier: MIT-0
//! The ascending span walks behind [`CalendarCoverage::complete_ranges`] and
//! [`CalendarCoverage::gaps`].
//!
//! One walk answers both: it visits the supported domain in maximal runs of a
//! single verdict, and the two iterators keep the runs they were asked for. The
//! walks are **derived, not duplicated** — a run ends at the next static edge
//! ([`CalendarCoverage::next_boundary_after`]) — so reading the metadata
//! allocates nothing, never sorts, and cannot disagree with the per-date
//! accessor beside it.
//!
//! A declared phase-level gap is part of the same partition rather than a special
//! case beside it. Where every declaration an identity carries is whole-domain or
//! era-bounded, the declaration is itself static across its era: every run lies
//! wholly inside the declaration's era or wholly outside it, and one precedence
//! ([`CalendarCoverage::phase_gap_on`], the first declaration applying to a date)
//! settles each run exactly as the per-date accessor settles its dates.
//!
//! A **date-scoped** declaration — one carrying an
//! [`PhaseGapShape::OrderEntryWindow`](super::PhaseGapShape::OrderEntryWindow)
//! shape — can flip the verdict from date to
//! date, because the served occurrence it is keyed to resolves on a bracket-era
//! Sunday and not on the Tuesday beside it. Inside such a declaration's span the
//! walk therefore merges verdicts **day by day**, which keeps every reported run
//! faithful to [`CalendarCoverage::coverage_on`] one date at a time: #79's
//! quarter-hour came back as the bracket-era Sundays, one record each, with the
//! Tuesdays between them answered, until the charter's 2026-10-04 residual
//! convention retired the declaration. The day-merged region is bounded by the
//! declaration's own era and the identity's audited windows — outside both, the
//! ordinary facts refuse every date uniformly and the static-edge walk resumes —
//! so the walk's cost stays bounded by the identity's own tables.
//!
//! The two iterators are a partition of the supported domain: the runs are
//! disjoint, ascending, and together they tile `[SUPPORT_FLOOR, NaiveDate::MAX]`,
//! and each run's verdict is exactly what the per-date accessor answers on every
//! date inside it.
use ;
use NaiveDate;
/// The most declarations one identity may carry.
///
/// A declaration is a `PhaseGap` on the identity's `phase_gaps` list, and this
/// bounds the list — not the records the walk reports, which a date-scoped
/// declaration expands to one per maximal run (hundreds for the bracket-era
/// Sundays) and which are streamed a run at a time and never stored. The bound
/// is generous headroom rather than a limit anything ships near: the most
/// declarations any shipped identity carries is **2** (`globex_grains`), against
/// a bound of 256, and `tests/coverage_metadata.rs` holds every identity to it.
pub const GAP_RECORD_CAPACITY: usize = 256;
/// One walked run: a maximal span of one verdict, with the declaration the
/// verdict's gap carries when a declaration is the answer for the run.
pub type Run = ;
/// Walks the supported domain once in maximal runs of one verdict.
///
/// Run boundaries are static table edges everywhere except inside the span of a
/// date-scoped declaration, where the run is merged from per-date verdicts; both
/// regimes are bounded by the identity's own tables and allocate nothing.
pub
/// Ascending iterator over the spans an identity answers completely.
///
/// Produced by [`CalendarCoverage::complete_ranges`]. An identity with any
/// unbounded whole-domain declaration reports no span at all; one whose
/// declarations are bounded or date-scoped reports the spans its ordinary facts
/// answer between them.
/// Ascending iterator over the spans an identity cannot answer completely, each
/// with its reason.
///
/// Produced by [`CalendarCoverage::gaps`]. The records are **streamed in
/// ascending date order** by one walk over the supported domain: a record whose
/// reason is a declared phase-level gap carries that declaration
/// ([`CoverageGap::phase_gap`]) over one maximal span the declaration answers
/// for, and every other record is a date-level run with the reason the walk
/// derived. No span is reported twice and none is withheld, so the records and
/// [`CompleteRanges`] tile the supported domain.