Skip to content

Poll cached full scan results until ready - #115

Open
John-David Dalton (jdalton) wants to merge 2 commits into
mainfrom
fix/python-cached-full-scans
Open

John-David Dalton (jdalton) wants to merge 2 commits into
mainfrom
fix/python-cached-full-scans

Conversation

@jdalton

@jdalton John-David Dalton (jdalton) commented Oct 15, 2026 •

Copy link
Copy Markdown

LLM Description written by Codex:gpt-6-astra

Keep full-scan reads working while analysis is still processing. Existing callers now use cached results with bounded polling instead of holding one long request.

Root Cause

fullscans.stream() made one uncached request and treated 202 Processing as a failed result.

Fix

  • Poll cached results within the caller's configured timeout.
  • Retry processing responses and existing transient errors; preserve authorization and not-found failures.
  • Keep dictionary and typed artifact parsing unchanged.
Validation

29 tests pass against a local HTTP fixture using the real SDK and requests transport. Ruff and diff checks pass. Tests cover processing, timeout, transient and permanent failures, encoded identifiers, invalid settings, and artifact parsing.

No SDK release or CLI dependency update is included.

Public Changelog

Full-scan reads wait for cached analysis results within the configured timeout.


Note

Medium Risk
Changes default full-scan read behavior (cached polling, longer wall time, new timeout errors) for all stream() callers; logic is well-tested but affects a core API path.

Overview
fullscans.stream() no longer treats a single 202 Processing as failure. It requests ?cached=true, polls with exponential backoff (defaults 5–10s) until results are ready or the budget expires, and raises APITimeout when the poll window runs out.

Polling honors optional poll_timeout_seconds (default: SDK request timeout), validates timeout/interval values up front, URL-encodes org and scan IDs, retries transient APIFailures and 202 responses, and still fails fast on auth/not-found errors. HTTP responses are closed after use.

API.do_request gains an optional per-call request_timeout override so each poll uses a bounded timeout (min(30s, configured timeout, remaining poll budget)).

New localhost HTTP fixture and unit tests cover ready/processing/empty streams, retries, timeouts, encoded IDs, and invalid settings.

Reviewed by Cursor Bugbot for commit 97d148a. Configure here.

Wait for cached full scan artifacts and bound retries so SDK callers receive completed results or a clear timeout.

Assisted-by: Codex: GPT-6
@jdalton
John-David Dalton (jdalton) requested a review from a team as a code owner October 15, 2026 04:34
Exercise the cached stream through the real SDK transport and bump the package version to an unpublished release.

Assisted-by: Codex: GPT-6

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant