Skip to content

Pass alert platform to RuleFailureCreator#731

Merged
matthyx merged 1 commit intomainfrom
alert-platform
Feb 27, 2026
Merged

Pass alert platform to RuleFailureCreator#731
matthyx merged 1 commit intomainfrom
alert-platform

Conversation

@matthyx
Copy link
Contributor

@matthyx matthyx commented Feb 27, 2026

Update github.com/armosec/armoapi-go to v0.0.678.

Pass AlertSourcePlatform to the constructor instead of hardcoding AlertSourcePlatformK8s. Set the value to AlertSourcePlatformK8sAgent.

Summary by CodeRabbit

  • Dependencies

    • Updated Armosec armoapi-go dependency version
  • Improvements

    • Enhanced alert platform configuration to dynamically support different source environments

Update github.com/armosec/armoapi-go to v0.0.678.

Pass AlertSourcePlatform to the constructor instead of hardcoding
AlertSourcePlatformK8s. Set the value to AlertSourcePlatformK8sAgent.
@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

📝 Walkthrough

Walkthrough

The pull request updates the armoapi-go dependency and refactors RuleFailureCreator to accept an alertPlatform parameter, enabling platform configuration through dependency injection instead of using a hard-coded value.

Changes

Cohort / File(s) Summary
Dependency Update
go.mod
Bumped armoapi-go from v0.0.672 to v0.0.678.
Rule Manager Refactoring
pkg/rulemanager/rule_manager.go, pkg/rulemanager/ruleadapters/creator.go
Added alertPlatform parameter to RuleFailureCreator initialization chain; new struct field stores platform value for use in CreateRuleFailure, replacing hard-coded constant.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

release

Suggested reviewers

  • amirmalka

Poem

🐰 Hops with glee through parameter lanes,
Alerting platforms now flow through veins,
No more hard-coded, rigid and tight,
Dependency injection makes configs just right!

🚥 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 'Pass alert platform to RuleFailureCreator' directly and clearly describes the main change: passing an alert platform parameter to the RuleFailureCreator constructor instead of hardcoding it.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch alert-platform

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

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.

🧹 Nitpick comments (2)
pkg/rulemanager/rule_manager.go (1)

9-10: Redundant imports of the same package.

Both armotypes (line 9) and apitypes (line 10) alias the same package. Consider using one consistent name.

♻️ Suggested fix: use one consistent import alias
 import (
 	"context"
 	"crypto/md5"
 	"fmt"
 	"time"

 	"github.com/armosec/armoapi-go/armotypes"
-	apitypes "github.com/armosec/armoapi-go/armotypes"

Then update line 84 to use armotypes.AlertSourcePlatformK8sAgent instead of apitypes.AlertSourcePlatformK8sAgent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/rulemanager/rule_manager.go` around lines 9 - 10, Remove the duplicate
import alias (apitypes) and keep a single import name (armotypes) for the
armosec package, then update all usages that reference apitypes (e.g., change
apitypes.AlertSourcePlatformK8sAgent to armotypes.AlertSourcePlatformK8sAgent)
in rule_manager.go; ensure there are no other remaining references to apitypes
and run `go build` to validate the import cleanup.
pkg/rulemanager/ruleadapters/creator.go (1)

11-12: Redundant imports of the same package.

Both armotypes and apitypes alias the same package github.com/armosec/armoapi-go/armotypes. Consider using a single consistent name throughout the file.

♻️ Suggested fix: use one consistent import alias
 import (
 	"errors"
 	"fmt"
 	"os"
 	"path/filepath"
 	"reflect"
 	"time"

-	"github.com/armosec/armoapi-go/armotypes"
-	apitypes "github.com/armosec/armoapi-go/armotypes"
+	"github.com/armosec/armoapi-go/armotypes"

Then update all apitypes. references to armotypes. throughout the file.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/rulemanager/ruleadapters/creator.go` around lines 11 - 12, The file
imports the same package twice as both armotypes and apitypes; remove the
duplicate import (keep a single import alias, e.g., armotypes) and update all
occurrences of the apitypes identifier to armotypes across this file (search for
apitypes. and replace with armotypes.). Ensure only the single import
"github.com/armosec/armoapi-go/armotypes" remains in the import block and that
any functions/types referenced (e.g., apitypes.Whatever) now use
armotypes.Whatever.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/rulemanager/rule_manager.go`:
- Around line 9-10: Remove the duplicate import alias (apitypes) and keep a
single import name (armotypes) for the armosec package, then update all usages
that reference apitypes (e.g., change apitypes.AlertSourcePlatformK8sAgent to
armotypes.AlertSourcePlatformK8sAgent) in rule_manager.go; ensure there are no
other remaining references to apitypes and run `go build` to validate the import
cleanup.

In `@pkg/rulemanager/ruleadapters/creator.go`:
- Around line 11-12: The file imports the same package twice as both armotypes
and apitypes; remove the duplicate import (keep a single import alias, e.g.,
armotypes) and update all occurrences of the apitypes identifier to armotypes
across this file (search for apitypes. and replace with armotypes.). Ensure only
the single import "github.com/armosec/armoapi-go/armotypes" remains in the
import block and that any functions/types referenced (e.g., apitypes.Whatever)
now use armotypes.Whatever.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0d8b1d and ad74b9e.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (3)
  • go.mod
  • pkg/rulemanager/rule_manager.go
  • pkg/rulemanager/ruleadapters/creator.go

@matthyx matthyx merged commit 107f7a4 into main Feb 27, 2026
26 of 27 checks passed
@matthyx matthyx deleted the alert-platform branch February 27, 2026 14:00
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