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
+13
View File
@@ -12,6 +12,7 @@ import os
import subprocess
import time
import uuid
import warnings
from collections.abc import Iterable
from pathlib import Path
from typing import Any
@@ -511,6 +512,8 @@ class Client:
jsonl on the wire rather than csv: it keeps the types the engine has,
and it is the format the CLI converts to parquet from. Read whole —
the streaming is the engine's side, and a notebook wants a list.
A selection past the engine's cap comes back without its oldest runs,
and that is a warning, since the rows alone look complete.
"""
if flow:
query["flow"] = flow
@@ -523,6 +526,16 @@ class Client:
response = self._request("GET", path, idempotent=True, params=query)
if response.status_code >= 400:
raise ApiError(response.status_code, _detail(response))
cap = response.headers.get("X-Truncated")
if cap:
# An engine older than the count sends the cap alone.
total = response.headers.get("X-Total-Count")
left = f"{int(total) - int(cap)} older runs" if total else "older runs"
warnings.warn(
f"the export stops at {cap} runs, so {left} of this selection "
"were left out; narrow it by flow, status, since or until",
stacklevel=3,
)
return [json.loads(line) for line in response.text.splitlines() if line]
def cancel(self, run_id: str) -> Any: