-
Notifications
You must be signed in to change notification settings - Fork 6
Fix bug with nested object template range expansion #625
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
WalkthroughThe change forwards the object's parameters when creating nodes ( Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (8)
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: |
7ead841
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://30b1c1bf.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://atg-20251112-624.infrahub-sdk-python.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## stable #625 +/- ##
=======================================
Coverage 75.46% 75.46%
=======================================
Files 113 113
Lines 9512 9512
Branches 1893 1893
=======================================
Hits 7178 7178
+ Misses 1834 1833 -1
- Partials 500 501 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
changelog/624.fixed.md(1 hunks)infrahub_sdk/spec/object.py(2 hunks)tests/unit/sdk/spec/test_object.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
When implementing Infrahub checks, subclass InfrahubCheck and override validate(data); do not implement or rely on a check() method
Files:
infrahub_sdk/spec/object.pytests/unit/sdk/spec/test_object.py
tests/unit/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Place and write unit tests under tests/unit/ (isolated component tests)
Files:
tests/unit/sdk/spec/test_object.py
tests/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Use the custom pytest plugin (infrahub_sdk.pytest_plugin) fixtures for clients, configuration, and Infrahub-specific testing
Files:
tests/unit/sdk/spec/test_object.py
🧬 Code graph analysis (2)
infrahub_sdk/spec/object.py (1)
infrahub_sdk/spec/models.py (1)
InfrahubObjectParameters(6-7)
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(634-662)validate_format(179-198)validate_format(655-659)spec(638-644)infrahub_sdk/exceptions.py (1)
ValidationError(117-129)
⏰ 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). (7)
- GitHub Check: integration-tests-latest-infrahub
- GitHub Check: unit-tests (3.13)
- GitHub Check: unit-tests (3.12)
- GitHub Check: unit-tests (3.11)
- GitHub Check: unit-tests (3.9)
- GitHub Check: unit-tests (3.10)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (4)
changelog/624.fixed.md (1)
1-1: LGTM!The changelog entry accurately documents the fix for nested object template range expansion.
infrahub_sdk/spec/object.py (1)
212-212: LGTM!Correctly passes parameters to ensure top-level parameters flow through to node creation.
tests/unit/sdk/spec/test_object.py (2)
103-118: Good edge case coverage for parameter validation.These fixtures properly test boundary conditions for parameter handling (non-dict and empty dict cases).
244-265: The review comment references a non-existent issue and unverified feature scope.Issue #624 does not appear anywhere in the codebase—no references in code, tests, documentation, or changelogs. The suggestion to add nested relationship parameter inheritance tests is based on this phantom issue and lacks evidence that the feature is implemented or required. While parameters are passed through the validation chain and top-level expansion works, there is no code evidence that parameters propagate to nested relationships or that this behavior is currently tested. The existing four parameter tests only verify parameter accessibility, not nested inheritance.
If nested relationship parameter handling is genuinely needed, it should be tracked in a documented issue before test coverage is added. Otherwise, this represents speculative feature development without clear requirements.
Likely an incorrect or invalid review comment.
infrahub_sdk/spec/object.py
Outdated
| branch=branch, | ||
| default_schema_kind=default_schema_kind, | ||
| parameters=parameters, | ||
| parameters=InfrahubObjectParameters(**data[rel].get("parameters")) if "parameters" in data[rel] else None, |
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.
should the None be parameters here? I'm not sure how parameters passed into create_node are expected to behave in combination with parameters defined inside of data
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.
If none is passed to the function it will create a new instance of InfrahubObjectParameters with parameters = parameters or InfrahubObjectParameters()
infrahub_sdk/spec/object.py
Outdated
| branch=branch, | ||
| default_schema_kind=default_schema_kind, | ||
| parameters=parameters, | ||
| parameters=InfrahubObjectParameters(**data[rel].get("parameters")) if "parameters" in data[rel] else None, |
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.
should the other calls to create_related_nodes in this method do something similar with overriding parameters?
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.
You're correct. There is one other instance where range expansion is possible. I have added that but in the case where RelationshipDataFormat.ONE_OBJ is the relation there is no need for parameters as you cant expand into a cardinality of ONE.
…r initialization of InfrahubObjectParameters
Fixes: #624
Summary by CodeRabbit
Bug Fixes
Tests