Merge stable into develop#1107
Open
infrahub-github-bot-app[bot] wants to merge 1 commit into
Open
Conversation
…tes (#1106) The ValidationError raised by _validate_upsert claimed the upsert "cannot resolve the HFID without a concrete value", implying a backend crash. Since #312 the SDK no longer sends the HFID in the upsert payload, so that premise is stale. The real problem is different: a CoreNumberPool assigns a new value on every creation, so a pool-sourced HFID attribute is never stable, an upsert can never match an existing node by it, and every run would silently create a duplicate. Reword the error message and docstring to describe this, and point to the idempotent alternatives (look the node up by a stable field and reuse it, or set an explicit id). Update the resource manager guide to match and replace the misleading "two-step pattern" with the lookup-and-reuse pattern that the demo generators actually use. Add an integration test characterising the real backend behaviour (a no-id upsert creates and allocates the pool value; a re-run duplicates) and extend the unit test to cover the new message. Refs #339, #396
Deploying infrahub-sdk-python with
|
| Latest commit: |
7f37905
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://df600f48.infrahub-sdk-python.pages.dev |
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.
Merging stable into develop after merging pull request #1106.
Summary by cubic
Clarified the upsert guard for pool-sourced HFID attributes to prevent non-idempotent
save(allow_upsert=True)calls that would silently create duplicates. Updated the resource manager guide to recommend lookup-and-reuse or setting an explicitid, and added tests to document backend behavior._validate_upsertininfrahub_sdk/node/node.pyto explain thatCoreNumberPoolvalues change on each creation, so an HFID using them is never stable; includes guidance on idempotent alternatives.docs/python-sdk/guides/resource-manager.mdxto replace the two-step pattern with a lookup-and-reuse example and clarify limitations.tests/integration/test_upsert_numberpool_hfid.pyto characterize backend behavior and extended unit tests to assert the new message; added a changelog entry.Written for commit 7f37905. Summary will update on new commits.