Repository navigation
fix(authorization): serve delete by organization, type and external id - #209
Open
etiennecoutaud wants to merge 1 commit into
Open
etiennecoutaud wants to merge 1 commit into
etiennecoutaud wants to merge 1 commit into
Conversation
[Medium impact] The PR appears safe to merge. SummaryAdds resource deletion by organization, resource type, and external ID using the existing delete rules.
No actionable issues found. Reviews (1) · Last reviewed commit: "fix(authorization): serve delete by orga..." · Reviewed by Greptile |
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.
Summary
DELETE /authorization/organizations/:organization_id/resources/:resource_type_slug/:external_idhad no route, so deleting a resource by external id (DeleteResourceByExternalIDin workos-go, with or withoutcascade_delete) got404 Not Found. The emulator already servedGETandPATCHon that path, andDELETEby resource id.Fixes #207
Behavior
Checked against a WorkOS staging environment, on a resource holding one role assignment:
cascade_delete409 resource_has_dependents404 Not Foundcascade_delete=true204, resource gone404 Not FoundThe emulator now matches both rows.
What changed
deleteResource(c, resource, ref), shared by both routes, the wayupdateResourceis shared by thePATCHroutes.docs/behavior.md: the FGA / Authorization section notes that deletes are served by id and by external id, with the same rules.SUPPORTED.mdregenerated: FGA / Authorization write coverage goes from 24/27 to 25/27.No other endpoint changes behavior.
Tests
authorization-resources.spec.ts: the409withoutcascade_delete, the204with it (the child resource is deleted too), and the404for an unknown resource. It fails onmain.bun test(2091 pass),bun run typecheck,bun run lint,bun run fmt:check,bun run build,node scripts/check-package.mjs,node scripts/smoke-node.mjs, and the codegen andSUPPORTED.mddrift checks all pass.