Remove broken client.branch.diff_data() - #1229
Open
saltas888 wants to merge 7 commits into
Open
Conversation
Deploying infrahub-sdk-python with
|
| Latest commit: |
e14dec2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://26132e92.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://dsa-06082026-remove-branch-d.infrahub-sdk-python.pages.dev |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## infrahub-develop #1229 +/- ##
====================================================
+ Coverage 84.00% 84.13% +0.12%
====================================================
Files 147 147
Lines 13063 13078 +15
Branches 1932 1936 +4
====================================================
+ Hits 10974 11003 +29
+ Misses 1522 1507 -15
- Partials 567 568 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This was referenced Aug 6, 2026
Closed
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 8 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
The method targeted GET /api/diff/data, a REST endpoint that does not exist in Infrahub, so every call returned a 404 (and the URL builder was also missing the ? separator). Instead of adding a server endpoint for it, drop the method and point users at the existing GraphQL-based client.get_diff_tree() / client.get_diff_summary(). Also removes InfraHubBranchManagerBase, whose only content was the diff_data URL builder, and updates the branches guide accordingly. Closes #325 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The DiffTree GraphQL query exposes previous/new values per property but the SDK only fetched summary counts, so removing diff_data() would have left no way to retrieve the data-level diff it was meant to provide. With include_properties=True the diff tree now includes value-level details per attribute property and peer id/label per relationship element. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The query already fetched them but the parser dropped them for ONE relationships, leaving the IS_RELATED property as the only way to identify the changed peer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extract the element-to-peer conversion into a helper shared by both cardinality branches, and stop silently dropping trailing elements when a cardinality-one relationship unexpectedly carries several: they now come back as peers, same shape as cardinality-many. The include_properties addition is folded into the removal changelog entry since it exists as the diff_data() replacement. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…inality-one flattening Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
saltas888
force-pushed
the
dsa-06082026-remove-branch-diff-data
branch
from
August 7, 2026 09:06
a9e6022 to
6550507
Compare
…ity-one flattening Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
client.branch.diff_data()has never worked: it callsGET /api/diff/data, an endpoint removed from Infrahub in opsmill/infrahub#4865, and its URL builder is also missing the?separator, so every call returns a 404 (#325).opsmill/infrahub#8594 tried to fix this by adding the missing REST endpoint back, but as @ogenstad pointed out there, the SDK should use existing queries/mutations rather than get a server endpoint of its own, and the broken method should be removed or refactored instead.
The SDK already has GraphQL-based diff methods (
get_diff_tree(),get_diff_summary(), both backed by theDiffTreequery), but they only fetched summary counts, while the originaldiff_data()returned the data-level diff including previous/new values. So this PR removes the broken method and extendsget_diff_tree()to cover whatdiff_data()was meant to provide.Closes #325
What changed
diff_data()fromInfrahubBranchManagerandInfrahubBranchManagerSyncInfraHubBranchManagerBase, whose only content was thediff_dataURL builder (generate_diff_data_url)include_propertiestoclient.get_diff_tree()(async and sync), whenTruethe diff tree includes value-level details per change: previous/new value per attribute property, and peer id/label per relationship elementclient.get_diff_tree()/client.get_diff_summary()removed+added)Since the method has returned a 404 for as long as the endpoint has been absent, no working code can be calling it, removal without a deprecation cycle should be safe.
How to review
infrahub_sdk/branch.py, pure deletioninfrahub_sdk/diff.py, theinclude_propertiesextension of the query builder and response parsingtests/integration/test_diff_tree.py, end-to-end coverage against a live Infrahub (attribute value change + relationship peer change)docs/docs/python-sdk/guides/branches.mdx, the replacement guidanceHow to test
Impact & rollout
get_diff_tree()/get_diff_summary()(note there is nobranch_onlyequivalent,DiffTreealways compares the branch against its base).include_propertiesdefaults toFalse, existingget_diff_tree()callers are unaffected.Checklist