batpak 0.9.0

Event sourcing with causal graphs and caller-defined gates. Sync API, no async runtime.
Documentation
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
use super::IndexEntry;
use crate::store::hidden_ranges::CancelledVisibilityRanges;
use parking_lot::{Condvar, Mutex, RwLock};
use std::collections::BTreeMap;
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::Arc;
use std::time::Duration;

pub(super) type CancelledRange = (u64, u64);
pub(super) type CancelledRanges = Vec<CancelledRange>;
pub(super) type LaneCancelledRanges = BTreeMap<u32, CancelledRanges>;

#[derive(Clone, Debug)]
struct PublishedVisibility {
    visible: u64,
    lane_visible: BTreeMap<u32, u64>,
}

/// Gated publish boundary for reader visibility.
///
/// `allocated` advances when sequences are reserved (writer-only).
/// `visible` is the exclusive upper bound readers filter against:
/// an entry is visible iff `entry.global_sequence < visible`.
///
/// Invariant: `visible <= allocated`, and `visible` advances monotonically.
/// Enforced at runtime in [`SequenceGate::publish`], which returns
/// [`StoreError::SequenceGateViolation`](crate::store::StoreError) when an
/// `up_to` would exceed `allocated` or regress below the current `visible` —
/// a fail-closed `Result`, not a `debug_assert` (a regression must be a hard
/// error in release, not a debug-only check).
pub(crate) struct SequenceGate {
    /// Next sequence to be assigned. Only the writer thread advances this.
    allocated: AtomicU64,
    /// Coherent global + per-lane reader visibility bounds.
    published: RwLock<Arc<PublishedVisibility>>,
    /// Currently active visibility fence token, or 0 when no fence is active.
    active_fence: AtomicU64,
    /// Lowest sequence staged into the active fence, or `u64::MAX` if the
    /// fence has not yet staged any entries.
    active_fence_start: AtomicU64,
    /// Exclusive upper bound of the highest sequence staged into the active fence.
    active_fence_end: AtomicU64,
    /// Monotonic token allocator for visibility fences.
    next_fence_token: AtomicU64,
    /// Permanently hidden fence ranges cancelled in the current runtime.
    /// Stored as an immutable `Arc` snapshot so that readers pay only a
    /// refcount bump instead of cloning the whole vec on every query.
    cancelled_ranges: RwLock<Arc<CancelledRanges>>,
    /// Per-lane permanently hidden fence ranges over the global sequence axis.
    lane_cancelled_ranges: RwLock<Arc<LaneCancelledRanges>>,
    /// Monotonic counter bumped on every successful visibility advance. A reader
    /// snapshots it BEFORE querying, then parks only if it is unchanged — closing
    /// the lost-wakeup window between "query found nothing" and "park" without
    /// nesting the index lock under the wakeup mutex.
    visibility_epoch: AtomicU64,
    /// Edge-trigger for readers blocked waiting for new visible entries. The mutex
    /// guards nothing but the condvar handshake: a publisher bumps `visibility_epoch`
    /// then `notify_all` under this mutex, so it cannot notify until a check-then-park
    /// reader has actually parked (the standard condvar discipline). Replaces a
    /// 1 ms poll-sleep spin in the cursor pull path.
    visibility_wakeup: (Mutex<()>, Condvar),
}

#[derive(Clone, Debug)]
pub(crate) struct VisibilitySnapshot {
    published: Arc<PublishedVisibility>,
    cancelled_ranges: Arc<CancelledRanges>,
    lane_cancelled_ranges: Arc<LaneCancelledRanges>,
}

impl VisibilitySnapshot {
    pub(crate) fn is_visible(&self, sequence: u64) -> bool {
        if sequence >= self.published.visible {
            return false;
        }
        !range_contains(&self.cancelled_ranges, sequence)
    }

    pub(crate) fn is_visible_on_lane(&self, sequence: u64, lane: u32) -> bool {
        let visible = self.published.lane_visible.get(&lane).copied().unwrap_or(0);
        if sequence >= visible {
            return false;
        }
        if range_contains(&self.cancelled_ranges, sequence) {
            return false;
        }
        !self
            .lane_cancelled_ranges
            .get(&lane)
            .is_some_and(|ranges| range_contains(ranges, sequence))
    }

    pub(crate) fn visible_upper_bound(&self) -> u64 {
        self.published.visible
    }
}

fn range_contains(ranges: &[(u64, u64)], sequence: u64) -> bool {
    ranges
        .iter()
        .any(|(start, end)| sequence >= *start && sequence < *end)
}

