fix(BA-7857): write a registry's allowed projects in the update's transaction - #14562
Draft
jopemachine wants to merge 2 commits into
Draft
fix(BA-7857): write a registry's allowed projects in the update's transaction#14562jopemachine wants to merge 2 commits into
jopemachine wants to merge 2 commits into
Conversation
jopemachine
added a commit
that referenced
this pull request
Sep 11, 2026
…nsaction `admin_update` wrote the allowed-project links through the rbac relation calls before it updated the registry row, each in a transaction of its own. An update refused after that — a URL with no host, a harbor registry left without a project, an id that holds nothing — left the links changed, so a caller told its call had failed had had half of it applied. The links now ride with the update. `UpdateContainerRegistryAction` carries what to allow and stop allowing, and the repository writes the row and the links on one session, so a refusal rolls back both. `ContainerRegistryRepository` already held the relation ops provider and `V2RelationWriteOps` already extends the general write ops, so this needed no new session plumbing. `apply_allowed_groups` stays for the create path and its other callers, where it is the whole of what the call does. The relation permission gate is not lost on this path: it only ever refuses a caller who is not a superadmin, and the update itself is behind the superadmin role, so no caller reaches one check without the other. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013TYyokzEfpr9AF2NnHtyXB
jopemachine
force-pushed
the
fix/BA-7857-allowed-groups-after-update
branch
from
September 11, 2026 05:48
a98e6e0 to
9da3bc2
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.
Found while writing the container registry scenarios (#14519).
Summary
admin_updatewrote the allowed-project links through the rbac relation calls before it updated the registry row, each in a transaction of its own. An update refused after that left the links changed, so a caller told its call had failed had had half of it applied.UpdateContainerRegistryActioncarries what to allow and stop allowing, and the repository writes the row and the links on one session, so a refusal rolls back both.Why this needed no new plumbing
ContainerRegistryRepositoryalready takes aRelationOpsProvider, andV2RelationWriteOpsalready extends the general write ops. Onewrite_ops()can doupdate_dataandcreate_relations/purge_relationstogether, which is whatmodify_registrynow does.How to see the old behaviour
Send one update that changes the allowed projects and sets a URL with no host. Before: the links are written, the update is refused with
InvalidContainerRegistryURL, the links stay changed. After: nothing changes.What is not touched
apply_allowed_groupsstays as it was, for the create path and its four other callers, where the link change is the whole of what the call does.Resolves BA-7857
🤖 Generated with Claude Code
https://claude.ai/code/session_013TYyokzEfpr9AF2NnHtyXB