Skip to content

Conversation

@Dugowitch
Copy link
Contributor

@Dugowitch Dugowitch commented Feb 4, 2026

This caused inconsistencies in dependant tables and culling will take care of proper removal later.

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

Bug Fixes:

  • Prevent data inconsistencies by ensuring stale systems are also migrated into system_inventory and system_patch tables.

@jira-linking
Copy link

jira-linking bot commented Feb 4, 2026

Referenced Jiras:
https://issues.redhat.com/browse/RHINENG-21214

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 4, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This migration update changes the data backfill logic to include stale systems when populating the new tables from system_platform, ensuring consistency with dependent tables and deferring removal of stale records to the culling process.

Entity relationship diagram for including stale systems in migration

erDiagram
    system_platform {
        int id
        boolean stale
        timestamp stale_timestamp
        timestamp stale_warning_timestamp
        timestamp culled_timestamp
        int template_id
        int applicable_advisory_bug_count_cache
        int applicable_advisory_sec_count_cache
    }

    system_inventory {
        int id
        timestamp stale_timestamp
        timestamp stale_warning_timestamp
        timestamp culled_timestamp
    }

    system_patch {
        int id
        int template_id
        int applicable_advisory_bug_count_cache
        int applicable_advisory_sec_count_cache
    }

    system_platform ||--o{ system_inventory : migrated_into
    system_platform ||--o{ system_patch : migrated_into

    %% Stale records are now also migrated; culling will later remove them
Loading

File-Level Changes

Change Details Files
Include stale systems when migrating data from system_platform into system_inventory.
  • Removed the WHERE sp.stale = false filter from the INSERT INTO system_inventory ... SELECT statement so that all systems, including stale ones, are migrated.
  • Kept all selected columns intact while broadening the source row set to match the full system_platform contents.
database_admin/migrations/142_split_system_platform.up.sql
Include stale systems when migrating data from system_platform into system_patch.
  • Removed the WHERE sp.stale = false filter from the INSERT INTO system_patch ... SELECT statement so that all systems, including stale ones, are migrated.
  • Maintained the existing column mappings while allowing stale systems to be present in system_patch, with cleanup delegated to culling.
database_admin/migrations/142_split_system_platform.up.sql

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

This caused inconsistencies in dependant tables and culling will take
care of proper removal later.
Copy link

@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 reviewed your changes and they look great!


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.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.39%. Comparing base (977c7cd) to head (cac4761).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2041   +/-   ##
=======================================
  Coverage   59.39%   59.39%           
=======================================
  Files         134      134           
  Lines        8678     8678           
=======================================
  Hits         5154     5154           
  Misses       2977     2977           
  Partials      547      547           
Flag Coverage Δ
unittests 59.39% <ø> (ø)

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.

@Dugowitch Dugowitch merged commit 9d5c5da into RedHatInsights:master Feb 4, 2026
8 checks passed
@Dugowitch Dugowitch deleted the fix1 branch February 4, 2026 09:16
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