Skip to content

fix(image): total count deduplication fix#1248

Open
tsim-sap wants to merge 1 commit into
mainfrom
tsim-sap/issue-1210/fix-image-list-total-count
Open

fix(image): total count deduplication fix#1248
tsim-sap wants to merge 1 commit into
mainfrom
tsim-sap/issue-1210/fix-image-list-total-count

Conversation

@tsim-sap

@tsim-sap tsim-sap commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

  • Related Issue # (issue)
  • Closes # (issue)
  • Fixes # (issue)

Remove if not applicable

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help
  • Separate ticket for tests # (issue/pr)

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Added to documentation?

  • 📜 README.md
  • 🤝 Documentation pages updated
  • 🙅 no documentation needed
  • (if applicable) generated OpenAPI docs for CRD changes

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copilot AI review requested due to automatic review settings July 9, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a MariaDB migration that updates the refresh procedures behind the service-level issue severity count materializations to avoid overcounting when a service deploys multiple versions of the same image/component, and to align severity bucketing with IssueMatch.issuematch_rating.

Changes:

  • Add new refresh_mvCountIssueRatingsServiceId_proc implementation that deduplicates by (component_id, issue_id) and uses IssueMatch.issuematch_rating.
  • Add new refresh_mvServiceIssueCounts_proc implementation with the same deduplication and rating source, using an atomic temp-table swap refresh pattern.
  • Add a matching down migration that restores the previous IssueVariant.issuevariant_rating + component_version_id-based counting logic.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/database/mariadb/migrations/20260708120000_fix_mv_service_issue_counts_use_issuematch_rating.up.sql Updates service-level MV refresh procedures to dedup by component and use IssueMatch rating.
internal/database/mariadb/migrations/20260708120000_fix_mv_service_issue_counts_use_issuematch_rating.down.sql Reverts the procedures back to the prior IssueVariant + component-version-based logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tsim-sap

tsim-sap commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Do:

 CALL refresh_mvComponentService_proc();
  CALL refresh_mvSingleComponentByServiceVulnerabilityCounts_proc();
  CALL refresh_mvServiceIssueCounts_proc();
  CALL refresh_mvCountIssueRatingsServiceId_proc();

after applying the dump.

@tsim-sap
tsim-sap force-pushed the tsim-sap/issue-1210/fix-image-list-total-count branch from 3226f48 to ce5cacf Compare July 10, 2026 14:53
Signed-off-by: Valiantsin Tsimoshyk <v.tsimoshyk@sap.com>
@tsim-sap
tsim-sap force-pushed the tsim-sap/issue-1210/fix-image-list-total-count branch from ce5cacf to 12c3d1e Compare July 10, 2026 15:07
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