-
Notifications
You must be signed in to change notification settings - Fork 6
Merge 'stable' into 'develop' with resolved conflicts #629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Add tests for parameter validation and fix nested object template range expansion * Handle missing parameters in InfrahubObjectParameters initialization * Refactor parameter handling in InfrahubObjectFileData to ensure proper initialization of InfrahubObjectParameters
WalkthroughThis change releases version 1.15.1 with a fix for nested object template range expansion. The fix modifies parameter propagation in nested relationship processing within the ObjectFile implementation to use per-item parameters from nested data when available, rather than always forwarding outer parameters. The project version is updated in pyproject.toml, and test fixtures and test cases are added to validate parameter handling scenarios including top-level parameters, missing expand_range attributes, empty parameter dictionaries, and non-dictionary parameter types. Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying infrahub-sdk-python with
|
| Latest commit: |
811c047
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2b88b037.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://pog-develop-to-stable-202511.infrahub-sdk-python.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## develop #629 +/- ##
===========================================
+ Coverage 75.54% 75.56% +0.02%
===========================================
Files 113 113
Lines 9512 9512
Branches 1448 1448
===========================================
+ Hits 7186 7188 +2
+ Misses 1839 1837 -2
Partials 487 487
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/unit/sdk/spec/test_object.py (1)
244-265: Good parameter validation coverage, but consider adding nested scenario tests.The tests effectively validate parameter handling at the top level and various edge cases. However, they don't directly test the core fix: nested parameter propagation in relationships (e.g., where a nested object in a relationship has its own
parametersthat should override parent parameters).Consider adding a test that validates the actual bug fix scenario:
async def test_parameters_nested_override(client_with_schema_01: InfrahubClient) -> None: """Test that nested relationship objects can have their own parameters.""" # Example: parent has expand_range=False, but nested child has expand_range=True data = { "apiVersion": "infrahub.app/v1", "kind": "Object", "spec": { "kind": "ParentKind", "parameters": {"expand_range": False}, "data": [{ "name": "Parent", "children": { "parameters": {"expand_range": True}, "data": [{"name": "Child[1-3]"}] } }] } } obj = ObjectFile(location="some/path", content=data) await obj.validate_format(client=client_with_schema_01) # Validate that nested children were expanded despite parent's expand_range=False
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
CHANGELOG.md(1 hunks)infrahub_sdk/spec/object.py(3 hunks)pyproject.toml(1 hunks)tests/unit/sdk/spec/test_object.py(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/unit/sdk/spec/test_object.py (3)
tests/unit/sdk/conftest.py (2)
client_with_schema_01(1886-1888)client(32-33)infrahub_sdk/spec/object.py (4)
ObjectFile(637-665)validate_format(179-198)validate_format(658-662)spec(641-647)infrahub_sdk/exceptions.py (1)
ValidationError(117-129)
infrahub_sdk/spec/object.py (1)
infrahub_sdk/spec/models.py (1)
InfrahubObjectParameters(6-7)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (6)
pyproject.toml (1)
3-3: LGTM! Version bump aligns with the bug fix release.The patch version increment from 1.15.0 to 1.15.1 is appropriate for the nested object template range expansion fix documented in the changelog.
CHANGELOG.md (1)
14-18: LGTM! Changelog entry is clear and well-formatted.The release entry properly documents the fix for nested object template range expansion and includes appropriate issue reference.
tests/unit/sdk/spec/test_object.py (1)
103-118: LGTM! Well-structured test fixtures for parameter validation.The new fixtures appropriately cover edge cases for parameter handling, including non-dict and empty dict scenarios.
infrahub_sdk/spec/object.py (3)
212-212: LGTM! Properly passes top-level parameters to node creation.The addition of
parameters=self.parametersensures that top-level parameters are propagated to the node creation flow, which is essential for the parameter handling to work correctly.
473-476: LGTM! Correctly implements per-item parameter propagation for nested relationships.The change from forwarding outer parameters to extracting per-item parameters from
value.get("parameters")is the core fix for nested object template range expansion. This allows nested relationship objects to have their own independent parameter settings (e.g.,expand_range).
514-517: LGTM! Consistent parameter extraction for remaining relationships.The parameter extraction pattern matches the approach used in lines 473-476, ensuring consistent behavior across different relationship processing paths. The conditional check prevents errors when nested objects don't specify parameters.
Removed poetry.lock
Summary by CodeRabbit