From cc62f2a9e853899752123555474cb0895566a978 Mon Sep 17 00:00:00 2001 From: Matt Miller Date: Thu, 21 May 2026 13:31:22 -0700 Subject: [PATCH] test(assets): include 'o' in microsecond-boundary cursor payload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The boundary test was building a cursor without the required `o` key, so decode failed on the missing-order branch before reaching the µs-overflow path the test is asserting. Both paths return 400 INVALID_CURSOR so the assertion passed for the wrong reason. Add `o` to the payload and matching `order=` to the request so the decode reaches the intended branch. --- tests-unit/assets_test/test_list_cursor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests-unit/assets_test/test_list_cursor.py b/tests-unit/assets_test/test_list_cursor.py index 7f692e8d0..e419e22f3 100644 --- a/tests-unit/assets_test/test_list_cursor.py +++ b/tests-unit/assets_test/test_list_cursor.py @@ -276,12 +276,14 @@ def test_cursor_invalid_cursor_at_microsecond_boundary(http: requests.Session, a import base64 import json # 10^18 microseconds ≈ year 33658, well past datetime.MAX_YEAR. - payload = {"s": "created_at", "v": "999999999999999999999", "id": "asset-x"} + # `o` and `order=` must be set; otherwise decode fails earlier on the + # missing-order branch and the µs-overflow path is never exercised. + payload = {"s": "created_at", "o": "desc", "v": "999999999999999999999", "id": "asset-x"} raw = json.dumps(payload, separators=(",", ":")).encode("utf-8") cursor = base64.urlsafe_b64encode(raw).rstrip(b"=").decode("ascii") r = http.get( api_base + "/api/assets", - params={"after": cursor, "sort": "created_at"}, + params={"after": cursor, "sort": "created_at", "order": "desc"}, timeout=120, ) assert r.status_code == 400, r.text