Skip to content

chore: remove InventoryID from AdvisoryUpdateEvent#2210

Merged
katarinazaprazna merged 1 commit into
RedHatInsights:masterfrom
katarinazaprazna:remove-inventory-id-from-advisory-update-events
May 25, 2026
Merged

chore: remove InventoryID from AdvisoryUpdateEvent#2210
katarinazaprazna merged 1 commit into
RedHatInsights:masterfrom
katarinazaprazna:remove-inventory-id-from-advisory-update-events

Conversation

@katarinazaprazna
Copy link
Copy Markdown
Collaborator

@katarinazaprazna katarinazaprazna commented May 25, 2026

  • This field is no longer required as part of the AdvisoryUpdateEvent structure
  • Updated tests accordingly
  • Added a TODO for future system context changes in notifications

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

Remove inventory identifier from advisory update events and update related tests and notification context documentation.

Enhancements:

  • Simplify AdvisoryUpdateEvent by dropping the now-unneeded InventoryID field from the payload.

Documentation:

  • Document future removal of per-system notification context after aggregator migration.

This field is no longer required as part of the AdvisoryUpdateEvent
structure. Updated tests accordingly. Added a TODO for future system
context changes in notifications.
@katarinazaprazna katarinazaprazna requested a review from a team as a code owner May 25, 2026 14:20
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 25, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Removes the now-unnecessary InventoryID field from AdvisoryUpdateEvent and its tests, while documenting a future plan to remove system-specific notification Context once aggregation is handled elsewhere.

File-Level Changes

Change Details Files
Remove InventoryID from AdvisoryUpdateEvent and update tests to match the new event shape.
  • Deleted the InventoryID field from the AdvisoryUpdateEvent struct and its JSON representation.
  • Updated AdvisoryUpdateEvent-related tests to stop setting InventoryID on test events.
  • Adjusted assertions in event marshal/write tests to no longer compare InventoryID values.
base/mqueue/advisory_update_event.go
base/mqueue/advisory_update_event_test.go
Document future removal of system-specific notification context for aggregated advisories.
  • Added a TODO above the notification Context type explaining that it will be removed after migration to the new aggregator component.
  • Linked the TODO to the tracking Jira RHINENG-26543 and clarified that advisories apply to multiple systems so system-specific context will be unnecessary for aggregated notifications.
base/notification/notification.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

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="base/mqueue/advisory_update_event_test.go" line_range="23" />
<code_context>
 	event := AdvisoryUpdateEvent{
 		RhAccountID: 1,
 		WorkspaceID: testWorkspaceID,
-		InventoryID: uuid.New(),
 		AdvisoryIDs: []int64{101, 202, 303},
 		ProducedAt:  testNow,
</code_context>
<issue_to_address>
**issue (testing):** Add a test that explicitly verifies `inventory_id` is no longer present in the marshaled JSON

The current tests only stop asserting on `InventoryID`; they don’t confirm the field is removed from the payload. Please add or extend a test (e.g., `TestAdvisoryUpdateEventMarshal`) that marshals the event, unmarshals into a `map[string]any` (or `map[string]json.RawMessage`), and asserts that the `"inventory_id"` key is absent to clearly validate this behavior.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

event := AdvisoryUpdateEvent{
RhAccountID: 1,
WorkspaceID: testWorkspaceID,
InventoryID: uuid.New(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (testing): Add a test that explicitly verifies inventory_id is no longer present in the marshaled JSON

The current tests only stop asserting on InventoryID; they don’t confirm the field is removed from the payload. Please add or extend a test (e.g., TestAdvisoryUpdateEventMarshal) that marshals the event, unmarshals into a map[string]any (or map[string]json.RawMessage), and asserts that the "inventory_id" key is absent to clearly validate this behavior.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.23%. Comparing base (e91c723) to head (a4bb52b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2210   +/-   ##
=======================================
  Coverage   59.23%   59.23%           
=======================================
  Files         137      137           
  Lines        8795     8795           
=======================================
  Hits         5210     5210           
  Misses       3037     3037           
  Partials      548      548           
Flag Coverage Δ
unittests 59.23% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Collaborator

@TenSt TenSt left a comment

Choose a reason for hiding this comment

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

lgtm!

@katarinazaprazna katarinazaprazna merged commit 7258ff8 into RedHatInsights:master May 25, 2026
8 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.

3 participants