feat: add IncidentClassificationRequestTopic constant#104
Conversation
Signed-off-by: Ben <ben@armosec.io>
📝 WalkthroughWalkthroughA new Pulsar topic constant Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pulsar/common/topics.go`:
- Around line 56-58: The new constant IncidentClassificationRequestTopic is
defined but never wired into messaging; add a producer and a consumer that use
BuildPersistentTopic(...) with IncidentClassificationRequestTopic to construct
the full topic name, implement a producer (e.g., in the existing producer
factory or Pulsar producer registration code) that publishes classification
requests to BuildPersistentTopic(IncidentClassificationRequestTopic), and
implement a consumer (e.g., in the subscriber/consumer setup code) that
subscribes to BuildPersistentTopic(IncidentClassificationRequestTopic) and
routes received messages to the existing incident classification handler; ensure
the producer/consumer follow the same configuration, error handling, and metrics
conventions used by other topics in the codebase (reuse existing
producer/consumer setup helpers).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| // incident classification topics | ||
| IncidentClassificationRequestTopic = "incident-classification-request-v1" | ||
| ) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find all usages of the new constant
rg -n --hidden --glob '!**/vendor/**' 'IncidentClassificationRequestTopic' .
# Also sanity-check for the raw topic string to catch any hard-coded mismatches
rg -n --hidden --glob '!**/vendor/**' 'incident-classification-request-v1' .Repository: kubescape/messaging
Length of output: 271
🏁 Script executed:
# Check the recent changes around this constant and look for any producer/consumer implementation
cd pulsar/common && head -n 80 topics.go | tail -n 40
# Also check if there are any recent changes in producer/consumer files
fd -t f -e go | grep -i -E '(producer|consumer|classifier)' | head -20Repository: kubescape/messaging
Length of output: 1487
🏁 Script executed:
# Search for any files that might contain producer/consumer logic
fd -t f -e go | xargs rg -l 'incident|classify' --max-count=5
# Check if there are any references to incident classification in other ways
rg -n 'incident.*classif|classif.*incident' --ignore-caseRepository: kubescape/messaging
Length of output: 323
🏁 Script executed:
# Check the files that mention incident/classify for any integration wiring
rg -A 5 -B 5 'incident.*classif|classif.*incident' --ignore-case -t go pulsar/common/userinput/commands.go pulsar/common/kdr/datastructures.go
# Also check if the constant is used anywhere via string matching on producer/consumer patterns
rg -n 'NewProducer|NewConsumer|Subscribe|Produce' -t go | grep -i -E '(incident|classif)' || echo "No matches found"
# Look for any recent code that constructs topics similar to how this constant should be used
rg -n 'BuildPersistentTopic|BuildTopic' -t go | head -20Repository: kubescape/messaging
Length of output: 1104
🏁 Script executed:
# Let's examine the files that mention incident/classify to understand context
cat -n pulsar/common/userinput/commands.go | grep -A 10 -B 5 -i 'incident\|classif'
# Check kdr/datastructures.go as well
cat -n pulsar/common/kdr/datastructures.go | grep -A 10 -B 5 -i 'incident\|classif'Repository: kubescape/messaging
Length of output: 4644
Integration wiring for IncidentClassificationRequestTopic is not yet implemented in the codebase.
The constant is defined in pulsar/common/topics.go:57, but no producer or consumer implementations exist. Ensure producer and consumer code are added with proper topic construction using BuildPersistentTopic(...) before deploying this constant.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@pulsar/common/topics.go` around lines 56 - 58, The new constant
IncidentClassificationRequestTopic is defined but never wired into messaging;
add a producer and a consumer that use BuildPersistentTopic(...) with
IncidentClassificationRequestTopic to construct the full topic name, implement a
producer (e.g., in the existing producer factory or Pulsar producer registration
code) that publishes classification requests to
BuildPersistentTopic(IncidentClassificationRequestTopic), and implement a
consumer (e.g., in the subscriber/consumer setup code) that subscribes to
BuildPersistentTopic(IncidentClassificationRequestTopic) and routes received
messages to the existing incident classification handler; ensure the
producer/consumer follow the same configuration, error handling, and metrics
conventions used by other topics in the codebase (reuse existing
producer/consumer setup helpers).
|
Summary:
|
Adds
IncidentClassificationRequestTopicconstant for the incident AI classification Pulsar topic, used by cadashboardbe's reclassify-ai endpoint.Summary by CodeRabbit