fix(rbac): preserve stored conditions when conditional reconcile fails#9691
Open
PatAKnight wants to merge 4 commits into
Open
fix(rbac): preserve stored conditions when conditional reconcile fails#9691PatAKnight wants to merge 4 commits into
PatAKnight wants to merge 4 commits into
Conversation
Contributor
Changed Packages
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent loss of stored conditional RBAC policies when a conditional reconcile/reload fails (e.g., due to permission metadata lookup failures), by staging additions and only applying removals after additions succeed, plus adding batch-abort auditing/logging.
Changes:
- Reworked conditional policy reconciliation to “add first, then remove” and added a batch-abort audit/log helper.
- Added new helper utilities (
diffConditionalPolicies,abortConditionalPolicyReconcile) with unit tests. - Updated provider and YAML watcher test suites and added a changeset entry.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| workspaces/rbac/plugins/rbac-backend/src/providers/connect-providers.ts | Changes conditional reconcile flow; adds abort auditing and diffing helper usage. |
| workspaces/rbac/plugins/rbac-backend/src/providers/connect-providers.test.ts | Adds regression test for “preserve on add failure” and updates audit expectations. |
| workspaces/rbac/plugins/rbac-backend/src/helper.ts | Introduces diff + reconcile-abort helper and logging/auditing behavior. |
| workspaces/rbac/plugins/rbac-backend/src/helper.test.ts | Adds unit tests for new helper utilities. |
| workspaces/rbac/plugins/rbac-backend/src/file-permissions/yaml-conditional-file-watcher.ts | Changes YAML reload flow to stage additions before removals and adds abort auditing. |
| workspaces/rbac/plugins/rbac-backend/src/file-permissions/yaml-conditional-file-watcher.test.ts | Updates expectations and adds regression test for metadata-unavailable reload. |
| workspaces/rbac/.changeset/beige-timers-marry.md | Patch changeset describing the behavioral change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Assisted-by: Cursor AI Signed-off-by: Patrick Knight <pknight@redhat.com>
…e conflicts Assisted-by: Cursor AI Signed-off-by: Patrick Knight <pknight@redhat.com>
…l reconcile failures Assisted-by: Cursor AI Signed-off-by: Patrick Knight <pknight@redhat.com>
Assisted-by: Cursor AI Signed-off-by: Patrick Knight <pknight@redhat.com>
d2c294f to
c0f34b8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey, I just made a Pull Request!
Conditional policy reload used remove-then-add ordering, so when adds failed (e.g. Catalog permission metadata 503), stored conditions were already deleted.
Reconciliation now stages and persists all additions before any removals. On add-phase failure, stored conditions are preserved and a batch abort is logged/audited via abortConditionalPolicyReconcile in helper.ts.
✔️ Checklist
Signed-off-byline in the message. (more info)