Remove broken client.branch.diff_data()

Merged
SA
3mo ago
+33-66

Why

client.branch.diff_data() has never worked: it calls GET /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 instead. Since the method has returned a 404 for as long as the endpoint has been absent, nobody can be using it, so it is deleted without a replacement.

For branch diffs the SDK already has the GraphQL-based get_diff_tree() and get_diff_summary(), both backed by the DiffTree query.

Closes #325

What changed

  • Removed diff_data() from InfrahubBranchManager and InfrahubBranchManagerSync
  • Removed InfraHubBranchManagerBase, whose only content was the diff_data URL builder (generate_diff_data_url)
  • Rewrote the "Generating a diff for a branch" section of the branches guide to point at client.get_diff_tree() / client.get_diff_summary()
  • Changelog entry (removed)

An earlier iteration also extended get_diff_tree() with an include_properties option to preserve the value-level diff that diff_data() was meant to return, we agreed the broken functionality is unused so a plain removal is preferable. Those commits are reverted on the branch, the net diff is the removal only.

How to review

  1. infrahub_sdk/branch.py, pure deletion
  2. docs/docs/python-sdk/guides/branches.mdx, the replacement guidance

How to test

uv run pytest tests/unit/sdk/test_diff_summary.py tests/unit/sdk/test_branch.py

Impact & rollout

  • Backward compatibility: removes a public method that could not be used successfully; callers migrating should switch to get_diff_tree() / get_diff_summary() (note there is no branch_only equivalent, DiffTree always compares the branch against its base).
  • Config/env changes: none

Checklist

  • Changelog entry added
  • External docs updated
  • Internal .md docs updated (n/a)