Skip to content

RHINENG-26119: add support for publishing advisory update events#2224

Draft
katarinazaprazna wants to merge 1 commit into
RedHatInsights:masterfrom
katarinazaprazna:evaluator-emits-advisory-events
Draft

RHINENG-26119: add support for publishing advisory update events#2224
katarinazaprazna wants to merge 1 commit into
RedHatInsights:masterfrom
katarinazaprazna:evaluator-emits-advisory-events

Conversation

@katarinazaprazna
Copy link
Copy Markdown
Collaborator

@katarinazaprazna katarinazaprazna commented Jun 4, 2026

Summary

  • Evaluator publishes advisory delta events to patchman.advisory.update Kafka topic after each system evaluation
  • Only changed advisories (Add, Update, Remove) are included in the payload, unchanged (Keep) are filtered out
  • Feature is gated by advisory_updates pod config flag, disabled by default
  • Existing advisory writes and instant notifications are unaffected

Secure Coding Practices Checklist GitHub Link

Secure Coding Checklist

  • Input Validation
  • Output Encoding
  • Authentication and Password Management
  • Session Management
  • Access Control
  • Cryptographic Practices
  • Error Handling and Logging
  • Data Protection
  • Communication Security
  • System Configuration
  • Database Security
  • File Management
  • Memory Management
  • General Coding Practices

Summary by Sourcery

Add support for emitting advisory update events during evaluation when advisories change and the feature is enabled.

New Features:

  • Introduce advisory update Kafka events that carry changed advisory IDs per system, including workspace and timestamp metadata.

Enhancements:

  • Wire advisory update publishing into the evaluator with a feature flag and topic configuration, including Clowder topic translation and parameter printing.

Tests:

  • Add unit and integration-style tests covering advisory ID change detection, event construction, publishing behavior, and the no-delta case.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jun 4, 2026

Reviewer's Guide

Adds optional support for publishing advisory update Kafka events after evaluation, including configuration, publisher wiring, and tests for delta calculation and event emission.

File-Level Changes

Change Details Files
Introduce advisory update event publishing pipeline in evaluator.
  • Add feature flag and configuration wiring for advisory update publishing, including new evaluator toggle and Clowder topic configuration.
  • Initialize advisoryUpdatePublisher based on ADVISORY_UPDATE_TOPIC and integrate publishAdvisoryUpdates into evaluateAndStore guarded by the feature flag.
  • Implement helper functions to collect changed advisory IDs, build AdvisoryUpdateEvent (including workspace handling), and send messages via Kafka with metrics and logging.
evaluator/evaluate.go
evaluator/advisory_update.go
base/utils/config.go
deploy/clowdapp.yaml
Add tests covering advisory update behavior and refactor minor evaluator details.
  • Add unit tests for changed advisory ID extraction, event construction, full publish flow with DB-backed evaluation, and no-op behavior when there is no delta.
  • Use MockKafkaWriter for publisher injection in tests and ensure DB state is prepared/cleaned up around evaluation.
  • Fix typo in configureEvaluator function name and add funlen linter suppression around evaluateAndStore.
evaluator/advisory_update_test.go
evaluator/evaluate.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@katarinazaprazna katarinazaprazna force-pushed the evaluator-emits-advisory-events branch from ed405ba to 312e979 Compare June 4, 2026 02:45
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.00000% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.56%. Comparing base (cf25d8a) to head (312e979).

Files with missing lines Patch % Lines
evaluator/advisory_update.go 76.31% 4 Missing and 5 partials ⚠️
evaluator/evaluate.go 60.00% 3 Missing and 1 partial ⚠️
base/utils/config.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2224      +/-   ##
==========================================
+ Coverage   58.46%   58.56%   +0.09%     
==========================================
  Files         139      140       +1     
  Lines        8925     8973      +48     
==========================================
+ Hits         5218     5255      +37     
- Misses       3159     3166       +7     
- Partials      548      552       +4     
Flag Coverage Δ
unittests 58.56% <72.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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