From 3a9bc49d4e0b56002d0d14203040d08c0fa5caea Mon Sep 17 00:00:00 2001 From: mschwab Date: Wed, 3 Jun 2026 16:58:49 -0700 Subject: [PATCH] test(intake): pin ATIF ingest reads below the default 30-day lookback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These tests ingest spans with fixed 2026-05 timestamps and read them back without a time filter. The spans list/traces endpoints default started_at to now-30d, so once wall-clock passes ~30 days after the fixtures the reads return nothing and the suite fails (assert 0 == 7 / StopIteration) — unrelated to any ingest logic. Pin each historical list read to an explicit started_at lower bound so the suite is stable regardless of the current date. Signed-off-by: mschwab --- .../integration/spans/test_atif_ingest.py | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/services/intake/tests/integration/spans/test_atif_ingest.py b/services/intake/tests/integration/spans/test_atif_ingest.py index 58050ac85d..39f0f0c417 100644 --- a/services/intake/tests/integration/spans/test_atif_ingest.py +++ b/services/intake/tests/integration/spans/test_atif_ingest.py @@ -9,6 +9,8 @@ import pytest from fastapi.testclient import TestClient +_HISTORICAL_GTE = "2024-01-01T00:00:00Z" + def test_atif_ingest_rejects_loose_steps_payload(client: TestClient): body = { @@ -313,6 +315,7 @@ def test_atif_ingest_accepts_example_trajectory_and_reconstructs_read_side_data( "/apis/intake/v2/workspaces/default/spans", params={ "filter[session_id]": body["session_id"], + "filter[started_at][gte]": _HISTORICAL_GTE, "page_size": 10, "sort": "started_at", }, @@ -374,7 +377,11 @@ def test_atif_ingest_accepts_example_trajectory_and_reconstructs_read_side_data( evaluation_response = client.get( "/apis/intake/v2/workspaces/default/spans", - params={"filter[evaluation_id]": evaluation_context["evaluation_id"], "page_size": 10}, + params={ + "filter[evaluation_id]": evaluation_context["evaluation_id"], + "filter[started_at][gte]": _HISTORICAL_GTE, + "page_size": 10, + }, ) assert evaluation_response.status_code == 200, evaluation_response.text evaluation_spans = evaluation_response.json()["data"] @@ -387,7 +394,11 @@ def test_atif_ingest_accepts_example_trajectory_and_reconstructs_read_side_data( }.items(): filtered = client.get( "/apis/intake/v2/workspaces/default/spans", - params={f"filter[{field}]": value, "page_size": 10}, + params={ + f"filter[{field}]": value, + "filter[started_at][gte]": _HISTORICAL_GTE, + "page_size": 10, + }, ) assert filtered.status_code == 200, filtered.text filtered_spans = filtered.json()["data"] @@ -490,7 +501,12 @@ def test_atif_ingest_accepts_example_trajectory_and_reconstructs_read_side_data( evaluation_roots_response = client.get( "/apis/intake/v2/workspaces/default/spans", - params={"filter[evaluation_id]": evaluation_context["evaluation_id"], "page_size": 20, "sort": "started_at"}, + params={ + "filter[evaluation_id]": evaluation_context["evaluation_id"], + "filter[started_at][gte]": _HISTORICAL_GTE, + "page_size": 20, + "sort": "started_at", + }, ) assert evaluation_roots_response.status_code == 200, evaluation_roots_response.text evaluation_roots = evaluation_roots_response.json()["data"] @@ -518,7 +534,11 @@ def test_atif_ingest_accepts_example_trajectory_and_reconstructs_read_side_data( other_evaluation_response = client.get( "/apis/intake/v2/workspaces/default/spans", - params={"filter[evaluation_run_id]": other_evaluation_run_id, "page_size": 10}, + params={ + "filter[evaluation_run_id]": other_evaluation_run_id, + "filter[started_at][gte]": _HISTORICAL_GTE, + "page_size": 10, + }, ) assert other_evaluation_response.status_code == 200, other_evaluation_response.text other_evaluation_spans = other_evaluation_response.json()["data"] @@ -528,7 +548,11 @@ def test_atif_ingest_accepts_example_trajectory_and_reconstructs_read_side_data( same_session_response = client.get( "/apis/intake/v2/workspaces/default/spans", - params={"filter[session_id]": body["session_id"], "page_size": 10}, + params={ + "filter[session_id]": body["session_id"], + "filter[started_at][gte]": _HISTORICAL_GTE, + "page_size": 10, + }, ) assert same_session_response.status_code == 200, same_session_response.text same_session_spans_by_name = {span["name"]: span for span in same_session_response.json()["data"]} @@ -603,6 +627,7 @@ def test_atif_trace_tokens_do_not_double_count_when_trajectory_and_steps_both_ca "/apis/intake/v2/workspaces/default/spans", params={ "filter[session_id]": body["session_id"], + "filter[started_at][gte]": _HISTORICAL_GTE, "page_size": 20, "sort": "started_at", }, @@ -636,7 +661,11 @@ def test_atif_trace_tokens_do_not_double_count_when_trajectory_and_steps_both_ca # Trace-level rollup equals the sum of per-step metrics, NOT 2x. traces_response = client.get( "/apis/intake/v2/workspaces/default/traces", - params={"filter[session_id]": body["session_id"], "page_size": 10}, + params={ + "filter[session_id]": body["session_id"], + "filter[started_at][gte]": _HISTORICAL_GTE, + "page_size": 10, + }, ) assert traces_response.status_code == 200, traces_response.text traces = traces_response.json()["data"]