Skip to content

WIP: CherryPicked: [v4.18] CherryPicked: [v4.19]ci(deps): lock file maintenance (v4.20)#2768

Closed
ema-aka-young wants to merge 1 commit into
v4.18from
CherryPicked-CherryPicked-CherryPicked-renovate/main-lock-file-maintenance-M7EB5-6RyTF-TDPdL
Closed

WIP: CherryPicked: [v4.18] CherryPicked: [v4.19]ci(deps): lock file maintenance (v4.20)#2768
ema-aka-young wants to merge 1 commit into
v4.18from
CherryPicked-CherryPicked-CherryPicked-renovate/main-lock-file-maintenance-M7EB5-6RyTF-TDPdL

Conversation

@ema-aka-young

Copy link
Copy Markdown
Contributor

Cherry-pick from v4.19 branch, original PR: #2720, PR owner: rnetser

* CherryPicked: [v4.20] ci(deps): lock file maintenance (main) (#2715)

* ci(deps): lock file maintenance (main) (#2702)

* ci(deps): lock file maintenance

* Update Python compatibility markers and modernize code

Update resolution markers to support Python 3.12 as primary version with 3.11 as fallback. Modernize Python 3.10+ syntax by replacing typing constructs with built-in generics (Optional → None union, List → list, Tuple → tuple). Update imports to use traceback at module level and refactor error handling from assert to raise AssertionError. Simplify failure summary output by removing truncation logic. Replace uv.lock with updated dependencies reflecting Python version changes.

* chore: update pre-commit dependencies

Update ruff to v0.15.12, gitleaks to v8.30.1, and mypy to v1.20.2. Also remove unnecessary space in string join operation in test fixture.

* Fix CLI tool invocations with missing configuration flags

Update pytest, prek, and ruff commands to include their required
configuration flags. Add `--group tests` to pytest invocation, add
`-c .pre-commit-config.yaml` to prek invocation, and add
`--config pyproject.toml` to ruff invocation. Also remove extra space
in string join operation for consistency.

* test: Update pytest invocation with test dependency group

The pytest command in the CLI test now includes the `--group tests` flag
to ensure the test dependencies are available when running pytest through
the uv package manager.

* Refactor imports in class_generator_template.j2

Reorganize imports to improve readability and add conditional import for MissingRequiredArgumentError. The exception import is now only included when there are required arguments that will actually use it, reducing unnecessary dependencies in generated classes with no required arguments.

* Remove extra blank line in class_generator_template.j2

* Improve file formatting with prek and ruff fallback

Add ruff as a fallback formatter when prek fails. Extract project root
path calculation to module level and pass configuration paths explicitly
to prek. Introduce _run_ruff_fallback() helper that runs ruff check and
ruff format sequentially. Update logging to clarify fallback behavior
and fix typo in prek stdout log message.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Meni Yakove <myakove@gmail.com>

* fix: revert ruff to v0.14.2, fix mock tests, regenerate manifests

- Revert ruff from v0.15.12 to v0.14.2 in pre-commit config to avoid
  90+ new lint errors from stricter rules on maintenance branch
- Fix TestCheckAndUpdateClusterVersion mock tests by adding
  _get_open_mode() helper to handle missing positional mode argument
- Regenerate 18 test manifest files to match current generator output

Assisted-by: Claude <noreply@anthropic.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Meni Yakove <myakove@gmail.com>
Co-authored-by: rnetser <rnetser@redhat.com>

* fix: restore OAuth/Pipeline tests and regenerate manifests

- Re-add OAuth and Pipeline to test_parse_explain test list — they were
  accidentally dropped during cherry-pick conflict resolution
- Regenerate Image, OAuth, and Pipeline manifest files to match current
  generator output

Assisted-by: Claude <noreply@anthropic.com>

---------

Signed-off-by: Ruth Netser <rnetser@redhat.com>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 92b1f807-0b1a-4846-9812-7a31cf249c96

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch CherryPicked-CherryPicked-CherryPicked-renovate/main-lock-file-maintenance-M7EB5-6RyTF-TDPdL

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.

@redhat-qe-bot

Copy link
Copy Markdown
Contributor

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: Disabled for this repository
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: All label categories are enabled (default configuration)

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (PR author or approvers)
  • /hold cancel - Unblock PR merging (PR author or approvers)
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message
  • /security-override - Set security check runs to pass (maintainers only)
  • /security-override cancel - Re-run security checks

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /automerge - Enable automatic merging when all requirements are met (maintainers and approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest python-module-install - Test Python package installation
  • /retest conventional-title - Validate commit message format
  • /retest all - Run all available tests

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3
  • /cherry-pick-retry <branch> - Retry a failed cherry-pick (merged PRs only)

Branch Management

  • /rebase - Rebase this PR branch onto its base branch

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. Status Checks: All required status checks must pass
  3. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  4. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

  • dbasunag
  • myakove
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge
AI Features
  • Conventional Title: Mode: fix (claude/claude-opus-4-6-1m)
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6-1m)
Security Checks
  • Suspicious Path Detection: Monitors paths: .claude/, .vscode/, .cursor/, .devcontainer/, .pi/, .github/workflows/, .github/actions/
  • Committer Identity Check: Verifies last committer matches PR author
  • Mandatory: Security checks block merge (use /security-override to bypass — maintainers only)

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix MissingRequiredArgumentError imports in generated manifests and bump pre-commit deps

🐞 Bug fix ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Bump pre-commit hook versions for gitleaks and mypy.
• Update class generator template to import MissingRequiredArgumentError from
 ocp_resources.exceptions.
• Align generated test manifests with the new exception import path and formatting.
Diagram

graph TD
  Dev[Developer] --> PC[".pre-commit-config.yaml"] --> Hooks["pre-commit hooks"]
  Dev --> CGT["class_generator_template.j2"] --> Gen["Generated manifests"] --> Tests["class_generator/tests fixtures"]

  subgraph Legend
    direction LR
    _actor[Actor] ~~~ _cfg["Config file"] ~~~ _tpl["Template"] ~~~ _code["Generated code"]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Backward-compatible import fallback (try/except)
  • ➕ Allows generated code to work with both old and new ocp_resources layouts
  • ➕ Reduces risk if consumers pin older ocp_resources versions
  • ➖ Adds conditional logic to generated code/template
  • ➖ May mask dependency/version drift that should be resolved explicitly
2. Regenerate fixtures in CI rather than committing them
  • ➕ Avoids large fixture churn for purely mechanical generator changes
  • ➕ Ensures fixtures always match the generator output
  • ➖ Requires CI pipeline changes and a deterministic generation step
  • ➖ May make local test runs more complex/slower

Recommendation: Current approach (fix the generator template and update checked-in fixtures accordingly) is appropriate if the project expects the newer ocp_resources exception location. Consider an import fallback only if supporting multiple ocp_resources versions is a requirement.

Files changed (19) +32 / -7

Bug fix (5) +17 / -5
class_generator_template.j2Import MissingRequiredArgumentError from ocp_resources.exceptions +5/-1

Import MissingRequiredArgumentError from ocp_resources.exceptions

• Stops importing MissingRequiredArgumentError from ocp_resources.resource and instead imports it from ocp_resources.exceptions. The exception import is now conditional on templates that actually require required-arg enforcement.

class_generator/manifests/class_generator_template.j2

deployment.pyFix MissingRequiredArgumentError import for Deployment manifest +3/-1

Fix MissingRequiredArgumentError import for Deployment manifest

• Updates the manifest to import MissingRequiredArgumentError from ocp_resources.exceptions instead of ocp_resources.resource. Keeps the resource base class import separate for clarity and compatibility with the new module layout.

class_generator/tests/manifests/Deployment/deployment.py

pod.pyFix MissingRequiredArgumentError import for Pod manifest +3/-1

Fix MissingRequiredArgumentError import for Pod manifest

• Updates the manifest to import MissingRequiredArgumentError from ocp_resources.exceptions instead of ocp_resources.resource. Keeps NamespacedResource import separate to match the updated module organization.

class_generator/tests/manifests/Pod/pod.py

service_mesh_member.pyFix MissingRequiredArgumentError import for ServiceMeshMember manifest +3/-1

Fix MissingRequiredArgumentError import for ServiceMeshMember manifest

• Updates the manifest to import MissingRequiredArgumentError from ocp_resources.exceptions instead of ocp_resources.resource. Keeps NamespacedResource import separate to match the updated module organization.

class_generator/tests/manifests/ServiceMeshMember/service_mesh_member.py

serving_runtime.pyFix MissingRequiredArgumentError import for ServingRuntime manifest +3/-1

Fix MissingRequiredArgumentError import for ServingRuntime manifest

• Updates the manifest to import MissingRequiredArgumentError from ocp_resources.exceptions instead of ocp_resources.resource. Keeps NamespacedResource import separate to match the updated module organization.

class_generator/tests/manifests/ServingRuntime/serving_runtime.py

Refactor (13) +13 / -0
api_server.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/APIServer/api_server.py

cluster_operator.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/ClusterOperator/cluster_operator.py

config_map.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/ConfigMap/config_map.py

dns_config_openshift_io.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/DNS/dns_config_openshift_io.py

dns_operator_openshift_io.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/DNS/dns_operator_openshift_io.py

image_config_openshift_io.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/Image/image_config_openshift_io.py

image_image_openshift_io.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/Image/image_image_openshift_io.py

image_content_source_policy.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/ImageContentSourcePolicy/image_content_source_policy.py

machine.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/Machine/machine.py

nm_state.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/NMState/nm_state.py

oauth.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/OAuth/oauth.py

pipeline.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/Pipeline/pipeline.py

secret.pyFormatting-only import spacing adjustment +1/-0

Formatting-only import spacing adjustment

• Adds a blank line between typing imports and ocp_resources imports to satisfy formatting/linting expectations.

class_generator/tests/manifests/Secret/secret.py

Other (1) +2 / -2
.pre-commit-config.yamlBump gitleaks and mypy pre-commit hook versions +2/-2

Bump gitleaks and mypy pre-commit hook versions

• Updates the pinned revisions for gitleaks and mypy hooks. Keeps local/CI tooling aligned with newer upstream releases.

.pre-commit-config.yaml

@myakove

myakove commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

@ema-aka-young why this cp is needed?

@ema-aka-young

ema-aka-young commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@myakove I'd like to enable datasource usage for 4.18 and so I am following the same approach I've used for 4.19:
From the Jira I created to track this work:

The steps to follow to allow it includes:

Backport this PR from the wrapper → #2720

Backport the main changes in the wrapper → #2723

Backport changes in the tests repo ->RedHatQE/openshift-virtualization-tests#4758

see this conversation as well #2708 (comment)

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

@ema-aka-young

Copy link
Copy Markdown
Contributor Author

/wip

@rh-bot-1 rh-bot-1 added the wip label Jul 23, 2026
@rh-bot-1 rh-bot-1 changed the title CherryPicked: [v4.18] CherryPicked: [v4.19]ci(deps): lock file maintenance (v4.20) WIP: CherryPicked: [v4.18] CherryPicked: [v4.19]ci(deps): lock file maintenance (v4.20) Jul 23, 2026
@myakove

myakove commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

@ema-aka-young you need to cp only what is neeeded, not full PR that include more things

@ema-aka-young

Copy link
Copy Markdown
Contributor Author

@myakove Ok, but I am afraid that if I try to cherry-pick the changes I need from #2723, then the tox check would fail and therefore we couldn't merge it because of it...

@ema-aka-young

Copy link
Copy Markdown
Contributor Author

@myakove As you can see from my attempt on #2769, the CI checks are failing. I'm seeing that the tox check is failing on base v4.18 branch, so I was trying to have that fixed on that branch version branch before merging the main changes I need.
Is this a wrong approach?

@myakove

myakove commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

you have this #2769 so this can be closed right?

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.

6 participants