From 367afa040217f0417a6bd1926b55ffedb2d6425d Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Wed, 17 Jun 2026 22:59:27 +0200 Subject: [PATCH] =?UTF-8?q?test(integration):=20address=20round-3=20review?= =?UTF-8?q?=20=E2=80=94=20harden=20RAG=20fixture=20&=20retry=20naming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - indexed_manual_pdf fixture: also require status == "idle" (alongside the existing indexed > 0 and pending == 0) so it doesn't break during a transient pending==0 window mid re-scan churn. Keeps the indexed > 0 guard — a pure status==idle check would break prematurely on the initial empty state. - _get_with_retry: rename `retries` -> `max_attempts` (3 total) and 1-index the loop so the param and "attempt N/M" log read self-evidently. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/integration/test_astrolabe_session_jwt_search.py | 8 ++++---- tests/integration/test_rag.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/integration/test_astrolabe_session_jwt_search.py b/tests/integration/test_astrolabe_session_jwt_search.py index 6ad6bcf2..583a300a 100644 --- a/tests/integration/test_astrolabe_session_jwt_search.py +++ b/tests/integration/test_astrolabe_session_jwt_search.py @@ -44,17 +44,17 @@ _SEARCH_TIMEOUT = httpx.Timeout(90.0) async def _get_with_retry( - client: httpx.AsyncClient, url: str, *, retries: int = 2, **kwargs + client: httpx.AsyncClient, url: str, *, max_attempts: int = 3, **kwargs ) -> httpx.Response: - """GET with retries on transient transport errors (timeouts/conn resets).""" + """GET, retrying on transient transport errors (timeouts/conn resets).""" last_exc: httpx.TransportError | None = None - for attempt in range(retries + 1): + for attempt in range(1, max_attempts + 1): try: return await client.get(url, **kwargs) except httpx.TransportError as e: # covers timeouts + connect/read errors last_exc = e logger.warning( - "GET %s failed (attempt %s/%s): %s", url, attempt + 1, retries + 1, e + "GET %s failed (attempt %s/%s): %s", url, attempt, max_attempts, e ) await anyio.sleep(2) raise last_exc # type: ignore[misc] diff --git a/tests/integration/test_rag.py b/tests/integration/test_rag.py index a0c32834..41e8956c 100644 --- a/tests/integration/test_rag.py +++ b/tests/integration/test_rag.py @@ -174,16 +174,22 @@ async def indexed_manual_pdf(nc_client, nc_mcp_client): content = json.loads(result.content[0].text) if result.content else {} indexed = content.get("indexed_count", 0) pending = content.get("pending_count", 1) + status = content.get("status") logger.info( - "Attempt %s/%s: indexed=%s, pending=%s", + "Attempt %s/%s: indexed=%s, pending=%s, status=%s", attempt, max_attempts, indexed, pending, + status, ) - if indexed > 0 and pending == 0: + # Require indexed > 0 (the manual must actually be indexed — + # idle/pending==0 is also the *initial* empty state) AND a + # settled idle scan so we don't break during a transient + # pending==0 window mid re-scan churn. + if indexed > 0 and pending == 0 and status == "idle": logger.info( "Vector indexing complete: %s documents indexed", indexed )