Skip to content

Conversation

gmazoyer
Copy link
Contributor

@gmazoyer gmazoyer commented Jul 22, 2025

This change introduce events related to actions taken on a proposed change. For now, several new events are part of the PR:

  • infrahub.proposed_change.merged
  • infrahub.proposed_change.approved
  • infrahub.proposed_change.rejected
  • infrahub.proposed_change.approval_revoked
  • infrahub.proposed_change.rejection_revoked

Summary by CodeRabbit

  • New Features

    • Introduced new event types for proposed change reviews and merges, including approval, rejection, revocation, review requests, and merging actions.
    • Added corresponding GraphQL event types and extended event mapping for these new events.
    • Enabled asynchronous event dispatching after proposed change review decisions and merges.
  • Documentation

    • Expanded event documentation to include detailed descriptions and payloads for all new proposed change events.
  • Bug Fixes

    • Enhanced test coverage to verify that proposed change review and merge actions correctly emit the new events.
  • Chores

    • Updated changelog to reflect the addition of proposed change review and merge events.

Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

Walkthrough

This change introduces a comprehensive event system for proposed change reviews and merges. It adds new event types, event classes, and GraphQL types, integrates event emission into review and merge workflows, updates documentation, and extends tests to verify event logging. Supporting utilities and filters for event querying are also included.

Changes

Cohort / File(s) Change Summary
Event Type Constants
backend/infrahub/core/constants/__init__.py
Added six new event string constants to the EventType enum for proposed change lifecycle events (merged, review requested, approved, rejected, approval revoked, rejection revoked).
Event Class Exports
backend/infrahub/events/__init__.py
Imported and exported six new proposed change event classes, making them public API for the events module.
Proposed Change Event Classes
backend/infrahub/events/proposed_change_action.py
Introduced a new module defining a hierarchy of event classes for proposed change actions, including base and specialized event types for reviews, merges, and review requests.
GraphQL Event Types and Mapping
backend/infrahub/graphql/types/event.py
Added four new GraphQL ObjectTypes for proposed change events and updated the event type mapping to include six new event names.
Review Mutation Event Emission
backend/infrahub/graphql/mutations/proposed_change.py
Modified the review mutation to emit and send appropriate proposed change event objects after review actions.
Merge Task Event Emission
backend/infrahub/proposed_change/tasks.py
Added logic to emit a ProposedChangeMergedEvent after a successful merge in the merge task flow.
Task Manager Event Data
backend/infrahub/task_manager/event.py
Added methods to extract proposed change event metadata and integrated them into event-specific data returns for new event types.
Event Query Helper
backend/tests/helpers/events.py
Added a helper function to query events by name using Prefect client and event filters.
Functional Review Event Tests
backend/tests/functional/proposed_change/test_review.py
Enhanced review tests to verify Prefect event emission after review actions, adding fixtures and async event assertion logic.
Documentation
docs/docs/reference/infrahub-events.mdx
Added a new section documenting six proposed change event types, including event keys and descriptions.
Changelog
changelog/+ifc1633.added.md
Added a changelog entry noting the introduction of proposed change review and merge events.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GraphQL API
    participant Event Service
    participant Prefect Events
    participant DB

    User->>GraphQL API: Submit review/merge mutation
    GraphQL API->>DB: Update proposed change state/relationships
    GraphQL API->>Event Service: Emit ProposedChange*Event (with metadata)
    Event Service->>Prefect Events: Log event
    GraphQL API-->>User: Return mutation result
Loading

Estimated code review effort

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

Suggested reviewers

  • ajtmccarty
  • ogenstad

📜 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 388fa92 and 1986c59.

📒 Files selected for processing (11)
  • backend/infrahub/core/constants/__init__.py (1 hunks)
  • backend/infrahub/events/__init__.py (2 hunks)
  • backend/infrahub/events/proposed_change_action.py (1 hunks)
  • backend/infrahub/graphql/mutations/proposed_change.py (6 hunks)
  • backend/infrahub/graphql/types/event.py (2 hunks)
  • backend/infrahub/proposed_change/tasks.py (3 hunks)
  • backend/infrahub/task_manager/event.py (2 hunks)
  • backend/tests/functional/proposed_change/test_review.py (6 hunks)
  • backend/tests/helpers/events.py (2 hunks)
  • changelog/+ifc1633.added.md (1 hunks)
  • docs/docs/reference/infrahub-events.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • changelog/+ifc1633.added.md
  • backend/infrahub/events/init.py
  • backend/infrahub/proposed_change/tasks.py
  • backend/infrahub/core/constants/init.py
  • backend/tests/functional/proposed_change/test_review.py
  • backend/tests/helpers/events.py
  • backend/infrahub/graphql/mutations/proposed_change.py
  • backend/infrahub/task_manager/event.py
  • backend/infrahub/events/proposed_change_action.py
  • backend/infrahub/graphql/types/event.py
  • docs/docs/reference/infrahub-events.mdx
⏰ 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). (9)
  • GitHub Check: E2E-testing-version-upgrade / From 1.1.0
  • GitHub Check: backend-benchmark
  • GitHub Check: documentation
  • GitHub Check: backend-docker-integration
  • GitHub Check: validate-generated-documentation
  • GitHub Check: E2E-testing-playwright
  • GitHub Check: backend-tests-functional
  • GitHub Check: backend-tests-unit
  • GitHub Check: backend-tests-integration
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gma-20250722-ifc1633

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.
    • @coderabbitai modularize this function.
  • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @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.

@github-actions github-actions bot added the group/backend Issue related to the backend (API Server, Git Agent) label Jul 22, 2025
Copy link

codspeed-hq bot commented Jul 22, 2025

CodSpeed Performance Report

Merging #6875 will not alter performance

Comparing gma-20250722-ifc1633 (1986c59) with develop (d244563)

Summary

✅ 10 untouched benchmarks

@github-actions github-actions bot added the type/documentation Improvements or additions to documentation label Jul 22, 2025
@gmazoyer gmazoyer force-pushed the gma-20250722-ifc1633 branch 3 times, most recently from 9d1a42f to 5d84916 Compare July 28, 2025 07:21
Copy link
Contributor

@ogenstad ogenstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, though it would be nice with some tests where we send and query for the events afterwards.

@gmazoyer gmazoyer force-pushed the gma-20250722-ifc1633 branch 2 times, most recently from 9a6400e to ef6e955 Compare July 28, 2025 14:57
@gmazoyer gmazoyer marked this pull request as ready for review July 29, 2025 08:35
@gmazoyer gmazoyer requested review from a team as code owners July 29, 2025 08:35
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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)
docs/docs/reference/infrahub-events.mdx (1)

339-518: LGTM! Comprehensive documentation for proposed change events.

The documentation is thorough and follows the established format with detailed payload descriptions. All eight event types are properly covered with consistent structure and clear descriptions.

Consider organizing the events in alphabetical order within the "Proposed events" section for better readability and consistency with documentation standards.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0b78b35 and 3cd2633.

📒 Files selected for processing (10)
  • backend/infrahub/core/constants/__init__.py (1 hunks)
  • backend/infrahub/events/__init__.py (2 hunks)
  • backend/infrahub/events/proposed_change_action.py (1 hunks)
  • backend/infrahub/graphql/mutations/proposed_change.py (5 hunks)
  • backend/infrahub/graphql/types/event.py (2 hunks)
  • backend/infrahub/proposed_change/tasks.py (3 hunks)
  • backend/infrahub/task_manager/event.py (2 hunks)
  • backend/tests/functional/proposed_change/test_proposed_change_review.py (6 hunks)
  • backend/tests/helpers/events.py (2 hunks)
  • docs/docs/reference/infrahub-events.mdx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
backend/tests/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Place backend tests in backend/tests/

Files:

  • backend/tests/helpers/events.py
  • backend/tests/functional/proposed_change/test_proposed_change_review.py
backend/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Run backend tests with pytest or via invoke tasks

Files:

  • backend/tests/helpers/events.py
  • backend/infrahub/events/__init__.py
  • backend/infrahub/core/constants/__init__.py
  • backend/infrahub/proposed_change/tasks.py
  • backend/infrahub/graphql/mutations/proposed_change.py
  • backend/infrahub/graphql/types/event.py
  • backend/infrahub/events/proposed_change_action.py
  • backend/tests/functional/proposed_change/test_proposed_change_review.py
  • backend/infrahub/task_manager/event.py
docs/docs/reference/**/*.{md,mdx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Write reference documentation in docs/docs/reference/

Files:

  • docs/docs/reference/infrahub-events.mdx
docs/**/*.mdx

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Use Docusaurus markdown/MDX features in documentation

Files:

  • docs/docs/reference/infrahub-events.mdx
docs/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Develop documentation in docs/, preview with invoke docs.build docs.serve, and validate with invoke docs.validate

Files:

  • docs/docs/reference/infrahub-events.mdx
🧠 Learnings (1)
docs/docs/reference/infrahub-events.mdx (1)

Learnt from: CR
PR: opsmill/infrahub#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-22T08:13:56.198Z
Learning: Documentation generated for Infrahub must reflect its novel approach, providing clarity around new concepts and demonstrating integration with familiar patterns from existing tools like Git, infrastructure-as-code, and CI/CD pipelines

⏰ 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 (26)
backend/tests/helpers/events.py (2)

5-6: LGTM: Clean import addition

The import statement correctly adds EventNameFilter alongside existing event filter imports.


56-62: LGTM: Well-implemented event query helper

The query_events_by_name function follows the established pattern from query_event and provides a clean interface for querying events by name. The implementation correctly:

  • Uses EventNameFilter for filtering by event name
  • Handles the POST request to /events/filter endpoint
  • Validates the response and returns typed Event objects
  • Maintains consistency with existing helper functions
backend/infrahub/core/constants/__init__.py (1)

64-69: LGTM: Well-structured event type constants

The new proposed change event type constants follow the established naming conventions and patterns:

  • Consistent use of EVENT_NAMESPACE prefix
  • Clear, descriptive names that align with the proposed change lifecycle
  • Proper ordering and grouping with related constants

The constants cover all the key proposed change actions mentioned in the PR objectives.

backend/infrahub/events/__init__.py (2)

6-13: LGTM: Clean module import organization

The import statement for proposed change action events is well-organized, grouping all related event classes together in a clear, readable format.


32-37: LGTM: Proper public API exposure

All imported proposed change event classes are correctly added to __all__, ensuring they're properly exposed as part of the module's public API.

backend/infrahub/proposed_change/tasks.py (3)

46-46: LGTM: Appropriate import addition

The NodeManager import is needed for retrieving user information for the merge event.


55-55: LGTM: Event-related imports

The imports for EventMeta and ProposedChangeMergedEvent are correctly added to support the new event emission functionality.


210-223: LGTM: Well-implemented merge event emission

The event emission code is properly structured:

  • Retrieves the current user using the appropriate NodeManager method
  • Creates a comprehensive ProposedChangeMergedEvent with all relevant fields
  • Uses EventMeta.from_context() for proper event metadata
  • Sends the event through the event service
  • Positioned correctly after successful merge state transition
  • Will be covered by existing error handling

The implementation follows established patterns and provides good event tracking for proposed change merges.

backend/infrahub/task_manager/event.py (2)

175-185: LGTM: Well-structured reviewer info extraction methods

The three new private methods follow the established pattern for event data extraction:

  • Use descriptive method names and return clear dictionary structures
  • Employ safe self.resource.get() calls to avoid KeyError exceptions
  • Return consistent data formats that align with GraphQL schema expectations
  • Maintain separation of concerns by splitting reviewer info, current decision, and former decision

207-216: LGTM: Appropriate event-specific data handling

The new match cases properly handle proposed change review events:

  • Correctly differentiate between approval/rejection events and revocation events
  • Use dictionary unpacking to combine reviewer information with relevant decision data
  • Follow the established pattern for other event types in the match statement
  • Provide the right data context for each event type (current decision vs former decision)
backend/infrahub/graphql/mutations/proposed_change.py (4)

19-25: LGTM! Event imports are well-structured.

The imported event classes follow proper naming conventions and the EventMeta import enables proper event metadata handling.


38-42: LGTM! Type imports properly structured.

The type imports are correctly placed within the TYPE_CHECKING block to avoid circular imports while maintaining type safety.


272-286: LGTM! Context parameter addition is appropriate.

Adding the context parameter enables proper event metadata creation from the GraphQL context, which is essential for the event system integration.


293-371: LGTM! Event creation and dispatching logic is well-implemented.

The event creation follows excellent patterns:

  • Proper use of EventMeta from context
  • Comprehensive event data including all relevant proposed change and reviewer details
  • Appropriate event class selection for each decision type
  • Correct async event service usage with conditional sending
backend/infrahub/graphql/types/event.py (2)

116-137: LGTM! GraphQL event types are well-structured.

The new ObjectTypes properly implement the EventNodeInterface with descriptive fields for reviewer information and decisions. The separation between review and revoked events is logical and clear.


189-192: LGTM! Event type mapping is logical and consistent.

The mapping correctly associates approval/rejection events with the review event type, and revocation events with the revoked event type, reflecting their different data structures appropriately.

backend/tests/functional/proposed_change/test_proposed_change_review.py (7)

3-22: LGTM! Test imports are appropriate for event verification.

The new imports support the event verification functionality with proper async patterns and type annotations.


48-51: LGTM! Prefect client fixture is well-implemented.

The fixture uses proper async patterns with context manager and appropriate scope for efficient test execution.


53-60: LGTM! Event assertion method with reasonable retry logic.

The polling approach with 10 retries and 1-second intervals provides good balance between test reliability and execution time. The clear failure message aids debugging.


111-112: LGTM! Event assertion for approval action is properly placed.

The event verification occurs after the approval mutation with the correct event name.


133-134: LGTM! Event assertion for rejection action is properly placed.

The event verification occurs after the rejection mutation with the correct event name.


195-196: LGTM! Event assertion for approval revocation is properly placed.

The event verification occurs after the cancel approve mutation with the correct event name.


257-258: LGTM! Event assertion for rejection revocation is properly placed.

The event verification occurs after the cancel reject mutation with the correct event name.

backend/infrahub/events/proposed_change_action.py (3)

9-21: LGTM! Well-designed base event class.

The ProposedChangeEvent base class properly extends InfrahubEvent with common fields and standardized resource dictionary format. Field descriptions enhance documentation.


23-51: LGTM! Well-structured specialized event classes.

The ProposedChangeReviewEvent and ProposedChangeReviewRevokedEvent classes properly extend the base class with relevant fields and correctly override get_resource to include branch context.


53-113: LGTM! Excellent inheritance hierarchy and event class structure.

The concrete event classes demonstrate good design with:

  • Proper ClassVar usage for event names with consistent namespace
  • Logical inheritance from appropriate parent classes
  • Clear separation between review events (with decision) and revoked events (with former_decision)
  • Comprehensive field coverage for all event types

@gmazoyer gmazoyer force-pushed the gma-20250722-ifc1633 branch from d6e0435 to 8be3bb6 Compare July 29, 2025 12:18
@gmazoyer gmazoyer force-pushed the gma-20250722-ifc1633 branch 3 times, most recently from 7cfedf6 to aa75a45 Compare July 30, 2025 15:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7cfedf6 and aa75a45.

📒 Files selected for processing (11)
  • backend/infrahub/core/constants/__init__.py (1 hunks)
  • backend/infrahub/events/__init__.py (2 hunks)
  • backend/infrahub/events/proposed_change_action.py (1 hunks)
  • backend/infrahub/graphql/mutations/proposed_change.py (5 hunks)
  • backend/infrahub/graphql/types/event.py (2 hunks)
  • backend/infrahub/proposed_change/tasks.py (3 hunks)
  • backend/infrahub/task_manager/event.py (2 hunks)
  • backend/tests/functional/proposed_change/test_proposed_change_review.py (6 hunks)
  • backend/tests/helpers/events.py (2 hunks)
  • changelog/+ifc1633.added.md (1 hunks)
  • docs/docs/reference/infrahub-events.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • changelog/+ifc1633.added.md
  • backend/tests/helpers/events.py
  • backend/infrahub/events/init.py
  • backend/infrahub/core/constants/init.py
  • backend/tests/functional/proposed_change/test_proposed_change_review.py
  • backend/infrahub/task_manager/event.py
  • backend/infrahub/proposed_change/tasks.py
  • docs/docs/reference/infrahub-events.mdx
  • backend/infrahub/events/proposed_change_action.py
  • backend/infrahub/graphql/types/event.py
🧰 Additional context used
📓 Path-based instructions (1)
backend/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Run backend tests with pytest or via invoke tasks

Files:

  • backend/infrahub/graphql/mutations/proposed_change.py
⏰ 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: documentation
  • GitHub Check: validate-generated-documentation
  • GitHub Check: backend-docker-integration
  • GitHub Check: backend-tests-integration
  • GitHub Check: backend-tests-unit
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (4)
backend/infrahub/graphql/mutations/proposed_change.py (4)

19-25: LGTM! Well-organized imports for event functionality.

The new imports are properly organized and align with the event integration requirements. Event classes are imported from the appropriate module, and type imports are correctly placed within the TYPE_CHECKING block.

Also applies to: 30-30, 38-42


272-272: LGTM! Proper context propagation for event handling.

The method signature change correctly propagates the GraphQL context to enable event metadata extraction and dispatching. The parameter naming follows existing conventions.

Also applies to: 285-285


293-294: LGTM! Proper event metadata extraction.

The event variable initialization and metadata extraction from the GraphQL context is implemented correctly.


304-312: LGTM! Consistent event creation pattern across all decision types.

The event creation logic follows a consistent pattern across all four decision types with appropriate event parameters. The event data includes all necessary information for tracking proposed change review actions.

Also applies to: 321-329, 338-346, 355-363

@gmazoyer gmazoyer force-pushed the gma-20250722-ifc1633 branch from aa75a45 to 3aab420 Compare July 31, 2025 08:53
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

♻️ Duplicate comments (1)
backend/infrahub/task_manager/event.py (1)

235-246: Implementation covers all required proposed change event types.

The implementation correctly handles all the proposed change event types mentioned in the PR objectives:

  • approved and rejected events include both user info and current decision
  • approval_revoked and rejection_revoked events include both user info and former decision
  • review_requested and merged events include only user info

This addresses the previous review comment about required event types - all necessary event types are now handled appropriately.

🧹 Nitpick comments (1)
backend/infrahub/task_manager/event.py (1)

175-207: Consider handling multiple related resources.

The method currently processes only the first matching resource with role "infrahub.related.node" due to the continue statement. If there are multiple related nodes, only the first one will be processed and subsequent ones will be ignored.

Consider whether this is the intended behavior or if all matching resources should be processed.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3aab420 and d768cce.

📒 Files selected for processing (2)
  • backend/infrahub/events/proposed_change_action.py (1 hunks)
  • backend/infrahub/task_manager/event.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/infrahub/events/proposed_change_action.py
🧰 Additional context used
📓 Path-based instructions (1)
backend/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Run backend tests with pytest or via invoke tasks

Files:

  • backend/infrahub/task_manager/event.py
⏰ 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 (2)
backend/infrahub/task_manager/event.py (2)

209-210: LGTM!

Simple and focused method that correctly extracts the reviewer decision from the main resource.


212-213: LGTM!

Consistent with the previous method and correctly extracts the former reviewer decision.

@gmazoyer gmazoyer force-pushed the gma-20250722-ifc1633 branch from d768cce to 388fa92 Compare July 31, 2025 15:18
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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)
backend/tests/functional/proposed_change/test_review.py (1)

