-
Notifications
You must be signed in to change notification settings - Fork 50
Skip host_registration_insights_inventory parameter check in IoP mode #1144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Skip host_registration_insights_inventory parameter check in IoP mode #1144
Conversation
In IoP mode, the host_registration_insights_inventory parameter should be ignored because single-host reports are required for the IoP Vulnerability service. The parameter is designed for cloud mode to allow users to opt-out of inventory uploads, but in IoP mode all subscribed hosts should be included. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Reviewer's GuideAdjusts inventory upload query behavior so that the host_registration_insights_inventory opt-out parameter is only applied in cloud mode, not in IoP mode, and extends tests to cover both modes and mode switching behavior. Sequence diagram for query generation behavior in cloud vs IoP modessequenceDiagram
participant Caller
participant Queries
participant ForemanRhCloud
participant InsightsCloud
participant BaseQuery
Caller->>Queries: for_slice(base)
activate Queries
Queries->>BaseQuery: assign_to_local_query(base)
Queries->>ForemanRhCloud: with_iop_smart_proxy?
alt IoP_mode
ForemanRhCloud-->>Queries: true
Note right of Queries: Skip host_registration_insights_inventory filter
else Cloud_mode
ForemanRhCloud-->>Queries: false
Queries->>InsightsCloud: enable_client_param_inventory
InsightsCloud-->>Queries: param_name
Queries->>BaseQuery: search_for(not_params_param_false_filter)
BaseQuery-->>Queries: filtered_query
end
Queries->>BaseQuery: joins(subscription_facet)
Queries->>BaseQuery: preload(interfaces, hostgroup, facts)
BaseQuery-->>Queries: final_query
Queries-->>Caller: final_query
deactivate Queries
Updated class diagram for query generation and mode handlingclassDiagram
class Queries {
+for_slice(base)
+fact_names()
}
class ForemanRhCloud {
+with_iop_smart_proxy?()
}
class InsightsCloud {
+enable_client_param_inventory
}
class BaseQuery {
+search_for(filter)
+joins(association)
+preload(associations)
}
Queries --> ForemanRhCloud : uses
Queries --> InsightsCloud : uses
Queries --> BaseQuery : extends_or_uses_base_query_behavior
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this 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:
- The tests that stub
ForemanRhCloud.with_iop_smart_proxy?would be more robust if they explicitly restore the original behavior in teardown/ensure, to avoid accidental leakage of the stub into other tests. - In
Queries.for_slice, consider extracting the mode check (ForemanRhCloud.with_iop_smart_proxy?) behind a small helper or collaborator to keep the query builder focused purely on query construction and make future mode logic changes easier to localize.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The tests that stub `ForemanRhCloud.with_iop_smart_proxy?` would be more robust if they explicitly restore the original behavior in teardown/ensure, to avoid accidental leakage of the stub into other tests.
- In `Queries.for_slice`, consider extracting the mode check (`ForemanRhCloud.with_iop_smart_proxy?`) behind a small helper or collaborator to keep the query builder focused purely on query construction and make future mode logic changes easier to localize.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- Add explicit teardown to restore stubs in all test files that stub ForemanRhCloud.with_iop_smart_proxy? to prevent stub leakage into other tests - Extract mode check from Queries.for_slice to a helper method skip_inventory_parameter_filter? to improve maintainability and localize future mode logic changes Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
Starting to review |
Summary
Queries.for_sliceto skip thehost_registration_insights_inventoryparameter filter when operating in IoP modeTest plan
🤖 Generated with Claude Code
Summary by Sourcery
Adjust inventory query behavior to treat host opt-out parameters differently depending on cloud vs IoP mode.
Bug Fixes:
Tests: