Refactor verify-* CLI commands to share common utilities - #3303
Refactor verify-* CLI commands to share common utilities#3303redhat-chai-bot wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 4 minutes Limit details: You’ve used all 1 included review currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository: openshift-eng/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Extract duplicated logic from 5 verify-* elliott subcommands into a new elliottlib/verify_common.py module: - get_assembly_advisory_ids(): replaces 3 near-identical get_advisory_ids() functions with a single utility supporting include_types/exclude_types - VerifyResultBase: abstract base class standardizing .passed/.failed properties and to_dict()/render_text() methods across all verify results - render_verify_result(): generic JSON/text rendering dispatcher - verify_output_option: shared Click --output option decorator - handle_verify_result(): combined echo + SystemExit(1) on failure Standardizes the success property name to .passed everywhere: - VerifySecurityAlertsResult: .ok → .passed - VerifyCdnPushResult: .complete → .passed - VerifyKernelTagResult, VerifyQeQualifierResult, VerifyMetadataUrlResult: already used .passed Note: verify_qe_qualifier_cli.py (PR openshift-eng#3278) and verify_metadata_url_cli.py (PR openshift-eng#3260) were on main at time of refactoring. If further verify-* commands are added, they should use the shared utilities from verify_common. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
c675028 to
373dd6e
Compare
|
@redhat-chai-bot: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
/approve |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tomasdavidorg The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Summary
Consolidates duplicated logic across the five
verify-*elliott subcommands into a shared module (elliottlib/verify_common.py), reducing copy-paste and standardizing the result interface.This is a purely mechanical refactoring — no behavioral changes.
What changed
New:
elliott/elliottlib/verify_common.pyShared utilities extracted from the 5 verify commands:
get_assembly_advisory_ids(runtime, include_types, exclude_types)— replaces 3 near-identicalget_advisory_ids()functions inverify_security_alerts,verify_kernel_tag, andverify_cdn_pushVerifyResultBase— abstract base dataclass standardizing.passed/.failed/.erroracross all 5 commands (previously inconsistent:.ok,.passed,.complete)render_verify_result(result, output)— generic JSON/text renderer replacing 5 copies ofrender_result()verify_output_option— shared Click--outputdecoratorhandle_verify_result(result, output)— shared echo +SystemExit(1)tailUpdated: all 5
verify_*_cli.pyfilesget_advisory_ids()with sharedget_assembly_advisory_ids()VerifyResultBase.passedeverywhererender_result()withrender_verify_result()/handle_verify_result()verify_output_optiondecoratorUpdated: all 5 test files
render_result→render_verify_result).ok→.passed,.complete→.passed)New:
elliott/tests/test_verify_common.py14 tests covering the shared module.
Property rename mapping
.ok.passed.passed.passed(unchanged).complete.passed.passed.passed(unchanged).passed.passed(unchanged)Test results
Stats
12 files changed, +547 / -363 lines
AI-generated. Review for accuracy.
@tomasdavidorg requested in Slack thread