41-48: Consider event count flexibility for robustness.

The event assertion logic is well-implemented with proper retry handling. However, the strict check for exactly 1 event (len(events) == 1) might be fragile if duplicate events are legitimately emitted or if test isolation isn't perfect.

Consider whether checking for len(events) >= 1 would be more robust, unless the exact count verification is specifically required for test correctness.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d768cce and 388fa92.

📒 Files selected for processing (11)
  • backend/infrahub/core/constants/__init__.py (1 hunks)
  • backend/infrahub/events/__init__.py (2 hunks)
  • backend/infrahub/events/proposed_change_action.py (1 hunks)
  • backend/infrahub/graphql/mutations/proposed_change.py (6 hunks)
  • backend/infrahub/graphql/types/event.py (2 hunks)
  • backend/infrahub/proposed_change/tasks.py (3 hunks)
  • backend/infrahub/task_manager/event.py (2 hunks)
  • backend/tests/functional/proposed_change/test_review.py (6 hunks)
  • backend/tests/helpers/events.py (2 hunks)
  • changelog/+ifc1633.added.md (1 hunks)
  • docs/docs/reference/infrahub-events.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • changelog/+ifc1633.added.md
  • backend/infrahub/core/constants/init.py
  • backend/infrahub/events/init.py
  • backend/infrahub/proposed_change/tasks.py
  • backend/tests/helpers/events.py
  • backend/infrahub/graphql/mutations/proposed_change.py
  • backend/infrahub/task_manager/event.py
  • docs/docs/reference/infrahub-events.mdx
  • backend/infrahub/events/proposed_change_action.py
  • backend/infrahub/graphql/types/event.py
