Repository navigation
Registry scoping updates - #274
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>
…try_id, move validation to base helpers, clean and simplify implementation
|
Manual testing still to be done |
- list registries from /api/v3/registry/items, without the archived filter that endpoint rejects - entity schema records carry an organization but no registry, so is_in_registry_scope falls back to the registry's organization - check for ambiguous registries only when use_api is set - check registry_id against the registry list on single-registry tenants - tests use record shapes that match the v3 API, and check the registry list request
|
Thanks - I like this approach, it's cleaner. I tested it against our tenant with six registries, and found a few things:
I've opened a PR into your branch with fixes for all four (ndamania00#1), plus tests that use the record shapes the API actually returns. With it, diffs and a round trip are clean on two registries, and creating a dropdown and a schema lands them in the right registry. One unrelated thing I noticed: rolling back a revision that created a schema and the dropdown it uses doesn't work. Liminal won't archive a dropdown that's still in use, but it checks the models in code rather than Benchling, so the dropdown always looks in use. Happy to open a separate issue for that. |
|
Great, thanks! I created an issue here #275 to track the rollback you noticed as well |
fix registry listing and entity schema scoping
|
@mghent I merged in your changes and made one tweak. I reverted the logic in I'm still waiting for Benchling support to update my tenant to have multiple registries so I will merge this in after this gets configured for me and I can do some last testing myself! |
|
Sounds good, thanks! I reran our tests on your latest commit, and diffs and a round trip match our current version across three registries. Let me know if you'd like anything else tested, but I think it's ready to merge. |
|
@mghent Thanks for your patience here. I released multi-registry update in Liminal v5.2.0 and closed out your original PR #262. Thanks again for contributing and testing out the changes on your end. Let me know how Liminal continues to work for you and if you have any other feedback or ideas! |
Some updates to the original PR #262 for registry scoping
BenchlingService.__init__whether it has ambiguous registrieslen(self._registries) > 1 and self.connection.registry_id is Noneregistry_scopedandorganization_scopedtolist_all_items_v3, the base helper method for querying the v3 api.