Skip to content

ROX-33404: Implement custom VM v2 store#19240

Draft
dashrews78 wants to merge 2 commits intodashrews/vm-v2-generic-storesfrom
dashrews/vm-v2-store-33404
Draft

ROX-33404: Implement custom VM v2 store#19240
dashrews78 wants to merge 2 commits intodashrews/vm-v2-generic-storesfrom
dashrews/vm-v2-store-33404

Conversation

@dashrews78
Copy link
Contributor

Implement custom VM v2 store with hash-based change detection

Replace the generated VM v2 postgres store with a custom implementation
that follows the image store pattern. The custom store:

  • Detects whether VM or scan data changed via hash comparison before writing
  • Performs timestamp-only updates when nothing changed (UpsertVM, UpsertScan)
  • Preserves the oldest CVE created_at across delete/re-insert cycles
  • Wraps all writes in a single database transaction with keyFence locking
  • Uses COPY FROM for batched component and CVE inserts

The scan hash covers only content-meaningful fields (name, version, CVE
identifier, severity, etc.) and excludes generated UUIDs, since scanners
produce new IDs each run.

Also registers missing VM v2 search field labels (Guest OS, Virtual Machine
State, Virtual Machine Scan Time, Virtual Machine Top CVSS) in
pkg/search/options.go.

Prompt: implement the VM v2 custom store (store layer only) following the
image store pattern with hash-based deduplication and CVE timestamp
preservation.

Partially generated by AI.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

gen mocks

Description

change me!

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

change me!

dashrews78 and others added 2 commits February 27, 2026 14:40
Replace the generated VM v2 postgres store with a custom implementation
that follows the image store pattern. The custom store:

- Detects whether VM or scan data changed via hash comparison before writing
- Performs timestamp-only updates when nothing changed (UpsertVM, UpsertScan)
- Preserves the oldest CVE created_at across delete/re-insert cycles
- Wraps all writes in a single database transaction with keyFence locking
- Uses COPY FROM for batched component and CVE inserts

The scan hash covers only content-meaningful fields (name, version, CVE
identifier, severity, etc.) and excludes generated UUIDs, since scanners
produce new IDs each run.

Also registers missing VM v2 search field labels (Guest OS, Virtual Machine
State, Virtual Machine Scan Time, Virtual Machine Top CVSS) in
pkg/search/options.go.

Prompt: implement the VM v2 custom store (store layer only) following the
image store pattern with hash-based deduplication and CVE timestamp
preservation.

Partially generated by AI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@openshift-ci
Copy link

openshift-ci bot commented Feb 27, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@dashrews78
Copy link
Contributor Author

@rhacs-bot
Copy link
Contributor

Images are ready for the commit at 543b531.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-210-g543b5315d1.

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 70.55336% with 149 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (dashrews/vm-v2-generic-stores@3bb7454). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...irtualmachine/v2/datastore/store/postgres/store.go 70.55% 107 Missing and 42 partials ⚠️
Additional details and impacted files
@@                       Coverage Diff                        @@
##             dashrews/vm-v2-generic-stores   #19240   +/-   ##
================================================================
  Coverage                                 ?   49.60%           
================================================================
  Files                                    ?     2683           
  Lines                                    ?   202675           
  Branches                                 ?        0           
================================================================
  Hits                                     ?   100539           
  Misses                                   ?    94633           
  Partials                                 ?     7503           
Flag Coverage Δ
go-unit-tests 49.60% <70.55%> (?)

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:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants