Repository navigation
Conversation
Adds an optional registry_id to BenchlingConnection, resolved through
GET /api/v3/registry/{id}. When set, entity schemas and dropdowns are
filtered to that registry, and results schemas to its owning
organization.
On a tenant with several registries and no registry_id, lookups that
match objects in more than one registry raise AmbiguousRegistryError,
and creating a schema or dropdown fails during validation. registry_id
and organization_id raise a clear error in place of a bare assert.
Single-registry tenants without registry_id behave as before.
Closes dynotx#43
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mghent
force-pushed
the
registry-scoping
branch
from
October 22, 2026 12:06
1590769 to
5dc144d
Compare
mghent
marked this pull request as draft
October 22, 2026 12:07
mghent
marked this pull request as ready for review
October 22, 2026 12:16
This was referenced Oct 22, 2026
Collaborator
|
Thanks for this! Let me know your thoughts on this follow up PR #274 and if you're able to manually! |
This branch has not been deployed
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.
Closes #43.
Problem
Liminal assumes a tenant has one registry. On a tenant with several:
plasmidexists in two of them.EntitySchemaModel.get_onereturns the first schema whose warehouse name matches, so an operation onplasmidcould act on a different registry inadvertently.registry_idandorganization_idrun a bareassert len(registries) == 1. It fires insideexecutewhen a revision creates a dropdown or schema, after earlier operations in the revision have already run.Change
BenchlingConnectiongets an optionalregistry_id, resolved withGET /api/v3/registry/{id}. When it is set:list_entity_schemasandlist_dropdownskeep only that registry's records. Results schemas are filtered by the registry's owning organization.registry_idandorganization_idreturn that registry and its owner, so new schemas and dropdowns are created there.liminal_remoteneeds no change. It is found through the filtered list and created with the registry's organization, so each registry gets its own revision history.When
registry_idis not set:AmbiguousRegistryError(aValueError)validate(), before any operation runsThe asserts are replaced with
ValueErrors that give the registry count and say to setregistry_id.The new helpers on
BenchlingServiceare private. The only new public names areregistry_idandAmbiguousRegistryError.The registry is set by ID rather than name. Registry names are case sensitive but shown in capitals in the UI, so names are easy to get wrong. A connection is already per tenant, so a per-tenant ID fits there, and the registry never appears in model or revision files.
Testing
liminal/tests/test_registry_scoping.pycovers registry resolution, list filtering, ambiguous lookups, create validation, and the unchanged single-registry path.registry_idreturned a clear 404 error, an unscopedplasmidlookup raisedAmbiguousRegistryError, andgenerate-filesfollowed bydiffreturned no operations for two registries.liminal_remotewas created there and its revision read back, and all three were archived afterwards. Unscoped creates of a dropdown and a schema both failed invalidate()with no request sent.🤖 Generated with Claude Code