Runs export: a truncated one counts the selection into X-Total-Count; the SDK and fluksio export warn how many runs were left out

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
2026-10-14 23:29:48 +02:00
co-authored by Claude Opus 5.5
parent 02f43bf7c4
commit 8eec58d1d6
6 changed files with 66 additions and 17 deletions
+23
View File
@@ -1477,3 +1477,26 @@ def test_runs_page_by_when_they_were_created(client, superuser_token_headers, pa
"page-2",
"page-1",
]
@pytest.mark.usefixtures("paged")
def test_a_truncated_export_says_how_many_runs_it_left_out(
client, superuser_token_headers, monkeypatch
):
"""The cap is in one header, the selection's size in another, and the SDK
turns the two into a warning naming what is missing."""
from fluksio.sdk.client import Client
monkeypatch.setattr("fluksio.api.routes.runs.EXPORT_CAP", 2)
answer = client.get(
f"{settings.API_V1_STR}/runs/export/runs",
params={"flow": "paged-study", "format": "jsonl"},
headers=superuser_token_headers,
)
assert answer.headers["X-Truncated"] == "2"
assert answer.headers["X-Total-Count"] == "3"
assert [row["id"] for row in _lines(answer)] == ["page-2", "page-1"]
sdk = Client(http=client, token=superuser_token_headers["Authorization"][7:])
with pytest.warns(UserWarning, match="1 older runs"):
assert len(sdk.export_runs(flow="paged-study")) == 2