pub(super) fn extend_visible_entries<'a, I>(
    out: &mut Vec<IndexEntry>,
    entries: I,
    visibility: &VisibilitySnapshot,
) where
    I: IntoIterator<Item = &'a Arc<IndexEntry>>,
{
    for entry in entries {
        if visibility.is_visible(entry.global_sequence) {
            out.push(entry.as_ref().clone());
        }
    }
}

impl SequenceGate {
    fn insert_cancelled_range(ranges: &mut Vec<(u64, u64)>, start: u64, end: u64) {
        if start >= end {
            return;
        }
        ranges.push((start, end));
        ranges.sort_by_key(|(range_start, _)| *range_start);

        let mut merged: Vec<(u64, u64)> = Vec::with_capacity(ranges.len());
        for (range_start, range_end) in ranges.drain(..) {
            if let Some((_, merged_end)) = merged.last_mut() {
                if range_start <= *merged_end {
                    *merged_end = (*merged_end).max(range_end);
                    continue;
                }
            }
            merged.push((range_start, range_end));
        }
        *ranges = merged;
    }

    pub(crate) fn new() -> Self {
        Self {
            allocated: AtomicU64::new(0),
            published: RwLock::new(Arc::new(PublishedVisibility {
                visible: 0,
                lane_visible: BTreeMap::new(),
            })),
            active_fence: AtomicU64::new(0),
            active_fence_start: AtomicU64::new(u64::MAX),
            active_fence_end: AtomicU64::new(0),
            next_fence_token: AtomicU64::new(1),
            cancelled_ranges: RwLock::new(Arc::new(Vec::new())),
            lane_cancelled_ranges: RwLock::new(Arc::new(BTreeMap::new())),
            visibility_epoch: AtomicU64::new(0),
            visibility_wakeup: (Mutex::new(()), Condvar::new()),
        }
    }

    /// The current visibility epoch. A reader snapshots this BEFORE a query and
    /// passes it to [`Self::park_for_visibility_change`] so a publish racing the
    /// query is never missed.
    pub(crate) fn visibility_epoch(&self) -> u64 {
        self.visibility_epoch.load(Ordering::Acquire)
    }

    /// Signal every parked reader that visibility advanced. Bumps the epoch FIRST
    /// (so a reader re-checking the epoch under the wakeup mutex sees the change),
    /// then notifies under the mutex (so the notify cannot precede a concurrent
    /// check-then-park). Called only AFTER the `published` write guard is released,
    /// so the wakeup mutex never nests under the visibility lock.
    fn signal_visibility_change(&self) {
        self.visibility_epoch.fetch_add(1, Ordering::Release);
        let _guard = self.visibility_wakeup.0.lock();
        self.visibility_wakeup.1.notify_all();
    }

    /// Park until visibility advances past the caller's snapshot epoch, or `timeout`
    /// elapses (the deadline safety net — a missed wakeup degrades to the caller's
    /// timeout, never a hang). If a publish already advanced the epoch since the
    /// snapshot, returns immediately without parking (lost-wakeup guard).
    pub(crate) fn park_for_visibility_change(&self, since_epoch: u64, timeout: Duration) {
        let mut guard = self.visibility_wakeup.0.lock();
        if self.visibility_epoch.load(Ordering::Acquire) == since_epoch {
            let _timeout_state = self.visibility_wakeup.1.wait_for(&mut guard, timeout);
        }
    }

    /// Reserve `n` sequences. Returns first in `[first, first + n)`.
    pub(crate) fn reserve(&self, n: u64) -> u64 {
        self.allocated.fetch_add(n, Ordering::AcqRel)
    }

    /// Advance visibility so readers see entries with `global_sequence < up_to`.
    pub(crate) fn publish(
        &self,
        up_to: u64,
        operation: &'static str,
    ) -> Result<(), crate::store::StoreError> {
        {
            let allocated = self.allocated.load(Ordering::Acquire);
            let mut published = self.published.write();
            let current = published.as_ref();
            let visible = current.visible;
            if up_to > allocated || up_to < visible {
                return Err(crate::store::StoreError::SequenceGateViolation {
                    operation,
                    requested: up_to,
                    allocated,
                    visible,
                });
            }
            *published = Arc::new(PublishedVisibility {
                visible: up_to,
                lane_visible: current.lane_visible.clone(),
            });
        }
        // Wake any cursor parked on the visibility edge (after the write guard drops).
        self.signal_visibility_change();
        Ok(())
    }

    pub(crate) fn publish_on_lanes(
        &self,
        global_up_to: u64,
        lanes: impl IntoIterator<Item = (u32, u64)>,
        operation: &'static str,
    ) -> Result<(), crate::store::StoreError> {
        let allocated = self.allocated.load(Ordering::Acquire);
        let lanes: Vec<(u32, u64)> = lanes.into_iter().collect();
        {
            let mut published = self.published.write();
            let current = published.as_ref();
            if global_up_to > allocated || global_up_to < current.visible {
                return Err(crate::store::StoreError::SequenceGateViolation {
                    operation,
                    requested: global_up_to,
                    allocated,
                    visible: current.visible,
                });
            }
            for (lane, up_to) in lanes.iter().copied() {
                if up_to > allocated {
                    return Err(crate::store::StoreError::SequenceGateViolation {
                        operation,
                        requested: up_to,
                        allocated,
                        visible: current.lane_visible.get(&lane).copied().unwrap_or(0),
                    });
                }
                let current_lane = current.lane_visible.get(&lane).copied().unwrap_or(0);
                if up_to < current_lane {
                    return Err(crate::store::StoreError::SequenceGateViolation {
                        operation,
                        requested: up_to,
                        allocated,
                        visible: current_lane,
                    });
                }
            }
            let mut lane_visible = current.lane_visible.clone();
            for (lane, up_to) in lanes {
                lane_visible.insert(lane, up_to);
            }
            *published = Arc::new(PublishedVisibility {
                visible: global_up_to,
                lane_visible,
            });
        }
        // Wake any cursor parked on the visibility edge (after the write guard drops).
        self.signal_visibility_change();
        Ok(())
    }

    /// Current visibility watermark (exclusive upper bound).
    pub(crate) fn visible(&self) -> u64 {
        self.published.read().visible
    }

    pub(crate) fn lane_visible_snapshot(&self) -> BTreeMap<u32, u64> {
        self.published.read().lane_visible.clone()
    }

    pub(crate) fn restore_lane_visible(&self, lanes: BTreeMap<u32, u64>) {
        let mut published = self.published.write();
        let current = published.as_ref();
        *published = Arc::new(PublishedVisibility {
            visible: current.visible,
            lane_visible: lanes,
        });
    }

    /// Current allocator position (next sequence to be assigned).
    pub(crate) fn allocated(&self) -> u64 {
        self.allocated.load(Ordering::Acquire)
    }

    /// Advance allocator by 1. Used by `insert()` for the single-event path.
    pub(crate) fn advance(&self) {
        self.allocated.fetch_add(1, Ordering::Release);
    }

    /// Set the allocator to a specific value during checkpoint restore.
    pub(crate) fn restore_allocator(&self, value: u64) {
        self.allocated.store(value, Ordering::Release);
    }

    /// Reset both counters to 0 (used by `clear()` during rebuild/compaction).
    pub(crate) fn clear(&self) {
        self.allocated.store(0, Ordering::Release);
        *self.published.write() = Arc::new(PublishedVisibility {
            visible: 0,
            lane_visible: BTreeMap::new(),
        });
        self.active_fence.store(0, Ordering::Release);
        self.active_fence_start.store(u64::MAX, Ordering::Release);
        self.active_fence_end.store(0, Ordering::Release);
        self.next_fence_token.store(1, Ordering::Release);
        *self.cancelled_ranges.write() = Arc::new(Vec::new());
        *self.lane_cancelled_ranges.write() = Arc::new(BTreeMap::new());
    }

    pub(crate) fn begin_fence(&self) -> Result<u64, crate::store::StoreError> {
        let token = self.next_fence_token.fetch_add(1, Ordering::AcqRel);
        match self
            .active_fence
            .compare_exchange(0, token, Ordering::AcqRel, Ordering::Acquire)
        {
            Ok(_) => {
                self.active_fence_start.store(u64::MAX, Ordering::Release);
                self.active_fence_end.store(0, Ordering::Release);
                Ok(token)
            }
            Err(_) => Err(crate::store::StoreError::VisibilityFenceActive),
        }
    }

    pub(crate) fn active_fence_token(&self) -> Option<u64> {
        let token = self.active_fence.load(Ordering::Acquire);
        (token != 0).then_some(token)
    }

    pub(crate) fn active_fence_range(&self) -> Option<(u64, u64)> {
        if self.active_fence.load(Ordering::Acquire) == 0 {
            return None;
        }
        let start = self.active_fence_start.load(Ordering::Acquire);
        let end = self.active_fence_end.load(Ordering::Acquire);
        (start != u64::MAX && start < end).then_some((start, end))
    }

