From a6d2f6f6a260c959ffae850000ff385e29e9a51c Mon Sep 17 00:00:00 2001 From: Patrick Ogenstad Date: Tue, 26 Aug 2025 09:32:36 +0200 Subject: [PATCH 1/5] Update copier in lock file Fixes security vulnerability --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index b3a5cbfc..1be50f8e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -224,15 +224,15 @@ markers = {main = "extra == \"ctl\" or extra == \"all\" or sys_platform == \"win [[package]] name = "copier" -version = "9.8.0" +version = "9.9.1" description = "A library for rendering project templates." optional = true python-versions = ">=3.9" groups = ["main"] markers = "extra == \"ctl\" or extra == \"all\"" files = [ - {file = "copier-9.8.0-py3-none-any.whl", hash = "sha256:ca0bee47f198b66cec926c4f1a3aa77f11ee0102624369c10e42ca9058c0a891"}, - {file = "copier-9.8.0.tar.gz", hash = "sha256:343ac1eb65e678aa355690d7f19869ef07cabf837f511a87ed452443c085ec58"}, + {file = "copier-9.9.1-py3-none-any.whl", hash = "sha256:9439280baca00194933b04885f1376b17e3287c2324053666fbe9a7a0aceaa44"}, + {file = "copier-9.9.1.tar.gz", hash = "sha256:244bdf3ec5eb460dbe45ef22b825e9897b0bcc9d94ca96dad3ced3d786cfeab7"}, ] [package.dependencies] From e2da52e0865ac8ba808cccf05ea6dcfd65b49f80 Mon Sep 17 00:00:00 2001 From: Bearchitek Date: Tue, 26 Aug 2025 13:29:19 +0200 Subject: [PATCH 2/5] fix some issue with the offset --- infrahub_sdk/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrahub_sdk/client.py b/infrahub_sdk/client.py index 16c1c73a..4a6ad81b 100644 --- a/infrahub_sdk/client.py +++ b/infrahub_sdk/client.py @@ -790,7 +790,7 @@ async def filters( async def process_page(page_offset: int, page_number: int) -> tuple[dict, ProcessRelationsNode]: """Process a single page of results.""" query_data = await InfrahubNode(client=self, schema=schema, branch=branch).generate_query_data( - offset=offset or page_offset, + offset=page_offset if offset is None else offset, limit=limit or pagination_size, filters=filters, include=include, @@ -1954,7 +1954,7 @@ def filters( def process_page(page_offset: int, page_number: int) -> tuple[dict, ProcessRelationsNodeSync]: """Process a single page of results.""" query_data = InfrahubNodeSync(client=self, schema=schema, branch=branch).generate_query_data( - offset=offset or page_offset, + offset=page_offset if offset is None else offset, limit=limit or pagination_size, filters=filters, include=include, From 0aee5147e32bacabf253ea521434c11c9ba13846 Mon Sep 17 00:00:00 2001 From: Bearchitek Date: Tue, 26 Aug 2025 13:31:01 +0200 Subject: [PATCH 3/5] add changelog --- changelog/+race-condition.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/+race-condition.fixed.md diff --git a/changelog/+race-condition.fixed.md b/changelog/+race-condition.fixed.md new file mode 100644 index 00000000..0db5f365 --- /dev/null +++ b/changelog/+race-condition.fixed.md @@ -0,0 +1 @@ +Update offset in process_page() which was causing a race condition in rare case. \ No newline at end of file From 527c0a5955032f2f206fd73a611cd41f97342f2e Mon Sep 17 00:00:00 2001 From: Bearchitek Date: Tue, 26 Aug 2025 15:13:09 +0200 Subject: [PATCH 4/5] found it ! --- infrahub_sdk/node/node.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrahub_sdk/node/node.py b/infrahub_sdk/node/node.py index 242281b5..4eb1d0d3 100644 --- a/infrahub_sdk/node/node.py +++ b/infrahub_sdk/node/node.py @@ -1,7 +1,7 @@ from __future__ import annotations from collections.abc import Iterable -from copy import copy +from copy import copy, deepcopy from typing import TYPE_CHECKING, Any from ..constants import InfrahubClientMode @@ -397,7 +397,7 @@ def generate_query_data_init( "edges": {"node": {"id": None, "hfid": None, "display_label": None, "__typename": None}}, } - data["@filters"] = filters or {} + data["@filters"] = deepcopy(filters) if filters is not None else {} if order: data["@filters"]["order"] = order From 8d3309f1c34317fff7597a617bbbd71784a2f093 Mon Sep 17 00:00:00 2001 From: Patrick Ogenstad Date: Tue, 26 Aug 2025 08:58:18 +0200 Subject: [PATCH 5/5] Version 1.14.0 --- CHANGELOG.md | 14 ++++++++++++++ .../+add_numberpool_support_protocols.added.md | 1 - changelog/+batch.fixed.md | 1 - changelog/+branch-in-count.fixed.md | 1 - changelog/+race-condition.fixed.md | 1 - changelog/466.added.md | 1 - changelog/6882.fixed.md | 1 - pyproject.toml | 2 +- 8 files changed, 15 insertions(+), 7 deletions(-) delete mode 100644 changelog/+add_numberpool_support_protocols.added.md delete mode 100644 changelog/+batch.fixed.md delete mode 100644 changelog/+branch-in-count.fixed.md delete mode 100644 changelog/+race-condition.fixed.md delete mode 100644 changelog/466.added.md delete mode 100644 changelog/6882.fixed.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a565484..ea7995c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,20 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang +## [1.14.0](https://github.com/opsmill/infrahub-sdk-python/tree/v1.14.0) - 2025-08-26 + +### Added + +- Added `infrahubctl repository init` command to allow the initialization of an Infrahub repository using [infrahub-template](https://github.com/opsmill/infrahub-template). ([#466](https://github.com/opsmill/infrahub-sdk-python/issues/466)) +- add support for NumberPool attributes in generated protocols + +### Fixed + +- Fix value lookup using a flat notation like `foo__bar__value` with relationships of cardinality one ([#6882](https://github.com/opsmill/infrahub-sdk-python/issues/6882)) +- Create a new batch while fetching relationships instead of using the reusing the same one. +- Update internal calls to `count` to include the branch parameter so that the query is performed on the correct branch +- Update offset in process_page() which was causing a race condition in rare case. ([#514](https://github.com/opsmill/infrahub-sdk-python/pull/514)) + ## [1.13.5](https://github.com/opsmill/infrahub-sdk-python/tree/v1.13.5) - 2025-07-23 ### Fixed diff --git a/changelog/+add_numberpool_support_protocols.added.md b/changelog/+add_numberpool_support_protocols.added.md deleted file mode 100644 index aef27a24..00000000 --- a/changelog/+add_numberpool_support_protocols.added.md +++ /dev/null @@ -1 +0,0 @@ -add support for NumberPool attributes in generated protocols diff --git a/changelog/+batch.fixed.md b/changelog/+batch.fixed.md deleted file mode 100644 index 635d6b62..00000000 --- a/changelog/+batch.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Create a new batch while fetching relationships instead of using the reusing the same one. \ No newline at end of file diff --git a/changelog/+branch-in-count.fixed.md b/changelog/+branch-in-count.fixed.md deleted file mode 100644 index b4227386..00000000 --- a/changelog/+branch-in-count.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Update internal calls to `count` to include the branch parameter so that the query is performed on the correct branch \ No newline at end of file diff --git a/changelog/+race-condition.fixed.md b/changelog/+race-condition.fixed.md deleted file mode 100644 index 0db5f365..00000000 --- a/changelog/+race-condition.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Update offset in process_page() which was causing a race condition in rare case. \ No newline at end of file diff --git a/changelog/466.added.md b/changelog/466.added.md deleted file mode 100644 index 49d639ef..00000000 --- a/changelog/466.added.md +++ /dev/null @@ -1 +0,0 @@ -Added `infrahubctl repository init` command to allow the initialization of an Infrahub repository using [infrahub-template](https://github.com/opsmill/infrahub-template). \ No newline at end of file diff --git a/changelog/6882.fixed.md b/changelog/6882.fixed.md deleted file mode 100644 index c0c8cebc..00000000 --- a/changelog/6882.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix value lookup using a flat notation like `foo__bar__value` with relationships of cardinality one \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 17c0ccd3..c51c7ae1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "infrahub-sdk" -version = "1.13.5" +version = "1.14.0" description = "Python Client to interact with Infrahub" authors = ["OpsMill "] readme = "README.md"