From f55a90a1de7283b16e1530c93a100a6558ef5083 Mon Sep 17 00:00:00 2001 From: Flavio Oliva Date: Tue, 24 Nov 2026 00:39:37 +0000 Subject: [PATCH 1/2] test: a log-tail resume reads on through an empty stream, as EventSource does Signed-off-by: Flavio Oliva --- tests/fastapi/test_log_tail_api.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/fastapi/test_log_tail_api.py b/tests/fastapi/test_log_tail_api.py index bf6c7ed6d..2a00c1d7b 100644 --- a/tests/fastapi/test_log_tail_api.py +++ b/tests/fastapi/test_log_tail_api.py @@ -37,6 +37,7 @@ API = "/sharpit/api/log-tail" STREAM = f"{API}/stream" UVICORN_LOGGERS = ("uvicorn", "uvicorn.error", "uvicorn.access") +EMPTY_STREAMS = 3 # consecutive streams with no line before _ids treats the replay as complete def _client(app: Any) -> TestClient: @@ -175,12 +176,19 @@ def test_stream_replays_then_ends_with_retry(): def _ids(client: TestClient, **kw: Any) -> list[str]: """Log ids as EventSource reads them: a stream may end mid-replay (spec ยง10), so reconnect with the last id seen - as Last-Event-ID until a stream brings no line. Bounded: a resume that repeats lines shows up as duplicates.""" + as Last-Event-ID until ``EMPTY_STREAMS`` streams in a row bring no line. One empty stream is not the end: on a + loaded runner a stream can time out before its first frame (CI run 45296913127). Bounded: a resume that repeats + lines shows up as duplicates.""" ids: list[str] = [] + empty = 0 for _ in range(20): batch = [e["id"] for e in _events(client.get(f"{API}/stream", **kw).text) if e.get("event") == "log"] if not batch: - break + empty += 1 + if empty == EMPTY_STREAMS: + break + continue + empty = 0 ids += batch kw = {**kw, "headers": {**kw.get("headers", {}), "Last-Event-ID": batch[-1]}} return ids From abec38b30de7ce354bd2b071819948bd016a6ec4 Mon Sep 17 00:00:00 2001 From: Flavio Oliva Date: Tue, 24 Nov 2026 00:58:39 +0000 Subject: [PATCH 2/2] chore: lower the Sonar baseline to 8, main's open count after #310 Signed-off-by: Flavio Oliva --- sonar-baseline.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-baseline.txt b/sonar-baseline.txt index 7273c0fa8..45a4fb75d 100644 --- a/sonar-baseline.txt +++ b/sonar-baseline.txt @@ -1 +1 @@ -25 +8