Skip to content

Inhibition rules#409

Open
tansdf wants to merge 25 commits intodevelopfrom
inhibition-rules
Open

Inhibition rules#409
tansdf wants to merge 25 commits intodevelopfrom
inhibition-rules

Conversation

@tansdf
Copy link
Collaborator

@tansdf tansdf commented Jan 28, 2026

  • Introduced InhibitionManager to manage inhibition rules and track source/target incidents.
  • Added InhibitRule model for defining inhibition rules in configuration.
  • Enhanced Incident class to support inhibition-related properties and methods.
  • Updated AsyncQueueManager and related handlers to integrate inhibition management.
  • Refactored setup_sighup_handler to reload inhibition rules on configuration changes.
  • Improved test coverage for queue management and inhibition handling.

- Introduced InhibitionManager to manage inhibition rules and track source/target incidents.
- Added InhibitRule model for defining inhibition rules in configuration.
- Enhanced Incident class to support inhibition-related properties and methods.
- Updated AsyncQueueManager and related handlers to integrate inhibition management.
- Refactored setup_sighup_handler to reload inhibition rules on configuration changes.
- Improved test coverage for queue management and inhibition handling.
… on inhibition state. This change ensures that chain functionality is only disabled when the incident is not unfrozen due to inhibition.
- Introduced mock InhibitionManager in various test cases to improve testing of incident handling.
- Updated AlertHandler, StatusUpdateHandler, and StatusCheckHandler to utilize the new mock for better simulation of inhibition logic.
- Enhanced create_mock_incident_for_handlers to include frozen_by_inhibition property for more accurate incident state representation.
- Improved test coverage for handlers by ensuring they correctly initialize with the mock InhibitionManager.
…ger classes

- Introduced comprehensive test cases for the new inhibition features in the Incident class, including freezing and unfreezing incidents based on inhibition.
- Added tests for the InhibitionManager class to validate the processing of incidents and the enforcement of inhibition rules.
- Enhanced existing tests to cover scenarios involving inhibition-related fields and their serialization.
- Created a new test suite for InhibitionRule to ensure proper matching logic for source and target incidents.
- Improved test coverage for unfreeze handling, ensuring correct behavior for both time-based and inhibition-based unfreezes.
- Updated the Application class and its subclasses to include a new parameter, `frozen_by_inhibition`, in the `update_thread_payload` method, allowing for better handling of incidents frozen due to inhibition rules.
- Modified the action button configurations in Mattermost, Slack, and Telegram to display an "Inhibited" state when incidents are frozen by inhibition.
- Implemented logic in the `build_mattermost_actions` and `build_slack_actions` functions to conditionally render buttons based on the `frozen_by_inhibition` status.
- Enhanced the InhibitionManager to check if an incident would be inhibited, affecting thread creation in the messenger.
- Updated templates for status icons to reflect the new inhibition state, ensuring accurate representation in the UI.
- Improved logging for incident processing to include details about inhibition status during updates.
…n_by_inhibition` parameter

- Modified test cases in Mattermost and Slack applications to pass the new `frozen_by_inhibition` argument in the `update_thread_payload` method.
- Ensured that mock payload assertions reflect the updated method signature, maintaining test integrity and coverage for the inhibition functionality.
- Updated the AlertHandler class to include methods for regenerating incident chains and checking alert changes, improving the handling of incident states.
- Introduced logic to manage inhibition state changes and create threads for previously inhibited incidents, ensuring accurate incident processing.
- Refactored existing methods to streamline alert handling and improve clarity, while maintaining functionality for frozen incidents and alert notifications.
DiTsi and others added 17 commits February 2, 2026 16:43
- renamed target to target_matchers
- update Matcher regex
- Updated the Application class and its subclasses to include a new parameter, `frozen_by_inhibition`, in the `_create_thread_payload` method, allowing for better management of thread creation based on incident inhibition status.
- Modified the Mattermost and Slack applications to reflect the new parameter in their respective thread payload functions.
- Adjusted the Telegram application to incorporate the inhibition state in thread creation, ensuring consistent behavior across messaging platforms.
- Enhanced the `mattermost_get_create_thread_payload` and `slack_get_create_thread_payload` functions to conditionally display the status based on the `frozen_by_inhibition` flag.
- Improved the AlertHandler to create threads with the inhibition state, ensuring accurate incident processing and logging.
- Modified test cases in Mattermost and Slack applications to include the new `frozen_by_inhibition` parameter in the `_create_thread_payload` method.
- Updated mock payload assertions to match the revised method signatures, ensuring accurate testing of thread creation with inhibition support.
- Adjusted the InhibitionManager tests to utilize `source_matchers` and `target_matchers` for consistency in rule definitions.
- Added logic to delete the target from the queue by its unique ID when it is frozen by inhibition, ensuring proper management of the inhibition state.
- Modified multiple test cases to incorporate the mock_queue parameter, ensuring that the deletion of chain steps for targets is properly asserted when incidents are frozen.
- Enhanced assertions to verify that the queue's delete_by_id method is called with the correct parameters, maintaining accurate testing of the inhibition functionality.
- Introduced methods in JinjaTemplate to set incidents and build incident data, allowing templates to resolve parent and child incident relationships.
- Updated the form_message and render methods to utilize the new incident data structure.
- Enhanced tests to verify the correct resolution of parent and child incidents in template rendering, ensuring robust functionality and error handling for non-serializable incidents.
…spec

- Updated test cases to utilize a MockIncident class that adheres to the Incident specification, enhancing test reliability.
- Adjusted the mock incident setup to include serialization and properties for parents and children, ensuring accurate representation in template rendering.
- Improved clarity and maintainability of tests by consolidating mock logic.
- Removed redundant check for inhibition before processing incidents, ensuring that all incidents are processed consistently.
- Updated logging to reflect the creation of incidents without unnecessary duplication of processing logic.
- Modified Mattermost and Slack thread action builders to set the `chain_style` to 'default' and 'normal' respectively when `frozen_by_inhibition` is true, ensuring consistent visual representation of inhibited threads.
- Enhanced error logging in the AsyncQueueManager to include error details in a structured format, improving debugging capabilities.
- Deleted the test_client_creation method as it was deemed unnecessary for the current test suite, streamlining the test code and improving maintainability.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 5, 2026

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