OCPBUGS-94042: Return proper 404 when deleting a non-existent project - #671
OCPBUGS-94042: Return proper 404 when deleting a non-existent project#671tchap wants to merge 1 commit into
Conversation
|
@tchap: This pull request references Jira Issue OCPBUGS-94042, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughProject deletion now returns project not-found errors immediately. Other lookup errors retain their retry and contextual wrapping behavior. Tests verify error classification, request count, and validation calls. ChangesProject deletion error handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@tchap: This pull request references Jira Issue OCPBUGS-94042, which is valid. 3 validation(s) were run on this bug
DetailsIn response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/project/apiserver/registry/project/proxy/proxy_test.go`:
- Around line 248-268: Update the test case’s expected error assertion to verify
the not-found classification with kerrors.IsNotFound(err), rather than requiring
an unwrapped StatusError or matching only its message. Preserve the existing
no-retry behavior and expectedValidationCalls assertion.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ffdc39f4-496d-45c3-82e4-2943dae90ac6
📒 Files selected for processing (2)
pkg/project/apiserver/registry/project/proxy/proxy.gopkg/project/apiserver/registry/project/proxy/proxy_test.go
The project delete handler wraps NotFound errors from the underlying namespace GET with fmt.Errorf, turning the *StatusError into a *fmt.wrapError. The apiserver framework's ErrorToAPIStatus uses a direct type assertion (not errors.As) to extract the status, so the wrapped error falls through to the default case and produces HTTP 500 with no Reason. This makes --ignore-not-found ineffective because errors.IsNotFound checks for Reason=NotFound or Code=404. Return NotFound errors unwrapped from getProjectForDeletion and treat them as terminal in the retry loop so the original StatusError reaches ErrorToAPIStatus intact, producing a proper 404 response.
3d9fafc to
1cb13a9
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
@tchap: all tests passed! 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. |
|
Verified on a ClusterBot cluster that |
The project delete handler wraps NotFound errors from the underlying namespace GET with fmt.Errorf, turning the *StatusError into a *fmt.wrapError. The apiserver framework's ErrorToAPIStatus uses a direct type assertion (not errors.As) to extract the status, so the wrapped error falls through to the default case and produces HTTP 500 with no Reason. This makes --ignore-not-found ineffective because errors.IsNotFound checks for Reason=NotFound or Code=404.
Return NotFound errors unwrapped from getProjectForDeletion and treat them as terminal in the retry loop so the original StatusError reaches ErrorToAPIStatus intact, producing a proper 404 response.
Summary by CodeRabbit