Skip to content

Conversation

@ogenstad
Copy link
Contributor

@ogenstad ogenstad commented Aug 4, 2025

Replaces #485 targeting infrahub-develop instead.

Summary by CodeRabbit

  • New Features

    • Introduced new resource types for weighted pools and internal IP availability.
    • Added new attributes to support draft status, comment counts, and rejection tracking in proposed changes.
    • Added new enum and dropdown options for more granular control in group actions, trigger rules, and number pools.
  • Enhancements

    • Extended webhooks with an optional shared key attribute.
    • Improved flexibility by replacing several boolean flags with dropdowns for action and modification types.

@coderabbitai
Copy link

coderabbitai bot commented Aug 4, 2025

Walkthrough

The changes introduce new resource classes and update several existing ones in both asynchronous and synchronous protocol definitions. These updates include adding new attributes, replacing boolean flags with dropdown/enumerated types, and extending the data model schema with additional metadata fields and resource types.

Changes

Cohort / File(s) Change Summary
Weighted Pool Resource Classes
infrahub_sdk/protocols.py
Added CoreWeightedPoolResource and CoreWeightedPoolResourceSync classes, each with an optional integer attribute allocation_weight.
Custom Webhook Classes
infrahub_sdk/protocols.py
Added optional string attribute shared_key to both CoreCustomWebhook and CoreCustomWebhookSync classes.
Group Action and Trigger Rule Classes
infrahub_sdk/protocols.py
Replaced boolean attributes with dropdowns: add_membersmember_action in CoreGroupAction/CoreGroupActionSync; members_addedmember_update in CoreGroupTriggerRule/CoreGroupTriggerRuleSync.
Node Trigger Relationship Match Classes
infrahub_sdk/protocols.py
Replaced boolean added attribute with modification_type dropdown in CoreNodeTriggerRelationshipMatch and CoreNodeTriggerRelationshipMatchSync.
Number Pool Classes
infrahub_sdk/protocols.py
Added pool_type enum attribute to both CoreNumberPool and CoreNumberPoolSync.
Proposed Change Classes
infrahub_sdk/protocols.py
Added is_draft (boolean), total_comments (optional integer), and rejected_by (relationship manager) attributes to CoreProposedChange and CoreProposedChangeSync.
Internal IP Prefix/Range Classes
infrahub_sdk/protocols.py
Added InternalIPPrefixAvailable/InternalIPPrefixAvailableSync (from BuiltinIPPrefix) and InternalIPRangeAvailable/InternalIPRangeAvailableSync (from BuiltinIPAddress), with last_address attribute in the latter.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Protocol
    participant ResourceClass

    Client->>Protocol: Request resource operation (e.g., create/update)
    Protocol->>ResourceClass: Instantiate with new/updated attributes
    ResourceClass-->>Protocol: Return resource instance with extended schema
    Protocol-->>Client: Respond with resource data including new fields
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–25 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdfb316 and 937eaae.

📒 Files selected for processing (1)
  • infrahub_sdk/protocols.py (14 hunks)
🔇 Additional comments (9)
infrahub_sdk/protocols.py (9)

236-238: LGTM: New weighted pool resource class.

The new CoreWeightedPoolResource class with optional allocation weight is well-designed for pool resource allocation scenarios.


328-328: LGTM: Enhanced webhook security.

Adding optional shared key support for webhook authentication is a good security enhancement.


413-413: Breaking change: Boolean to dropdown conversion.

The replacement of add_members: Boolean with member_action: Dropdown provides more granular control but is a breaking change. Ensure dependent code is updated accordingly.


418-418: Breaking change: Boolean to dropdown conversion.

The replacement of members_added: Boolean with member_update: Dropdown follows the same pattern of providing more granular control but introduces a breaking change.


450-450: Breaking change: Boolean to dropdown conversion.

The replacement of added: Boolean with modification_type: Dropdown continues the pattern of more granular control over trigger conditions but introduces a breaking change.


465-465: LGTM: Enhanced number pool categorization.

Adding pool_type: Enum provides better categorization capabilities for number pools.


490-493: LGTM: Enhanced proposed change functionality.

The additions of draft status, comment tracking, and rejection relationships provide comprehensive proposed change management capabilities.


567-573: LGTM: New IP availability tracking classes.

The new classes for tracking available IP prefixes and ranges are well-designed. The last_address attribute in InternalIPRangeAvailable appropriately defines the range boundary.


786-788: LGTM: Consistent sync implementations.

All sync versions correctly mirror their async counterparts with appropriate type annotations and inheritance patterns.

Also applies to: 878-878, 963-963, 968-968, 1000-1000, 1015-1015, 1040-1043, 1117-1123

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pog-infrahub-develop-protocols

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or Summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cloudflare-workers-and-pages
Copy link

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 937eaae
Status: ✅  Deploy successful!
Preview URL: https://bc8c1f0b.infrahub-sdk-python.pages.dev
Branch Preview URL: https://pog-infrahub-develop-protoco.infrahub-sdk-python.pages.dev

View logs

@ogenstad ogenstad requested a review from a team August 4, 2025 14:33
@ogenstad ogenstad merged commit 021a378 into infrahub-develop Aug 4, 2025
18 checks passed
@ogenstad ogenstad deleted the pog-infrahub-develop-protocols branch August 4, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants