Skip to content

Merge develop into infrahub-develop - #1335

Merged
infrahub-github-bot-app[bot] merged 2 commits into
infrahub-developfrom
develop
Sep 8, 2026
Merged

Merge develop into infrahub-develop#1335
infrahub-github-bot-app[bot] merged 2 commits into
infrahub-developfrom
develop

Conversation

@infrahub-github-bot-app

@infrahub-github-bot-app infrahub-github-bot-app Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Merging develop into infrahub-develop after merging pull request #1333.


Summary by cubic

Expands opt-in retry_on_failure from handling only GraphQL connection errors to covering transient failures across every SDK request path. The client now retries dropped or timed-out connections, transient HTTP responses, and flagged GraphQL errors, while non-transient errors still fail immediately.

Retry behavior

  • Retries apply to GraphQL and REST requests, multipart uploads, and streamed downloads.
  • Exponential backoff with jitter uses retry_delay and the new retry_max_delay.
  • retry_status_codes controls transient HTTP statuses, and max_retry_duration=0 enables unlimited retries.
  • Upload streams are buffered so retried requests can resend the complete body.
  • Interrupted downloads restart within the shared retry budget without leaving partial files.
  • Retried mutations may be applied more than once, so callers should use idempotent operations.

Validation

  • Adds unit coverage for retry classification, backoff, budgets, configuration, and both client types.
  • Adds opt-in failover tests with INFRAHUB_TESTING_FAILOVER=1 for load balancer and API restarts.

Written for commit ac8a841. Summary will update on new commits.

Review in cubic

Infrahub and others added 2 commits September 8, 2026 17:02
retry_on_failure only covered connection errors inside execute_graphql,
gave up after max_retry_duration, spun without delay on HTTP 5xx, and
never looked at REST calls or at GraphQL error envelopes, so a generator
running for hours aborted on the first transient infrastructure error.

A TransientRetryHandler now drives every request path of both clients:
GraphQL queries and mutations, REST endpoints such as query_gql_query and
schema loading, multipart uploads and streamed downloads. It retries
connection errors, connections dropped before a response arrives (the
shape a load balancer failover takes on an in-flight request), every
httpx timeout, HTTP 500/502/503/504 responses and GraphQL envelopes whose
errors all carry one of those statuses, sharing one time budget and
attempt counter across the transport and envelope layers. Anything else
still fails fast.

Retries use exponential backoff with jitter from retry_delay up to the
new retry_max_delay; a zero for either is rejected since it would turn
every retry into a tight loop. retry_status_codes tunes which statuses
count as transient, and max_retry_duration=0 retries indefinitely. Each
retry is logged with its attempt number and elapsed time, escalating from
WARNING to ERROR after five minutes, and once the budget is spent the
original error is raised. retry_on_failure and retry_delay are properties
so they can be toggled at runtime.

Uploads from a stream that cannot be rewound are copied once to a
temporary file, off the event loop in the async client, so a retried send
carries the full body. A streamed download whose connection drops mid-body
raises ServerNotResponsiveError, is restarted on the shared budget by the
file handler, and never leaves a partial file behind.

Opt-in integration tests (INFRAHUB_TESTING_FAILOVER=1) restart HAProxy and
the API servers mid-mutation against a real deployment.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Merge stable into develop
@infrahub-github-bot-app
infrahub-github-bot-app Bot requested a review from a team as a code owner September 8, 2026 15:44
@github-actions github-actions Bot added the type/documentation Improvements or additions to documentation label Sep 8, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: ac8a841
Status: ✅  Deploy successful!
Preview URL: https://bade05b9.infrahub-sdk-python.pages.dev
Branch Preview URL: https://develop.infrahub-sdk-python.pages.dev

View logs

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.57143% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/file_handler.py 82.75% 8 Missing and 2 partials ⚠️
infrahub_sdk/client.py 94.19% 7 Missing and 2 partials ⚠️
@@                 Coverage Diff                  @@
##           infrahub-develop    #1335      +/-   ##
====================================================
+ Coverage             85.54%   86.15%   +0.61%     
====================================================
  Files                   148      149       +1     
  Lines                 14271    14542     +271     
  Branches               1953     1998      +45     
====================================================
+ Hits                  12208    12529     +321     
+ Misses                 1496     1446      -50     
  Partials                567      567              
Flag Coverage Δ
integration-tests 43.60% <29.71%> (-0.36%) ⬇️
python-3.10 61.32% <74.85%> (+0.62%) ⬆️
python-3.11 61.33% <74.85%> (+0.62%) ⬆️
python-3.12 61.33% <74.85%> (+0.62%) ⬆️
python-3.13 61.33% <74.85%> (+0.62%) ⬆️
python-3.14 61.34% <74.85%> (+0.64%) ⬆️
python-filler-3.12 21.72% <22.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/config.py 91.56% <100.00%> (+0.10%) ⬆️
infrahub_sdk/retry.py 100.00% <100.00%> (ø)
infrahub_sdk/client.py 84.04% <94.19%> (+4.27%) ⬆️
infrahub_sdk/file_handler.py 87.56% <82.75%> (+3.61%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@infrahub-github-bot-app
infrahub-github-bot-app Bot merged commit 61197aa into infrahub-develop Sep 8, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants