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
// SPDX-License-Identifier: MIT OR Apache-2.0
//! 2026-09-26: `--hermetic`: serve so that no state produced for one request reaches another, for known-answer tests.
//!
//! Owner: server CLI.
//! Invariants:
//! - Outside `validate.rs`, production code reads the raw `enable_prefix_caching` and
//! `mtp_gate` fields only through the resolvers here; the test
//! `no_production_code_reads_the_raw_fields_behind_hermetic` scans `src/` for other reads.
//!
//! The resolvers close two channels: the radix KV prefix cache and the MTP gate's
//! probes. `serve_flags.rs` also publishes the flag to `metrale_gpu_runtime::set_hermetic`,
//! and under it the SSM snapshot lookup session-gates every entry
//! (`radix_tree/snapshot_session.rs`).
/// 2026-09-26: The serve keys `--hermetic` forces and the values it forces them to,
/// re-exported from `metrale_bench::gate::hermetic`. metrale-bench holds the table
/// because `gate::bench` also reads it, to refuse a BENCH.toml entry that pins
/// `hermetic=true` without these keys, and metrale-bench cannot depend on this crate.
/// `hermetic_closures_match_the_resolvers` checks the table against the resolvers.
pub use CLOSED_KEYS;
/// 2026-09-26: When `requested` asks for `hermetic=true`, add each `CLOSED_KEYS` entry
/// the map does not already hold. A key already present keeps its value, so an explicit
/// contradiction still reaches `validate_serve_args` and is refused there.
/// `bench_serve_plan.rs` calls this before the recipe renders.
pub
/// 2026-09-26: Whether the radix KV prefix cache runs: as requested, and never under
/// `--hermetic`. Its KV blocks are keyed on token content and adapter, not on session,
/// so one request's blocks are reachable by any later request sharing a prefix.
pub
/// 2026-09-26: The MTP gate setting passed to `scheduler::levers::resolve_mtp_gate_force`.
///
/// `None` means no flag was given, so `METRALE_MTP_GATE_FORCE` decides. Under
/// `--hermetic` it is `Some(true)`, so the environment cannot re-arm the gate outside
/// the recorded regime. An armed gate probes the other arm whenever its token counter
/// reaches the event interval, and only a probe or a switch resets that counter, never a
/// request boundary (`metrale_speculative::mtp_gate`), so which request a probe lands on
/// depends on everything served before it. `force` leaves the scheduler with no gate at all
/// (`scheduler/core/mod.rs`).
pub