Skip to content

Comments

refactor: rename AlertSourcePlatformEC2 to AlertSourcePlatformHost fo…#599

Merged
kooomix merged 1 commit intomainfrom
renameplatformhost
Jan 26, 2026
Merged

refactor: rename AlertSourcePlatformEC2 to AlertSourcePlatformHost fo…#599
kooomix merged 1 commit intomainfrom
renameplatformhost

Conversation

@kooomix
Copy link
Contributor

@kooomix kooomix commented Jan 26, 2026

…r consistency in runtime alert validation

Summary by CodeRabbit

Release Notes

  • Refactor
    • Improved platform environment detection to better identify non-cloud host configurations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

Renames the enum value AlertSourcePlatformEC2 to AlertSourcePlatformHost in the runtime incidents type definitions. Updates the GetAlertSourcePlatform function and validation logic to use the new enum value as the default for non-Kubernetes, non-cloud environments. Test cases updated accordingly.

Changes

Cohort / File(s) Summary
Enum renaming and default platform logic
armotypes/runtimeincidents.go
Renamed AlertSourcePlatformEC2 constant to AlertSourcePlatformHost. Updated GetAlertSourcePlatform to return AlertSourcePlatformHost as default. Updated validation switch-case to reference the renamed enum value.
Test updates
armotypes/runtimeincidents_validation_test.go
Updated test case assertion to use AlertSourcePlatformHost instead of AlertSourcePlatformEC2 in the rule validation test scenario.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 EC2 becomes Host, a name refined,
Where platforms dance and choices align,
From cloud-speak clear to something kind,
A rabbit's touch, more truth combined,
The defaults shift, the tests realigned! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: renaming AlertSourcePlatformEC2 to AlertSourcePlatformHost, which aligns with the changeset modifications across both source and test files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@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

🤖 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,
 		},

Comment on lines 29 to 33
const (
AlertSourcePlatformUnknown AlertSourcePlatform = iota
AlertSourcePlatformK8s
AlertSourcePlatformEC2
AlertSourcePlatformHost
AlertSourcePlatformCloud
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
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.

@kooomix kooomix merged commit a24ab86 into main Jan 26, 2026
4 checks passed
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