Skip to content

Fix: add retry logic in 4.15 - #2793

Open
acinko-rh wants to merge 2 commits into
RedHatQE:v4.15from
acinko-rh:backport-api-request-retry-v4.15
Open

Fix: add retry logic in 4.15#2793
acinko-rh wants to merge 2 commits into
RedHatQE:v4.15from
acinko-rh:backport-api-request-retry-v4.15

Conversation

@acinko-rh

Copy link
Copy Markdown
Contributor
Short description:

Adds API call retry logic back into 4.15 wrapper.

More details:

In the gating report mentioned below, I added retry logic from 4.16 back into 4.15 to improve the test stability.

What this PR does / why we need it:

Failing Gating tests due to 5xx code error. Because there's no retry logic, the API call isn't re-attempted after failing. The re-attempt could make the error go away since it's of the 5xx variety (server side).

Which issue(s) this PR fixes:

https://redhat.atlassian.net/browse/CNV-86678

Special notes for reviewer:

Co-Authored: Opus 4.8 noreply@anthropic.com

Bug:

Signed-off-by: Adam Cinko <acinko@redhat.com>
@coderabbitai

coderabbitai Bot commented Aug 19, 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 202105cf-1fd4-4b13-95dc-965715eb2963

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

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:

  • myakove
  • oharan2
  • omrirh
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge
AI Features
  • Conventional Title: Mode: fix (cursor/cursor-grok-4.6-high)
  • Cherry-Pick Conflict Resolution: Enabled (cursor/cursor-grok-4.6-high)
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.

@redhat-qe-bot

Copy link
Copy Markdown
Contributor

omrirh can not be added as reviewer. Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the RedHatQE/openshift-python-wrapper repository.: 422 {"message": "Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the RedHatQE/openshift-python-wrapper repository.", "documentation_url": "https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request", "status": "422"}

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Backport transient API request retries to 4.15

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Adds configurable retries for transient cluster API request failures.
• Enables 30-second retries for VM/VMI actions and patch conflicts.
• Covers opt-in, direct-call, and subclass defaults with unit tests.
Diagram

graph TD
  VM["VM and VMI"] --> Request["Resource API"] --> Retry{"Retry enabled?"}
  Retry -->|Yes| Helper["Retry helper"] --> Sampler["TimeoutSampler"] --> Client["Dynamic client"] --> API["Cluster API"]
  Retry -->|No| Client
Loading
High-Level Assessment

Reusing the existing retry_cluster_exceptions and TimeoutSampler path is the best fit for a targeted 4.15 backport. Transport-level retry configuration was considered but would introduce broader client behavior changes and diverge from the established resource retry mechanism.

Files changed (5) +132 / -16

Bug fix (3) +53 / -16
resource.pyAdd configurable API request retry handling +32/-11

Add configurable API request retry handling

• Allows retry_cluster_exceptions callers to configure timeout and sleep intervals, and routes API requests through it when retry parameters are supplied. It also standardizes the condition timeout constant and extends patch retries to 30 seconds with five-second intervals.

ocp_resources/resource.py

virtual_machine.pyEnable retries for VM subresource actions +11/-2

Enable retries for VM subresource actions

• Makes VM API actions retry transient cluster exceptions for up to 30 seconds at five-second intervals by default. Callers can still provide a custom URL or retry parameters.

ocp_resources/virtual_machine.py

virtual_machine_instance.pyEnable retries for VMI subresource actions +10/-3

Enable retries for VMI subresource actions

• Applies the same default 30-second retry window and five-second interval to VMI API actions while retaining URL and retry parameter overrides.

ocp_resources/virtual_machine_instance.py

Tests (1) +76 / -0
test_resource_retry.pyTest API retry behavior and VM/VMI defaults +76/-0

Test API retry behavior and VM/VMI defaults

• Verifies recovery after a transient cluster exception, confirms base requests remain single-attempt by default, and checks the retry defaults supplied by VM and VMI wrappers.

tests/unittests/test_resource_retry.py

