Answer 404 when revoking a function from a component that does not exist - #675
Merged
davidmckayv merged 1 commit intoOct 2, 2026
Merged
Conversation
DELETE /api/components/:name/functions/:function was the one grant write that did not check the component exists. Against a name nobody has, it deleted nothing, answered revoked: true and wrote a component.function_revoked row naming a component that was never there. It now answers 404 and writes nothing, as granting a function and withholding a component already do. A function grant cannot outlive its component, so no stored row becomes unremovable.
asasemahmed
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
October 1, 2026 04:25
davidmckayv
approved these changes
Oct 2, 2026
davidmckayv
enabled auto-merge (squash)
October 2, 2026 03:55
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.
What this changes
DELETE /api/components/:name/functions/:functioncallsstore.revokeFunction, which was the onlyone of the four component grant writes that did not ask whether the component exists:
grant,revokeandgrantFunctionall callrequireComponentfirst, and the routes for the other threecatch
ComponentNotFoundErrorand answer 404.revokeFunctionjust deleted, so against a namenobody has it deleted zero rows, the route answered
{ "revoked": true }, andcomponent.function_revokedwas written for a component that was never there.
revokeFunctionnow callsrequireComponentand the route answers 404 with the store's own message,as
POST /:name/functionsdoes.The principle #616 records, that taking something away is always allowed so a dead row stays
removable by hand, does not apply here.
component_functions.component_namereferencescomponents.namewithON DELETE CASCADE, so a function grant cannot outlive its component and arevoke against a missing one can only ever delete nothing.
Where it runs
componentsbefore the delete.Boundary and audit
Changelog
CHANGELOG.mdunderUnreleased.Proof
component-grants-skills-validation.test.ts: a revoke against a component that does not existanswers 404 with "No component is called nothing." and records no audit row; against one that
does, it revokes, answers
{ revoked: true }and recordscomponent.function_revoked.component-store.integration.test.ts, beside the existing "withholding a component that does notexist is an error, not a silent row": revoking a function from a missing component throws
ComponentNotFoundError.sandboxed-components.integration.test.ts, 51 pass.Against
main, the two new cases fail.bun run format:check,bun run lint,bun run typecheck: clean.