-
Couldn't load subscription status.
- Fork 6
add support for NumerPool attributes to protocols #484
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
add support for NumerPool attributes to protocols #484
Conversation
WalkthroughSupport for NumberPool attributes has been added to the protocol generation process. This is achieved by updating the attribute kind mapping to recognize "NumberPool" as an "Integer" type, enabling proper handling of NumberPool-related data in generated protocols. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Deploying infrahub-sdk-python with
|
| Latest commit: |
936522d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d5d09c53.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://wvd-20250728-add-numberpool.infrahub-sdk-python.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests.
@@ Coverage Diff @@
## stable #484 +/- ##
===========================================
- Coverage 75.76% 53.79% -21.97%
===========================================
Files 100 100
Lines 8838 8789 -49
Branches 1733 1719 -14
===========================================
- Hits 6696 4728 -1968
- Misses 1666 3688 +2022
+ Partials 476 373 -103
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 61 files 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: 0
🔭 Outside diff range comments (1)
infrahub_sdk/protocols_generator/constants.py (1)
3-26: Add unit test for the new NumberPool mapping
I’ve verified viargthat:
ATTRIBUTE_KIND_MAPincludes"NumberPool": "Integer"(constants.py)- The schema enum (
infrahub_sdk/schema/main.py) and protocols (infrahub_sdk/protocols.py) define and handleCoreNumberPool- Fixtures already include a
NumberPoolentry (tests/fixtures/schema_05.json)However, there’s no generator test asserting that a
NumberPoolattribute produces a Pythonint. Please add/extend a unit test to cover this:• In your protocols‐generator tests (e.g. under
tests/test_protocols_generator/), load or craft a minimal schema containing aNumberPoolattribute.
• Run the codegen and assert that the resulting protocol class usesintfor that field.
• Optional: add a simple constant‐mapping assertion, e.g.from infrahub_sdk.protocols_generator.constants import ATTRIBUTE_KIND_MAP assert ATTRIBUTE_KIND_MAP["NumberPool"] == "Integer"This will ensure full coverage of the new attribute kind.
🧹 Nitpick comments (2)
infrahub_sdk/protocols_generator/constants.py (1)
25-25: KeepATTRIBUTE_KIND_MAPalphabetically sorted for readability & easier diffingThe new entry is appended at the bottom. Consider inserting it in alphabetical order (between
"Number"and"Password") to maintain the existing ordering convention and reduce merge-conflict likelihood.- "NumberPool": "Integer", + "NumberPool": "Integer", # <- place alphabetically between "Number" and "Password"changelog/+add_numberpool_support_protocols.added.md (1)
1-1: Changelog entry: capitalise sentence & include context sectionFollow the repo’s changelog pattern (imperative, capitalised, possibly under a heading like “Added”). Example:
-add support for NumberPool attributes in generated protocols +Added: support for NumberPool attributes in generated protocols
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
changelog/+add_numberpool_support_protocols.added.md(1 hunks)infrahub_sdk/protocols_generator/constants.py(1 hunks)
⏰ 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). (6)
- GitHub Check: unit-tests (3.11)
- GitHub Check: unit-tests (3.12)
- GitHub Check: integration-tests-latest-infrahub
- GitHub Check: unit-tests (3.10)
- GitHub Check: unit-tests (3.13)
- GitHub Check: unit-tests (3.9)
Adds support for NumberPool attributes to generated protocols.
Summary by CodeRabbit