Repository navigation
fix(client): keep the request context when cloning a client - #1504
Merged
Merged
Conversation
Deploying infrahub-sdk-python with
|
| Latest commit: |
92f9d7e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://51c8d264.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://fix-generator-keeps-request.infrahub-sdk-python.pages.dev |
Merged
2 of 5 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## stable #1504 +/- ##
==========================================
+ Coverage 87.85% 87.88% +0.03%
==========================================
Files 157 157
Lines 15656 15660 +4
Branches 2114 2114
==========================================
+ Hits 13754 13763 +9
+ Misses 1341 1336 -5
Partials 561 561
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st context Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
polmichel
force-pushed
the
fix/generator-keeps-request-context
branch
from
November 9, 2026 22:03
a093843 to
4502535
Compare
polmichel
marked this pull request as ready for review
November 9, 2026 22:34
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Turn on auto-fix | Re-trigger cubic
Changing the account or priority of a cloned client no longer changes the request context of the client it was cloned from. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ajtmccarty
approved these changes
Nov 9, 2026
…erforms Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
polmichel
force-pushed
the
fix/generator-keeps-request-context
branch
from
November 10, 2026 08:47
0e10dd7 to
92f9d7e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
InfrahubClient.clone()returns a client without the original client'srequest_context. Generators, transforms and checks work with a clone of the client they receive, so the changes they save are sent without the caller's account, and Infrahub records them against the worker's account (opsmill/infrahub#11480).What changed
clone()now copies therequest_context, on the async and sync clients. In both repositories, the only caller outside tests isInfrahubOperation, the base class of generators, transforms and checks.Used by opsmill/infrahub#11504.
How to review
clone()reference.How to test
test_clone_keeps_request_context: the clone has the samerequest_context.test_generator_writes_carry_the_client_request_context: a mutation sent by a generator carries the caller's account.Both fail without the fix. Also tested end to end on a live Infrahub instance through opsmill/infrahub#11504. The 3 unit tests that fail in
tests/unit/ctlalso fail onstable.Checklist
uv run towncrier create ...)🤖 Generated with Claude Code