Skip to content

Commit 631e57e

Browse files
committed
Align run-history helper pagination with result listings.
Add offset support to list_run_history and extend tests/contracts so runtime pagination semantics stay consistent across normalized helper APIs.
1 parent 632b689 commit 631e57e

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

CONTRACT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Adapters should import from `hotdata_runtime` and treat this surface as the stab
4545
- `query_runs()` returns the query-runs API wrapper for adapter history views.
4646
- `results()` returns the results API wrapper for adapter result pickers.
4747
- `list_recent_results(...)` returns normalized `ResultSummary` entries.
48-
- `list_run_history(...)` returns normalized `RunHistoryItem` entries.
48+
- `list_run_history(limit=..., offset=...)` returns normalized `RunHistoryItem` entries.
4949
- `list_qualified_table_names(...)` returns sorted fully qualified table names.
5050
- `columns_for_qualified(qualified, connection_id=...)` resolves table columns, and
5151
adapters should pass `connection_id` when known.

hotdata_runtime/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ def list_run_history(
152152
self,
153153
*,
154154
limit: int = 20,
155+
offset: int = 0,
155156
) -> list[RunHistoryItem]:
156-
listing = self.query_runs().list_query_runs(limit=limit)
157+
listing = self.query_runs().list_query_runs(limit=limit, offset=offset)
157158
return [
158159
RunHistoryItem(
159160
query_run_id=r.id,

tests/test_client.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,17 @@ def test_list_run_history_returns_normalized_items():
221221
)
222222

223223
class FakeRunsApi:
224-
def list_query_runs(self, *, limit: int):
224+
def __init__(self):
225+
self.kwargs = None
226+
227+
def list_query_runs(self, *, limit: int, offset: int):
228+
self.kwargs = {"limit": limit, "offset": offset}
225229
return listing
226230

227-
with patch.object(client, "query_runs", return_value=FakeRunsApi()):
228-
out = client.list_run_history(limit=5)
231+
fake_runs = FakeRunsApi()
232+
with patch.object(client, "query_runs", return_value=fake_runs):
233+
out = client.list_run_history(limit=5, offset=3)
229234
assert [r.query_run_id for r in out] == ["run_1"]
230235
assert out[0].execution_time_ms == 7
231236
assert out[0].to_dict()["result_id"] == "res_1"
237+
assert fake_runs.kwargs == {"limit": 5, "offset": 3}

0 commit comments

Comments
 (0)