Repository navigation
fix(assets): find public catalog assets by registry id when a workspace is configured - #43
Conversation
…ce is configured
With a workspace configured (CYBERWAVE_WORKSPACE_ID, or the one
get_or_create_quickstart_environment saves), every request carries workspace_uuid,
which on /api/v1/assets limits results to that workspace's own assets. So
cw.twin("dji/tello") failed with "Asset 'dji/tello' not found".
get_by_registry_id now retries a catalog-wide lookup (explicit empty workspace_uuid,
which the client leaves alone) when the workspace-scoped one finds nothing.
Workspace assets still win.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for contributing to the Cyberwave Python SDK, @rishabh-bansal! Maintainer contacts: @KhushiSharma22. When this PR is ready, we request a maintainer review and run an automated advisory review. CI and human review remain the source of truth. Please describe what changed and how you tested it. See the contribution guide or ask for help on Discord. Drafts are welcome. Merged human contributions receive a Discord thank-you. To opt out, check the PR template's Discord opt-out box or add |
|
Slack team notifications
|
Automated advisory review · ClaudeCommit: The patch adds a catalog-wide fallback lookup for public assets by passing an explicit empty `workspace_uuid` query parameter. The logic and tests are mostly sound, but there is one concrete defect: the bare `except Exception: pass` guard around the new catalog-wide lookup silently swallows all failures, including the case where the call succeeds and returns results but processing them raises (e.g. a malformed response). More critically, the same broad suppression already existed on the workspace-scoped call, and the new fallback extends that pattern so a network or deserialization error in `_list_by_registry_id_catalog_wide` is indistinguishable from 'no results', causing `get_by_registry_id` to silently continue to the slower keyword-search fallback rather than surfacing the error. This is a medium-severity behavioral defect introduced by the patch. No other high-confidence defects are evident from the supplied excerpts.
Coverage: 2 of 2 changed files; patch excerpts only. Generated REST code, lockfiles, notebooks, SVGs, missing patches and files beyond the 40-file / 60,000-character budget are excluded. GitHub may truncate individual patches. |
What changed and why?
With a workspace configured, public catalog assets can't be found by registry id, so
cw.twin("dji/tello")fails withCyberwaveError: Asset 'dji/tello' not found.Cause: the client appends the configured workspace (
CYBERWAVE_WORKSPACE_ID, or the oneget_or_create_quickstart_environment()saves onconfig.workspace_id) to every request asworkspace_uuid(_with_workspace_query_param). OnGET /api/v1/assetsthat limits results to the workspace's own assets, so the public catalog disappears.public_only=truedoesn't help, because the workspace filter still applies.Measured against the live API (cyberwave 0.7.5, single-workspace token):
get_by_registry_id("dji/tello")config.environment_idset onlyconfig.workspace_idset (directly or via quickstart)workspace_uuid=(empty) on the callThis hits the common path:
cw.twin("vendor/model")without anenvironment_idcallsget_or_create_quickstart_environment()(which saves the workspace) and then looks up the asset. It also hits anyone who setsCYBERWAVE_WORKSPACE_ID, which the README asks for with multi-workspace tokens.Fix:
get_by_registry_idkeeps the workspace-scoped lookup first, so workspace assets still win. If that finds nothing, it retries the same?registry_id=lookup catalog-wide by passing an explicit emptyworkspace_uuid._with_workspace_query_paramalready leaves an explicitworkspace_uuidalone. No public signature changes;list_by_registry_idis untouched.I haven't been able to test a multi-workspace token. If the backend answers an empty
workspace_uuidwith400 workspace_requiredthere, the new step fails inside the existingtry/exceptand the method behaves as before. If you'd rather fix this server-side, or by not attaching the ambient workspace to catalog reads, I'm happy to rework it.How did you test it?
tests/test_registry_lookup_workspace.py(4 tests): the catalog-wide call sendsworkspace_uuid=""; an explicit empty workspace isn't overwritten by the configured one;get_by_registry_idfalls back when the scoped lookup is empty; a workspace asset still wins without the fallback being called. 3 of them fail onmain.pytest tests/test_registry_lookup_workspace.py tests/test_asset_aliases.py tests/test_slug_support.py tests/test_client_twin.py→ 48 passed.get_or_create_quickstart_environment(),get_by_registry_id("dji/tello")now returns the asset (it returnedNonebefore).mypy cyberwave/resources.py: the same 17 pre-existing errors before and after.Contributor checklist
Recognition
🤖 Generated with Claude Code