Skip to content

RHINENG-25511: add ff to disable advisory_account_data update in eval… - #2344

Merged
MichaelMraka merged 1 commit into
RedHatInsights:masterfrom
MichaelMraka:pr1
Sep 24, 2026
Merged

MichaelMraka merged 1 commit into
RedHatInsights:masterfrom
MichaelMraka:pr1

Conversation

@MichaelMraka

@MichaelMraka MichaelMraka commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

…uator

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 a feature flag to disable legacy advisory account data updates during evaluation.

New Features:

  • Add a feature flag to control whether evaluator runs update legacy advisory account data counts.

Enhancements:

  • Allow advisory account data updates to be skipped without affecting advisory evaluation.
  • Add coverage confirming disabled updates preserve existing advisory account data.

Tests:

  • Update evaluator tests for the optional advisory account data update behavior.

@MichaelMraka
MichaelMraka requested a review from a team as a code owner September 24, 2026 11:15
@sourcery-ai

sourcery-ai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Introduces the advisory_account_data feature flag, enabled by default, to control legacy advisory account-data writes during evaluation; disabled mode exits before calculating or persisting changes and is covered by a database-backed regression test.

File-Level Changes

Change Details Files
Add a runtime feature flag to optionally skip legacy advisory account-data updates during evaluation.
  • Read the advisory_account_data pod configuration with a default of enabled.
  • Short-circuit update processing and log when the flag disables writes.
  • Add an integration test verifying existing account-data counts remain unchanged when disabled.
evaluator/evaluate.go
evaluator/evaluate_advisories.go
evaluator/evaluate_advisories_test.go
Update advisory event test fixtures to match the current event model defaults.
  • Remove the redundant empty patch fixture field.
evaluator/advisory_update_test.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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

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="evaluator/evaluate_advisories.go" line_range="420-423" />
<code_context>
 	system *models.SystemPlatformV2,
 	advisoriesByName extendedAdvisoryMap,
 ) error {
+	if !enableAdvisoryAccountData {
+		utils.LogInfo("inventoryID", system.GetInventoryID(), "advisory_account_data updates disabled, skipping")
+		return nil
+	}
+
 	changes := calcAdvisoryChanges(system, advisoriesByName)
</code_context>
<issue_to_address>
**issue (testing):** The new package-level flag defaults to false until `configureEvaluator` runs, so direct calls to `updateAdvisoryAccountData` in the existing database test now return without changing counts; `TestUpdateAdvisoryAccountData` consequently fails its expected 0/1 account-data assertions because the evaluator configuration is not initialized by the test suite.

**Triggers:** When evaluator tests invoke `updateAdvisoryAccountData` directly without calling `configureEvaluator`.

**Suggested fix:** Initialize the flag to its documented default (`true`) or explicitly enable it in tests that exercise the default update behavior.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and when the flag is disabled, advisory_account_data counts are not updated and can remain stale in the database. Reverting restores future updates, and the missed counts are bounded and can be repaired by rerunning the evaluation.

Blocking findings: evaluator/evaluate_advisories.go:423


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread evaluator/evaluate_advisories.go
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.92%. Comparing base (7e3de94) to head (0ae1104).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2344      +/-   ##
==========================================
- Coverage   58.94%   58.92%   -0.02%     
==========================================
  Files         150      150              
  Lines        9601     9605       +4     
==========================================
+ Hits         5659     5660       +1     
- Misses       3348     3351       +3     
  Partials      594      594              
Flag Coverage Δ
unittests 58.92% <100.00%> (-0.02%) ⬇️

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.

@MichaelMraka
MichaelMraka merged commit c35f705 into RedHatInsights:master Sep 24, 2026
7 of 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