Other (1) +3 / -0
constants.pyAdd reusable short retry timeout constants +3/-0

Add reusable short retry timeout constants

• Defines one-, five-, and thirty-second timeout constants for request retries and polling intervals.

ocp_resources/constants.py

@redhat-qe-bot

Copy link
Copy Markdown
Contributor

oharan2 can not be added as reviewer. Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the RedHatQE/openshift-python-wrapper repository.: 422 {"message": "Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the RedHatQE/openshift-python-wrapper repository.", "documentation_url": "https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request", "status": "422"}

@qodo-code-review

qodo-code-review Bot commented Aug 19, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Action required

1. Most 5xx errors bypass retries ✗ Dismissed 🐞 Bug ☼ Reliability
Description
The new path retries only exceptions allowed by DEFAULT_CLUSTER_RETRY_EXCEPTIONS; a generic
InternalServerError is immediately propagated unless its message contains one of four narrow
strings, while returned 5xx responses are not inspected at all. Consequently, common 500/503
failures still receive no retry despite this being the stated purpose of the change.
Code

ocp_resources/resource.py[R932-935]

+            response = self.retry_cluster_exceptions(
+                func=client.client.request,
+                timeout=retry_params.get("timeout", TIMEOUT_10SEC),
+                sleep_time=retry_params.get("sleep_time", TIMEOUT_1SEC),
Relevance

●●● Strong

The PR explicitly targets 5xx stability, and this identifies a concrete retry path that still misses
common server failures.

PR-#2420
PR-#2499

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
api_request passes the raw request directly to TimeoutSampler and performs no HTTP status
validation. The sampler retries only matching configured exceptions; InternalServerError is
retryable only for four message fragments, and the new test verifies only a connection reset rather
than any 5xx case.

ocp_resources/resource.py[926-948]
ocp_resources/constants.py[9-20]
ocp_resources/utils.py[139-195]
tests/unittests/test_resource_retry.py[21-38]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new API request retry path does not retry generic HTTP 5xx failures. `TimeoutSampler` only retries configured exceptions, generic internal-server errors fail message filtering, and returned responses are accepted without checking their status.

## Issue Context
The PR is intended to stabilize VM/VMI API calls after transient 5xx failures, but its test covers only `ConnectionResetError`. Ensure representative transient 500/502/503/504 failures from the raw request layer are recognized while non-retriable client errors still propagate.

## Fix Focus Areas
- ocp_resources/resource.py[926-948]
- ocp_resources/constants.py[9-20]
- tests/unittests/test_resource_retry.py[21-38]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. VMI retry test lacks hints ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new VMI retry test does not annotate monkeypatch or its return type. This violates the
explicit parameter and return typing requirement.
Code

tests/unittests/test_resource_retry.py[65]

+    def test_vmi_api_request_passes_default_retry_params(self, monkeypatch):
Relevance

●●● Strong

Active rule covers new test methods and parameters; nearby repository history consistently accepts
typing-related maintainability fixes.

PR-#2437
PR-#2642

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new test method leaves its fixture parameter and return value untyped, violating PR Compliance
ID 1834714.

Rule 1834714: Require type hints on all new functions, methods, and parameters
tests/unittests/test_resource_retry.py[65-65]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Annotate the `monkeypatch` fixture parameter and add an explicit `None` return type.

## Issue Context
New test methods and fixture parameters are included in the type-hint requirement.

## Fix Focus Areas
- tests/unittests/test_resource_retry.py[65-65]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Default behavior test lacks return ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new test_api_request_no_retry_by_default method has no explicit return annotation. This fails
the requirement covering all new methods.
Code

tests/unittests/test_resource_retry.py[40]

+    def test_api_request_no_retry_by_default(self):
Relevance

●●● Strong

The cited rule explicitly covers new test methods, and adding a None return annotation is a trivial
deterministic fix.

PR-#2437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The newly added test method lacks a return annotation, contrary to PR Compliance ID 1834714.

Rule 1834714: Require type hints on all new functions, methods, and parameters
tests/unittests/test_resource_retry.py[40-40]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Add an explicit `None` return annotation to the new default-behavior test.

## Issue Context
All new functions and methods require explicit return types.

## Fix Focus Areas
- tests/unittests/test_resource_retry.py[40-40]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. retry_cluster_exceptions lacks type hints ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The modified method does not annotate func, exceptions_dict, timeout, sleep_time,
**kwargs, or its return type. This violates the requirement for explicit, concrete types on
modified methods and parameters.
Code

ocp_resources/resource.py[R773-775]

+    def retry_cluster_exceptions(
+        func, exceptions_dict=DEFAULT_CLUSTER_RETRY_EXCEPTIONS, timeout=TIMEOUT_10SEC, sleep_time=1, **kwargs
+    ):
Relevance

●●● Strong

Recent reviews accepted missing annotations; explicit type-hint requirements make this a
deterministic maintainability fix.

PR-#2529
PR-#2437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1834714 requires type hints on every modified method and parameter, while this
modified signature has no annotations.

Rule 1834714: Require type hints on all new functions, methods, and parameters
ocp_resources/resource.py[773-775]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Add concrete parameter and return annotations to `retry_cluster_exceptions`.

## Issue Context
Modified functions and methods must provide explicit type hints for their parameters and return values.

## Fix Focus Areas
- ocp_resources/resource.py[773-775]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View medium (8)
5. VM fake request lacks hints ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The nested fake_api_request helper lacks annotations for its request parameters, retry
configuration, variadic parameters, and return type. The mock replacement therefore does not express
the interface it is standing in for.
Code

tests/unittests/test_resource_retry.py[55]

+        def fake_api_request(self, method, action, url, retry_params=None, **params):
Relevance

●●● Strong

Active rule explicitly requires annotations; repository history accepts type-hint additions and has
no close rejection precedent.

PR-#2529
PR-#2437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new nested helper has no type annotations, contrary to the requirement for all new functions and
parameters.

Rule 1834714: Require type hints on all new functions, methods, and parameters
tests/unittests/test_resource_retry.py[55-55]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Add concrete parameter and return annotations to the nested VM `fake_api_request` helper.

## Issue Context
The fake should expose a typed signature compatible with `Resource.api_request`.

## Fix Focus Areas
- tests/unittests/test_resource_retry.py[55-57]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. VMI fake request lacks hints ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The nested fake_api_request helper lacks annotations for its request parameters, retry
configuration, variadic parameters, and return type. Its compatibility with the mocked method cannot
be statically checked.
Code

tests/unittests/test_resource_retry.py[68]

+        def fake_api_request(self, method, action, url, retry_params=None, **params):
Relevance

●●● Strong

Active rule explicitly requires annotations on new helper parameters and returns; no closely
matching rejection precedent exists.

PR-#2529
PR-#2437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new nested helper has no type annotations, contrary to the requirement for all new functions and
parameters.

Rule 1834714: Require type hints on all new functions, methods, and parameters
tests/unittests/test_resource_retry.py[68-68]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Add concrete parameter and return annotations to the nested VMI `fake_api_request` helper.

## Issue Context
The fake should expose a typed signature compatible with `Resource.api_request`.

## Fix Focus Areas
- tests/unittests/test_resource_retry.py[68-70]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. VirtualMachineInstance.api_request lacks hints ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The modified override does not annotate method, action, url, retry_params, **params, or
its return type. This leaves the new retry-related interface untyped.
Code

ocp_resources/virtual_machine_instance.py[51]

+    def api_request(self, method, action, url="", retry_params=None, **params):
Relevance

●●● Strong

Recent reviews accepted type annotations on modified resource APIs; this override adds an untyped
retry interface.

PR-#2529
PR-#2437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed override has no parameter or return annotations, violating the type-hint requirement for
modified methods.

Rule 1834714: Require type hints on all new functions, methods, and parameters
ocp_resources/virtual_machine_instance.py[51-51]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Add concrete parameter and return annotations to `VirtualMachineInstance.api_request`.

## Issue Context
The override introduces `url` and `retry_params` parameters and should match the annotated base-method contract.

## Fix Focus Areas
- ocp_resources/virtual_machine_instance.py[51-51]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Resource.api_request lacks type hints ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The modified api_request signature does not annotate its parameters or return type, including the
newly added retry_params. Callers therefore cannot statically verify the retry configuration or
response type.
Code

ocp_resources/resource.py[910]

+    def api_request(self, method, action, url, retry_params=None, **params):
Relevance

●●● Strong

Recent reviews accepted adding concrete annotations to modified APIs, matching this explicit
interface requirement.

PR-#2529
PR-#2437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires annotations on all modified method parameters and returns; the changed
Resource.api_request definition provides none.

Rule 1834714: Require type hints on all new functions, methods, and parameters
ocp_resources/resource.py[910-910]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Add concrete parameter and return annotations to `Resource.api_request`, including `retry_params` and `**params`.

## Issue Context
The method now accepts retry configuration but its expected structure and return type are not expressed in the signature.

## Fix Focus Areas
- ocp_resources/resource.py[910-910]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. VM retry test lacks hints ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new VM retry test does not annotate monkeypatch or its return type. This violates the explicit
parameter and return typing requirement.
Code

tests/unittests/test_resource_retry.py[52]

+    def test_vm_api_request_passes_default_retry_params(self, monkeypatch):
Relevance

●●● Strong

The cited rule explicitly covers fixture parameters and new test methods, making these missing
annotations straightforward to fix.

PR-#2437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new test method leaves its fixture parameter and return value untyped, violating PR Compliance
ID 1834714.

Rule 1834714: Require type hints on all new functions, methods, and parameters
tests/unittests/test_resource_retry.py[52-52]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Annotate the `monkeypatch` fixture parameter and add an explicit `None` return type.

## Issue Context
New test methods and fixture parameters are included in the type-hint requirement.

## Fix Focus Areas
- tests/unittests/test_resource_retry.py[52-52]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. VirtualMachine.api_request lacks type hints ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The modified override does not annotate method, action, url, retry_params, **params, or
its return type. The newly exposed retry configuration consequently has no statically defined shape.
Code

ocp_resources/virtual_machine.py[77]

+    def api_request(self, method, action, url="", retry_params=None, **params):
Relevance

●●● Strong

Recent reviews accepted type annotations on modified resource APIs; this override adds an untyped
retry interface.

PR-#2529
PR-#2437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed override adds parameters without any annotations, contrary to PR Compliance ID 1834714.

Rule 1834714: Require type hints on all new functions, methods, and parameters
ocp_resources/virtual_machine.py[77-77]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Add concrete parameter and return annotations to `VirtualMachine.api_request`.

## Issue Context
The override introduces `url` and `retry_params` parameters and must type them consistently with the base method.

## Fix Focus Areas
- ocp_resources/virtual_machine.py[77-77]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Transient retry test lacks return ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new test_api_request_retries_transient_cluster_exception method has no explicit return
annotation. New test methods are functions within the scope of the type-hint requirement.
Code

tests/unittests/test_resource_retry.py[21]

+    def test_api_request_retries_transient_cluster_exception(self):
Relevance

●●● Strong

The cited rule explicitly covers new test methods, and adding a None return annotation is a trivial
deterministic fix.

PR-#2437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The newly added test method omits its return annotation, violating PR Compliance ID 1834714.

Rule 1834714: Require type hints on all new functions, methods, and parameters
tests/unittests/test_resource_retry.py[21-21]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Add an explicit `None` return annotation to the new retry test method.

## Issue Context
All new functions and methods require explicit return types.

## Fix Focus Areas
- tests/unittests/test_resource_retry.py[21-21]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. Test resource helper lacks hints ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new _resource_with_mocked_client helper does not annotate request_side_effect or its return
type. Its accepted side-effect values and returned tuple are therefore unspecified.
Code

tests/unittests/test_resource_retry.py[11]

+    def _resource_with_mocked_client(request_side_effect):
Relevance

●●● Strong

The cited rule explicitly covers new helpers, making the missing parameter and return annotations a
local deterministic fix.

PR-#2437

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The newly added helper has an untyped parameter and no return annotation, contrary to PR Compliance
ID 1834714.

Rule 1834714: Require type hints on all new functions, methods, and parameters
tests/unittests/test_resource_retry.py[11-11]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Add concrete parameter and return annotations to `_resource_with_mocked_client`.

## Issue Context
The helper accepts mock side effects and returns a resource/client tuple; both should be represented explicitly.

## Fix Focus Areas
- tests/unittests/test_resource_retry.py[11-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

13. retry_params docstring is non-Google 📘 Rule violation ⚙ Maintainability
Description
The added entry uses retry_params (dict): instead of the required Google-style `retry_params:
description` format, and its description is not a capitalized sentence ending with a period. This
mixes legacy typed-parameter syntax into a docstring modified by the PR.
Code

ocp_resources/resource.py[918]

+            retry_params (dict): dict of timeout and sleep_time values for retrying the api request call
Relevance

● Weak

A recent review explicitly rejected reformatting typed Google-style docstrings, closely matching
this finding.

PR-#2765

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1834792 requires Google-style name: description entries, while the newly
documented parameter uses retry_params (dict): and an unpunctuated lowercase description.

Rule 1834792: Inline docstrings must use Google-style triple-quoted blocks
ocp_resources/resource.py[918-918]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Rewrite the modified `api_request` docstring using the required Google-style `Args:` and `Returns:` layout.

## Issue Context
Parameter types should be expressed in annotations; each `Args:` entry should use `name: description` with a capitalized, punctuated description.

## Fix Focus Areas
- ocp_resources/resource.py[910-923]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
⚠️ Tickets: not configured — ticket URL found in PR but could not be fetched — check ticket provider credentials
✅ Compliance rules (platform): 18 rules

Grey Divider

Tip of the day
💡 Did you know, you can show, collapse, or hide each part of a finding: code, evidence, and all

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread ocp_resources/resource.py Outdated
Comment thread ocp_resources/resource.py Outdated
Comment thread ocp_resources/virtual_machine.py Outdated
Comment thread ocp_resources/virtual_machine_instance.py Outdated
Comment thread tests/unittests/test_resource_retry.py Outdated
Comment thread tests/unittests/test_resource_retry.py Outdated
Comment thread tests/unittests/test_resource_retry.py Outdated
Comment thread tests/unittests/test_resource_retry.py Outdated
Comment thread tests/unittests/test_resource_retry.py Outdated
Comment thread ocp_resources/resource.py
Address PR review feedback:
- Add type annotations to retry_cluster_exceptions, api_request, and
  VM/VMI api_request overrides (matching v4.16 signatures)
- Add from __future__ import annotations for Python 3.8+ compat
- Fix flake8 FCN001: use object.__new__() and keyword args in tests
- Add type hints to all test methods and helpers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rh-bot-1

Copy link
Copy Markdown

omrirh can not be added as reviewer. Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the RedHatQE/openshift-python-wrapper repository.: 422 {"message": "Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the RedHatQE/openshift-python-wrapper repository.", "documentation_url": "https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request", "status": "422"}

@rh-bot-1

Copy link
Copy Markdown

oharan2 can not be added as reviewer. Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the RedHatQE/openshift-python-wrapper repository.: 422 {"message": "Reviews may only be requested from collaborators. One or more of the users or teams you specified is not a collaborator of the RedHatQE/openshift-python-wrapper repository.", "documentation_url": "https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request", "status": "422"}

from ocp_resources.virtual_machine_instance import VirtualMachineInstance


class TestApiRequestRetry:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please remove this unitest, this is old branch.
considare adding this to main instead.

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.

5 participants