🧰 Additional context used
📓 Path-based instructions (2)
backend/tests/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Place backend tests in backend/tests/

Files:

  • backend/tests/functional/proposed_change/test_review.py
backend/**/*

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Run backend tests with pytest or via invoke tasks

Files:

  • backend/tests/functional/proposed_change/test_review.py
⏰ 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). (9)
  • GitHub Check: E2E-testing-version-upgrade / From 1.1.0
  • GitHub Check: backend-benchmark
  • GitHub Check: E2E-testing-playwright
  • GitHub Check: backend-docker-integration
  • GitHub Check: backend-tests-functional
  • GitHub Check: validate-generated-documentation
  • GitHub Check: backend-tests-unit
  • GitHub Check: documentation
  • GitHub Check: backend-tests-integration
🔇 Additional comments (3)
backend/tests/functional/proposed_change/test_review.py (3)

3-3: LGTM! Imports are appropriate for event verification functionality.

The new imports properly support the Prefect event verification functionality being added to the tests.

Also applies to: 8-9, 18-18, 21-21


36-39: LGTM! Well-implemented async fixture.

The fixture properly uses an async context manager for resource cleanup and has appropriate class-level scoping for reuse across test methods.


56-56: LGTM! Event assertions properly verify the new event system.

The event assertions are well-integrated into the existing test flow:

  • Correct event names matching the PR objectives
  • Proper placement after business logic verification
  • Good coverage of all review actions (approve, reject, revoke)
  • Non-intrusive integration with existing test structure

Also applies to: 99-100, 122-122, 130-130, 183-184, 192-192, 245-246

@gmazoyer gmazoyer requested a review from ogenstad July 31, 2025 15:58
@gmazoyer gmazoyer force-pushed the gma-20250722-ifc1633 branch from 388fa92 to 1986c59 Compare August 1, 2025 08:19
@gmazoyer gmazoyer merged commit dafabdc into develop Aug 1, 2025
35 checks passed
@gmazoyer gmazoyer deleted the gma-20250722-ifc1633 branch August 1, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent) type/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants