Skip to content

Merge stable into develop#1107

Open
infrahub-github-bot-app[bot] wants to merge 1 commit into
developfrom
stable
Open

Merge stable into develop#1107
infrahub-github-bot-app[bot] wants to merge 1 commit into
developfrom
stable

Conversation

@infrahub-github-bot-app

@infrahub-github-bot-app infrahub-github-bot-app Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

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 explicit id, and added tests to document backend behavior.

  • Bug Fixes
    • Reworded _validate_upsert in infrahub_sdk/node/node.py to explain that CoreNumberPool values change on each creation, so an HFID using them is never stable; includes guidance on idempotent alternatives.
    • Updated docs/python-sdk/guides/resource-manager.mdx to replace the two-step pattern with a lookup-and-reuse example and clarify limitations.
    • Added tests/integration/test_upsert_numberpool_hfid.py to 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.

Review in cubic

…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
@infrahub-github-bot-app infrahub-github-bot-app Bot requested a review from a team as a code owner June 26, 2026 15:34
@github-actions github-actions Bot added the type/documentation Improvements or additions to documentation label Jun 26, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7f37905
Status: ✅  Deploy successful!
Preview URL: https://df600f48.infrahub-sdk-python.pages.dev

View logs

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.

1 participant