fix: skip duplicate Analysis stage in approve & upgrade flow#12
fix: skip duplicate Analysis stage in approve & upgrade flow#12jrangelramos wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jrangelramos 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 |
|
Thanks for catching this @jrangelramos 🏆 the bug is real and the fix is correct for the However, there's a second unguarded caller of Rather than adding the same guard at every call site, could we move the dedup check into const existingStages = currentApproval.spec?.stages ?? [];
if (existingStages.some((s) => s.type === stageType)) return true; // already approvedThis makes |
b48613f to
c87396b
Compare
|
LGTM 👍 the idempotent guard in the hook looks great, thanks for moving it there @jrangelramos One small nit.... |
When an ApprovalPolicy auto-approves the Analysis stage, calling
approveStage('Analysis') again would fail with a duplicate error.
Move the guard into the hook itself so all callers are protected.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c87396b to
190d4b9
Compare
|
just dropped that! thanks |
|
@jrangelramos: 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. |
Summary
Duplicate value: {"type":"Analysis"}becauseapproveStage('Analysis')was called unconditionallyapproveStage, preventing the duplicate key API errorapproval?.spec?.stagesto theuseCallbackdependency array to satisfy the exhaustive-deps lint ruleTest plan
approveStage('Analysis')normallyyarn testpasses (56/56)🤖 Generated with Claude Code