    pub(crate) fn note_fence_progress(
        &self,
        token: u64,
        start: u64,
        end: u64,
    ) -> Result<(), crate::store::StoreError> {
        if self.active_fence.load(Ordering::Acquire) != token {
            return Err(crate::store::StoreError::VisibilityFenceNotActive);
        }
        let _start_update =
            self.active_fence_start
                .fetch_update(Ordering::AcqRel, Ordering::Acquire, |current| {
                    Some(current.min(start))
                });
        let _end_update =
            self.active_fence_end
                .fetch_update(Ordering::AcqRel, Ordering::Acquire, |current| {
                    Some(current.max(end))
                });
        Ok(())
    }

    pub(crate) fn finish_fence_on_lanes(
        &self,
        token: u64,
        publish_to: Option<u64>,
        lanes: impl IntoIterator<Item = (u32, u64)>,
    ) -> Result<(), crate::store::StoreError> {
        if self.active_fence.load(Ordering::Acquire) != token {
            return Err(crate::store::StoreError::VisibilityFenceNotActive);
        }
        if let Some(up_to) = publish_to {
            self.publish_on_lanes(up_to, lanes, "finish_visibility_fence")?;
        }
        self.active_fence.store(0, Ordering::Release);
        self.active_fence_start.store(u64::MAX, Ordering::Release);
        self.active_fence_end.store(0, Ordering::Release);
        Ok(())
    }

    pub(crate) fn cancel_fence(
        &self,
        token: u64,
        lane_ranges: LaneCancelledRanges,
    ) -> Result<(), crate::store::StoreError> {
        if self.active_fence.load(Ordering::Acquire) != token {
            return Err(crate::store::StoreError::VisibilityFenceNotActive);
        }
        let start = self.active_fence_start.load(Ordering::Acquire);
        let end = self.active_fence_end.load(Ordering::Acquire);
        if start != u64::MAX && start < end {
            let mut guard = self.cancelled_ranges.write();
            let mut ranges = (**guard).clone();
            Self::insert_cancelled_range(&mut ranges, start, end);
            *guard = Arc::new(ranges);
        }
        if !lane_ranges.is_empty() {
            let mut guard = self.lane_cancelled_ranges.write();
            let mut ranges_by_lane = (**guard).clone();
            for (lane, ranges) in lane_ranges {
                let lane_ranges = ranges_by_lane.entry(lane).or_default();
                for (start, end) in ranges {
                    Self::insert_cancelled_range(lane_ranges, start, end);
                }
            }
            *guard = Arc::new(ranges_by_lane);
        }
        self.active_fence.store(0, Ordering::Release);
        self.active_fence_start.store(u64::MAX, Ordering::Release);
        self.active_fence_end.store(0, Ordering::Release);
        Ok(())
    }

    pub(crate) fn snapshot(&self) -> VisibilitySnapshot {
        VisibilitySnapshot {
            published: Arc::clone(&self.published.read()),
            cancelled_ranges: Arc::clone(&self.cancelled_ranges.read()),
            lane_cancelled_ranges: Arc::clone(&self.lane_cancelled_ranges.read()),
        }
    }

    pub(crate) fn cancelled_ranges_snapshot(&self) -> CancelledVisibilityRanges {
        CancelledVisibilityRanges {
            global: self.cancelled_ranges.read().as_ref().clone(),
            lanes: self.lane_cancelled_ranges.read().as_ref().clone(),
        }
    }

    pub(crate) fn restore_cancelled_ranges(&self, ranges: CancelledVisibilityRanges) {
        let mut built = Vec::new();
        for (start, end) in ranges.global {
            Self::insert_cancelled_range(&mut built, start, end);
        }
        *self.cancelled_ranges.write() = Arc::new(built);

        let mut built_lanes = BTreeMap::new();
        for (lane, ranges) in ranges.lanes {
            let lane_ranges = built_lanes.entry(lane).or_insert_with(Vec::new);
            for (start, end) in ranges {
                Self::insert_cancelled_range(lane_ranges, start, end);
            }
        }
        *self.lane_cancelled_ranges.write() = Arc::new(built_lanes);
    }
}

#[cfg(test)]
mod tests {
    use super::SequenceGate;
    use std::collections::BTreeMap;

    #[test]
    fn publish_on_lanes_preserves_restored_lane_visibility() {
        let gate = SequenceGate::new();
        gate.reserve(16);
        gate.restore_lane_visible(BTreeMap::from([(7, 4)]));

        gate.publish_on_lanes(5, [(1, 3)], "test_publish_on_lanes")
            .expect("PROPERTY: valid publish should advance visibility");

        let lanes = gate.lane_visible_snapshot();
        assert_eq!(
            lanes.get(&7).copied(),
            Some(4),
            "PROPERTY: publishing one lane must not drop lane visibility restored by compaction/bootstrap"
        );
        assert_eq!(
            lanes.get(&1).copied(),
            Some(3),
            "PROPERTY: publishing one lane must install that lane's visibility bound"
        );
    }

    #[test]
    fn restore_lane_visibility_preserves_global_visibility() {
        let gate = SequenceGate::new();
        gate.reserve(16);
        gate.publish(6, "test_publish")
            .expect("PROPERTY: valid publish should advance global visibility");

        gate.restore_lane_visible(BTreeMap::from([(2, 5)]));

        assert_eq!(
            gate.visible(),
            6,
            "PROPERTY: restoring lane visibility must not regress or drop global visibility"
        );
        assert_eq!(
            gate.lane_visible_snapshot().get(&2).copied(),
            Some(5),
            "PROPERTY: restoring lane visibility must install the restored lane bound"
        );
    }

    // The wakeup proof for the cursor's poll-spin replacement: a reader parked on
    // `park_for_visibility_change` is woken by a `publish` BEFORE its (generous)
    // timeout — proving the edge-trigger fires, not the deadline fallback. Mirrors
    // the sanctioned watermark condvar proof (writer.rs::dangerous_notify_all_*).
    #[test]
    fn park_wakes_on_publish_before_timeout() {
        use std::sync::mpsc;
        use std::sync::Arc;
        use std::time::Duration;

        let gate = Arc::new(SequenceGate::new());
        gate.reserve(8);

        let waiter_gate = Arc::clone(&gate);
        let (ready_tx, ready_rx) = mpsc::channel();
        let (woke_tx, woke_rx) = mpsc::channel();
        let waiter = std::thread::Builder::new()
            .name("visibility-park-proof".to_string())
            .spawn(move || {
                // Snapshot the epoch, signal readiness, THEN park. A publish that
                // races between the snapshot and the park is caught by the epoch
                // guard (park returns immediately) — either way the wake is prompt.
                let epoch = waiter_gate.visibility_epoch();
                ready_tx.send(()).expect("signal waiter readiness");
                waiter_gate.park_for_visibility_change(epoch, Duration::from_secs(5));
                woke_tx.send(()).expect("signal waiter woke");
            })
            .expect("spawn park waiter");

        ready_rx
            .recv_timeout(Duration::from_secs(2))
            .expect("waiter snapshotted its epoch and is about to park");
        gate.publish(1, "park-proof")
            .expect("publish advances visibility");

        // If the edge-trigger works, the waiter wakes in ~ms. If it were broken, the
        // waiter would stay parked until its 5s timeout, so a 2s wait distinguishes a
        // real wakeup from the deadline fallback.
        woke_rx
            .recv_timeout(Duration::from_secs(2))
            .expect("PROPERTY: publish must wake a parked reader before its timeout");
        waiter.join().expect("park waiter joins");
    }

    #[test]
    fn publish_on_lanes_accepts_publish_at_allocated_frontier() {
        // The upper guard rejects ONLY a publish strictly past the frontier
        // (global_up_to > allocated). A publish exactly AT the frontier
        // (global_up_to == allocated) is the normal steady-state publish and
        // MUST be accepted, advancing visibility. A `>` -> `>=` mutant refuses
        // this case, so the live store never advances `visible`, never signals
        // the visibility epoch, and frontier waiters block until timeout (the
        // suite would only notice by hanging). This synchronous unit call catches
        // the mutant by assertion in microseconds: no park, no hang.
        let gate = SequenceGate::new();
        gate.reserve(8);
        assert_eq!(
            gate.allocated(),
            8,
            "PRECONDITION: reserve(8) advances the allocator to 8"
        );

        // Publish exactly AT the allocated frontier: global_up_to == allocated == 8.
        let at_frontier = gate.publish_on_lanes(8, [(1, 8)], "test_publish_at_frontier");
        assert!(
            at_frontier.is_ok(),
            "PROPERTY: publishing at the allocated frontier (global_up_to == allocated) \
             must be accepted, not refused as a SequenceGateViolation; got {at_frontier:?}"
        );
        assert_eq!(
            gate.visible(),
            8,
            "PROPERTY: a frontier publish must advance global visibility to the frontier"
        );

        // The upper teeth of the guard still bite: strictly past the frontier is refused.
        let past_frontier = gate.publish_on_lanes(
            9,
            std::iter::empty::<(u32, u64)>(),
            "test_publish_past_frontier",
        );
        assert!(
            past_frontier.is_err(),
            "PROPERTY: publishing past the allocated frontier (global_up_to > allocated) \
             must be refused; got {past_frontier:?}"
        );
    }
}