refactor: rename AlertSourcePlatformEC2 to AlertSourcePlatformHost fo…#599
refactor: rename AlertSourcePlatformEC2 to AlertSourcePlatformHost fo…#599
Conversation
…r consistency in runtime alert validation
📝 WalkthroughWalkthroughRenames the enum value Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@armotypes/runtimeincidents.go`:
- Around line 29-33: The public constant was renamed (e.g.,
AlertSourcePlatformUnknown / AlertSourcePlatformK8s / AlertSourcePlatformHost /
AlertSourcePlatformCloud) which breaks downstream users; restore backwards
compatibility by adding deprecated exported aliases that point to the new
constants (for example declare the old exported names as equal to
AlertSourcePlatformUnknown, AlertSourcePlatformK8s, etc.), mark them with a
deprecation comment, and keep the original constants unchanged so existing
clients continue to compile while you transition usages.
🧹 Nitpick comments (1)
armotypes/runtimeincidents_validation_test.go (1)
11-17: Rename the test case label to match “Host”.The string still says “ec2”, which is now misleading.
✏️ Suggested tweak
- { - name: "ruleID required for ec2", + { + name: "ruleID required for host", alert: RuntimeAlert{ AlertSourcePlatform: AlertSourcePlatformHost, }, wantErr: true, },
| const ( | ||
| AlertSourcePlatformUnknown AlertSourcePlatform = iota | ||
| AlertSourcePlatformK8s | ||
| AlertSourcePlatformEC2 | ||
| AlertSourcePlatformHost | ||
| AlertSourcePlatformCloud |
There was a problem hiding this comment.
Preserve backwards compatibility for the renamed exported constant.
This is a public API rename and will break downstream builds. Consider adding a deprecated alias so existing clients keep compiling while you transition docs/usages.
♻️ Proposed compatibility alias
const (
AlertSourcePlatformUnknown AlertSourcePlatform = iota
AlertSourcePlatformK8s
AlertSourcePlatformHost
AlertSourcePlatformCloud
+ // Deprecated: use AlertSourcePlatformHost.
+ AlertSourcePlatformEC2 AlertSourcePlatform = AlertSourcePlatformHost
)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const ( | |
| AlertSourcePlatformUnknown AlertSourcePlatform = iota | |
| AlertSourcePlatformK8s | |
| AlertSourcePlatformEC2 | |
| AlertSourcePlatformHost | |
| AlertSourcePlatformCloud | |
| const ( | |
| AlertSourcePlatformUnknown AlertSourcePlatform = iota | |
| AlertSourcePlatformK8s | |
| AlertSourcePlatformHost | |
| AlertSourcePlatformCloud | |
| // Deprecated: use AlertSourcePlatformHost. | |
| AlertSourcePlatformEC2 AlertSourcePlatform = AlertSourcePlatformHost | |
| ) |
🤖 Prompt for AI Agents
In `@armotypes/runtimeincidents.go` around lines 29 - 33, The public constant was
renamed (e.g., AlertSourcePlatformUnknown / AlertSourcePlatformK8s /
AlertSourcePlatformHost / AlertSourcePlatformCloud) which breaks downstream
users; restore backwards compatibility by adding deprecated exported aliases
that point to the new constants (for example declare the old exported names as
equal to AlertSourcePlatformUnknown, AlertSourcePlatformK8s, etc.), mark them
with a deprecation comment, and keep the original constants unchanged so
existing clients continue to compile while you transition usages.
…r consistency in runtime alert validation
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.