Skip to content

chore(constants): move VM facts keys to shared package#19542

Open
dashrews78 wants to merge 2 commits intomasterfrom
dashrews/use-guest-os-constant
Open

chore(constants): move VM facts keys to shared package#19542
dashrews78 wants to merge 2 commits intomasterfrom
dashrews/use-guest-os-constant

Conversation

@dashrews78
Copy link
Contributor

@dashrews78 dashrews78 commented Mar 23, 2026

Description

The facts key constants (GuestOSKey, DescriptionKey, etc.) were defined
in the sensor dispatcher package, making them inaccessible to central
without creating a bad dependency direction. Moved them to
pkg/virtualmachine/facts.go so both sensor and central can reference
the same constants instead of using string literals.

Partially generated by AI

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

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

The updates tests should be sufficient here.

…ckage

The facts key constants (GuestOSKey, DescriptionKey, etc.) were defined
in the sensor dispatcher package, making them inaccessible to central
without creating a bad dependency direction. Moved them to
pkg/virtualmachine/facts.go so both sensor and central can reference
the same constants instead of using string literals.

Partially generated by AI

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

dashrews78 commented Mar 23, 2026

This change is part of the following stack:

Change managed by git-spice.

@openshift-ci
Copy link

openshift-ci bot commented Mar 23, 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

Copy link
Contributor

@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 left some high level feedback:

  • In files that import both pkg/virtualmachine and sensor/common/virtualmachine, consider using a consistent alias (e.g. always pkgVM for the shared package) to make it immediately clear which package a given identifier comes from and avoid confusion when reading the tests.
  • Since UnknownGuestOS is now a shared constant, it may be worth clarifying its intended semantics in the new facts.go (e.g. whether it is a user-facing string vs. purely internal sentinel) so other callers don’t accidentally treat it as a real OS name.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In files that import both `pkg/virtualmachine` and `sensor/common/virtualmachine`, consider using a consistent alias (e.g. always `pkgVM` for the shared package) to make it immediately clear which package a given identifier comes from and avoid confusion when reading the tests.
- Since `UnknownGuestOS` is now a shared constant, it may be worth clarifying its intended semantics in the new `facts.go` (e.g. whether it is a user-facing string vs. purely internal sentinel) so other callers don’t accidentally treat it as a real OS name.

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.

Address Sourcery review feedback:
- Use pkgVM alias consistently for pkg/virtualmachine in dispatcher
  files that also import sensor/common/virtualmachine
- Document UnknownGuestOS as a user-facing default value

Partially generated by AI

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

rhacs-bot commented Mar 23, 2026

Images are ready for the commit at 3ebf14e.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-409-g3ebf14e91e.

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.26%. Comparing base (434c05c) to head (3ebf14e).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19542   +/-   ##
=======================================
  Coverage   49.25%   49.26%           
=======================================
  Files        2727     2727           
  Lines      205788   205788           
=======================================
+ Hits       101362   101375   +13     
+ Misses      96890    96881    -9     
+ Partials     7536     7532    -4     
Flag Coverage Δ
go-unit-tests 49.26% <100.00%> (+<0.01%) ⬆️

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.

@dashrews78 dashrews78 marked this pull request as ready for review March 23, 2026 13:43
@dashrews78 dashrews78 requested a review from a team as a code owner March 23, 2026 13:43
Copy link
Contributor

@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.

Copy link
Contributor

@vikin91 vikin91 left a comment

Choose a reason for hiding this comment

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

LGTM!
Simple with limited scope, quick and easy to review :)

@dashrews78
Copy link
Contributor Author

/retest

@openshift-ci
Copy link

openshift-ci bot commented Mar 23, 2026

@dashrews78: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/ocp-4-21-nongroovy-e2e-tests 3ebf14e link false /test ocp-4-21-nongroovy-e2e-tests
ci/prow/ocp-4-20-qa-e2e-tests 3ebf14e link false /test ocp-4-20-qa-e2e-tests
ci/prow/ocp-4-21-qa-e2e-tests 3ebf14e link false /test ocp-4-21-qa-e2e-tests

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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.

3 participants