Skip to content

Refactor verify-* CLI commands to share common utilities - #3303

Open
redhat-chai-bot wants to merge 1 commit into
openshift-eng:mainfrom
redhat-chai-bot:refactor/verify-shared-utils
Open

Refactor verify-* CLI commands to share common utilities#3303
redhat-chai-bot wants to merge 1 commit into
openshift-eng:mainfrom
redhat-chai-bot:refactor/verify-shared-utils

Conversation

@redhat-chai-bot

Copy link
Copy Markdown
Contributor

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

Shared utilities extracted from the 5 verify commands:

  • get_assembly_advisory_ids(runtime, include_types, exclude_types) — replaces 3 near-identical get_advisory_ids() functions in verify_security_alerts, verify_kernel_tag, and verify_cdn_push
  • VerifyResultBase — abstract base dataclass standardizing .passed / .failed / .error across all 5 commands (previously inconsistent: .ok, .passed, .complete)
  • render_verify_result(result, output) — generic JSON/text renderer replacing 5 copies of render_result()
  • verify_output_option — shared Click --output decorator
  • handle_verify_result(result, output) — shared echo + SystemExit(1) tail

Updated: all 5 verify_*_cli.py files

  • Replaced local get_advisory_ids() with shared get_assembly_advisory_ids()
  • Replaced local result dataclasses with subclasses of VerifyResultBase
  • Standardized success property to .passed everywhere
  • Replaced local render_result() with render_verify_result() / handle_verify_result()
  • Used shared verify_output_option decorator

Updated: all 5 test files

  • Updated imports (render_resultrender_verify_result)
  • Updated property assertions (.ok.passed, .complete.passed)

New: elliott/tests/test_verify_common.py

14 tests covering the shared module.

Property rename mapping

Command Before After
verify-security-alerts .ok .passed
verify-kernel-tag .passed .passed (unchanged)
verify-cdn-push .complete .passed
verify-qe-qualifier .passed .passed (unchanged)
verify-metadata-url .passed .passed (unchanged)

Test results

  • 179 tests passed (165 existing + 14 new)
  • Lint (ruff check + format): clean

Stats

12 files changed, +547 / -363 lines


AI-generated. Review for accuracy.

@tomasdavidorg requested in Slack thread

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@redhat-chai-bot, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Repository: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e2d7e3e6-7944-4ed8-8e16-708490f9f7b0

📥 Commits

Reviewing files that changed from the base of the PR and between 3ccde95 and 373dd6e.

📒 Files selected for processing (12)
  • elliott/elliottlib/cli/verify_cdn_push_cli.py
  • elliott/elliottlib/cli/verify_kernel_tag_cli.py
  • elliott/elliottlib/cli/verify_metadata_url_cli.py
  • elliott/elliottlib/cli/verify_qe_qualifier_cli.py
  • elliott/elliottlib/cli/verify_security_alerts_cli.py
  • elliott/elliottlib/verify_common.py
  • elliott/tests/test_verify_cdn_push_cli.py
  • elliott/tests/test_verify_common.py
  • elliott/tests/test_verify_kernel_tag_cli.py
  • elliott/tests/test_verify_metadata_url_cli.py
  • elliott/tests/test_verify_qe_qualifier_cli.py
  • elliott/tests/test_verify_security_alerts_cli.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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
@redhat-chai-bot
redhat-chai-bot force-pushed the refactor/verify-shared-utils branch from c675028 to 373dd6e Compare August 17, 2026 10:15
@openshift-ci

openshift-ci Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

@redhat-chai-bot: The following test 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/security 373dd6e link false /test security

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.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 17, 2026
@tomasdavidorg

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tomasdavidorg
Once this PR has been reviewed and has the lgtm label, please assign joepvd for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants