From a7aca30de5fbc8bd9c93e9aad8c20abd2029ef4f Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Fri, 24 Jul 2026 16:20:35 -0500 Subject: [PATCH] tests: correct stale cursor-lookback floor expectations cursor-lookback-contract has been failing on main and was not in the last chunk's rerun set. It expected a lookback floor of 4001, the sample's third segment. That segment is written active and left unsealed, and 8f48058 moved startup to resume the highest active segment in place rather than sealing it. Upstream's LookbackFloor is computed over sealed segments only and, when every segment is older than the floor time, clamps to the freshest sealed segment's MinSeq. Upstream's ingest.Open likewise resumes the active segment. So the floor is segment 1's min_seq, 2001, and a clamped v1 cursor starts at seq 2001 -- both derived from upstream, then confirmed against the process. All three modes (default, wide, disabled) pass. Co-Authored-By: Claude Opus 5 (1M context) --- tests/cursor_lookback_contract.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/cursor_lookback_contract.py b/tests/cursor_lookback_contract.py index 9ae14a3..ee9bd0e 100644 --- a/tests/cursor_lookback_contract.py +++ b/tests/cursor_lookback_contract.py @@ -66,6 +66,11 @@ def read_frame(connection, buffered): return payload, buffered +# The sample archive's events are stamped in 2023, so every segment is older +# than now-36h and the floor takes upstream's clamp branch: the MinSeq of the +# freshest SEALED segment. The sample's third segment is left active (unsealed) +# and startup resumes it in place, as upstream's ingest.Open does, so the floor +# is segment 1's min_seq (2001) -- not the active segment's first seq (4001). if MODE == "default": connection, status, headers, buffered = handshake("/subscribe-v2?cursor=1") try: @@ -74,7 +79,7 @@ if MODE == "default": body, _ = read_exact(connection, buffered, length) text = body.decode() assert "subscribe: cursor too old" in text - assert "cursor 1 below lookback floor 4001" in text + assert "cursor 1 below lookback floor 2001" in text finally: connection.close() @@ -83,7 +88,7 @@ if MODE == "default": assert status.startswith("HTTP/1.1 101") payload, _ = read_frame(connection, buffered) event = json.loads(payload) - assert event["time_us"] == 1_700_000_004_001_000 + assert event["time_us"] == 1_700_000_002_001_000 finally: connection.close() elif MODE == "wide": -- 2.51.2