Fix key manager deletion blocked when linked to applications (#3164) - #3181
Fix key manager deletion blocked when linked to applications (#3164)#3181lahiruudayakumara wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 46 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
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. Comment |
Purpose
When attempting to delete a Key Manager that has linked application OAuth client ID mappings (
app_key_mappings), the operation failed due to a database foreign key constraint error (SQLITE_CONSTRAINT_FOREIGNKEY). This PR ensures linked application key mappings are cleaned up before removing the key manager record.Resolves #3164
Goals
Approach
keyManagerDao.js): UpdateddeleteKmto accept a transaction handle and delete dependent rows fromapp_key_mappings(WHERE km_uuid = ?) before deleting the row fromkey_managers.keyManagerService.js): WrappedkmDao.deleteinsidedb.withTransactionto guarantee atomicity.src/dao/keyManagerDao.test.jsto verify query execution order.it/rest-api/key-managers/key-managers.spec.jsasserting successful deletion (HTTP 204) of a Key Manager linked to an application.User stories
As an API Portal administrator, I can delete a Key Manager even when applications have registered client IDs against it, without encountering database foreign key errors.
Documentation
N/A - Bug fix addressing internal cascading delete logic. No changes to user documentation or public API contracts.
Automation tests
Security checks
Samples
N/A
Related PRs
N/A
Test environment