Skip to content

Fix result CR status not updated on retry#41

Draft
jameswnl wants to merge 1 commit into
openshift:mainfrom
jameswnl:fix/result-cr-update-on-retry
Draft

Fix result CR status not updated on retry#41
jameswnl wants to merge 1 commit into
openshift:mainfrom
jameswnl:fix/result-cr-update-on-retry

Conversation

@jameswnl
Copy link
Copy Markdown

@jameswnl jameswnl commented Jun 3, 2026

Summary

  • When a proposal step was retried and the result CR already existed (same name from resultCRName), createIdempotent silently returned nil on AlreadyExists, leaving stale failure data in the CR
  • This caused AnalysisResult (and other result types) to show failed status/conditions even when the retry succeeded — the proposal would show Analyzed: True (Complete) but the result CR still contained the old failure reason
  • Now on AlreadyExists, the existing CR is fetched and its status is patched with the latest result data (options, actions, checks, conditions, sandbox info, failure reason)

Test plan

  • TestCreateIdempotent_AlreadyExists updated to verify status is updated (not skipped)
  • All existing tests pass: go test ./controller/proposal/... -count=1
  • End-to-end verified: proposal failed on first attempt (local operator, DNS unreachable), succeeded on retry (in-cluster operator) — result CR now reflects success

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Important

Review skipped

Draft detected.

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: Enterprise

Run ID: aa4cbf6f-8fab-482a-8f55-9ba73e3cff6f

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

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 and usage tips.

@openshift-ci openshift-ci Bot requested review from blublinsky and harche June 3, 2026 03:35
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 3, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign xrajesh 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

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 3, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 3, 2026

Hi @jameswnl. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@jameswnl jameswnl marked this pull request as draft June 3, 2026 03:42
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 3, 2026
@jameswnl jameswnl force-pushed the fix/result-cr-update-on-retry branch from e40f953 to 0ce6363 Compare June 3, 2026 03:45
When a proposal step is retried and the result CR name collides with an
existing one, createIdempotent previously returned nil on AlreadyExists,
leaving stale failure data in the CR. This caused the AnalysisResult to
show a failed status even when the retry succeeded.

Now on AlreadyExists, the existing CR is fetched and its status is
patched with the new result data (options, actions, checks, conditions,
sandbox info, failure reason) while preserving the original metadata
and spec.

- Use comma-ok type assertions in copyResultStatus for safety
- Add test for the core retry scenario: stale failure data overwritten
  with success data, verifying FailureReason is cleared

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jameswnl jameswnl force-pushed the fix/result-cr-update-on-retry branch from 0ce6363 to d4d2a37 Compare June 3, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants