From 04ee2f5d8670303dea47cd209caae96bf74f3aca Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Fri, 7 Aug 2026 10:30:32 -0500 Subject: [PATCH] environment contract: allowlist for stream-only variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JETSTREAM_REBLOOM_SWEEP is the first env var with no upstream counterpart. The contract now carries an explicit stream_only map — each entry recorded as an intentional divergence in configuration-parity.md — and still pins everything else to upstream exactly, including a collision check so an upstream addition of the same name is caught. --- docs/configuration-parity.md | 1 + tests/environment_contract.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/configuration-parity.md b/docs/configuration-parity.md index dc18821..0b09cc5 100644 --- a/docs/configuration-parity.md +++ b/docs/configuration-parity.md @@ -74,6 +74,7 @@ semantically correct. Status vocabulary is defined in | `inspect-segment` | **partial** | A sealed upstream fixture matches the pinned renderer for asserted output; active/partial/checksum cases have Stream tests. | The complete current golden set was not rerun during this audit. | | `inspect-all` | **partial** | Representative steady/bootstrap trees, missing roots, active skip, aggregation, sorting, and truncation have fixtures, including a copied upstream report. | It does not replace missing online collections/segments status tabs; complete golden coverage was not independently re-audited. | | Go pprof routes | **intentional divergence** | Stream does not expose `/debug/pprof/*` handlers. Zig/process metrics are used instead. | Documented as an explicit intentional divergence. | +| `--rebloom-sweep` / `JETSTREAM_REBLOOM_SWEEP` | **intentional divergence** | Stream-only operator control: one-shot sweep that right-sizes legacy per-block bloom regions (upstream f02919c changed seal-time sizing only and ships no legacy-migration tool). Allowlisted in `tests/environment_contract.py`; behavior in `docs/configuration.md`. | Remove once the legacy archive is fully right-sized, or keep as an inert no-op. | ## Required configuration admission diff --git a/tests/environment_contract.py b/tests/environment_contract.py index 5ed147a..0dcacd0 100644 --- a/tests/environment_contract.py +++ b/tests/environment_contract.py @@ -51,10 +51,20 @@ def exact_pinned_map_case() -> None: r'\.env = "(JETSTREAM_[^"]+)", \.flag = "([^"]+)"', stream_text ) } - assert stream == upstream, ( + # Stream-only variables: each entry is an intentional divergence recorded + # in docs/configuration-parity.md. Anything not listed here must match + # upstream exactly. + stream_only = { + "JETSTREAM_REBLOOM_SWEEP": "rebloom-sweep", + } + assert not (stream_only.keys() & upstream.keys()), ( + f"stream_only entries collide with upstream: {sorted(stream_only.keys() & upstream.keys())}" + ) + expected = upstream | stream_only + assert stream == expected, ( f"environment map drift\n" - f"missing/wrong: {sorted(upstream.items() - stream.items())}\n" - f"extra/wrong: {sorted(stream.items() - upstream.items())}" + f"missing/wrong: {sorted(expected.items() - stream.items())}\n" + f"extra/wrong: {sorted(stream.items() - expected.items())}" ) -- 2.51.2