Skip to content

Conversation

ic0ns
Copy link
Contributor

@ic0ns ic0ns commented Jun 26, 2025

Summary

  • Fixed AlertMessage.toCompactString() returning "Alert(null,null)" when fields are not set
  • Now uses config field as fallback for both level and description
  • Returns "not configured" instead of "null" for better clarity

Changes

  1. Modified AlertMessage.toCompactString() to check config field for both level and description when the respective fields are null
  2. Changed null values to display "not configured" for better logging output
  3. Added comprehensive unit tests covering all edge cases

Test plan

  • Added 8 unit tests in AlertMessageToCompactStringTest covering:
    • Null values with no config
    • Config fallback behavior
    • Explicit values taking precedence
    • Unknown alert types
    • Partial configurations
  • All tests pass
  • Code formatted with spotless

This fixes the issue where alert messages show as "Alert(null,null)" in log output before being prepared by AlertPreparator.

Previously, AlertMessage.toCompactString() would return "Alert(null,null)"
when the level and description fields were not set. This happened because
the method only checked the config field for description but not for level.

This commit:
- Updates toCompactString() to use config as fallback for both level and description
- Returns "not configured" instead of "null" when no values are available
- Adds comprehensive unit tests to verify the behavior

This provides better logging output before the message is prepared by the
AlertPreparator, resolving issue #212.
@ic0ns ic0ns changed the title Fix Alert(null,null) logging in AlertMessage toCompactString() - Fixes #212 [AI] Fix Alert(null,null) logging in AlertMessage toCompactString() - Fixes #212 Jun 26, 2025
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.

1 participant