[PLT-4347] Route embedding metadata operations through GraphQL - #2074
[PLT-4347] Route embedding metadata operations through GraphQL#2074abacchilb wants to merge 1 commit into
Conversation
New opaque lbx_ API keys are accepted by lb-api but not by ADV's JWT-only authentication. Keep the public SDK methods unchanged while sending embedding create, list, lookup, and delete operations through lb-api's existing GraphQL resolvers. Leave the streaming NDJSON import and vector-count calls on ADV for now, pending usage analysis and a dedicated data-plane migration.
Datadog follow-up on remaining direct ADV callsI queried
Recommendation: keep NDJSON import and vector count as an explicit follow-up rather than blocking PLT-4347. Before removing them, either run a longer-retention ingress/access-log analysis or announce deprecation; if they must support opaque keys, add narrow lb-api data-plane endpoints rather than reopening broad ADV customer-key auth. |
|
Staging CI: red checks are pre-existing, not this PRThe GraphQL embedding path is working. After cleanup, all live embedding tests passed against staging:
Lint, Bugbot, TruffleHog, Snyk, Test-PyPI, and test-container are also green. What we tried
3.11 after cleanup (run 32502258457):
Zero embedding errors remaining. Remaining failures (not this change)unit-data — all 9 in Staging turned the feature off; tests were never updated. integration — same 5 tests as on
Historical
|
| Run | Date | Integration |
|---|---|---|
| 29933222859 | Jul 22 | 4 failed, 307 passed — same test_delete_non_existent_schema_id trio |
| 30362386905 | Jul 28 | 4 failed, 307 passed |
| this PR | Aug 21 | 5 failed, 306 passed after cleanup |
This branch is not regressing the suite. Further re-runs will not go green until those staging tests are fixed on develop.
Problem
New API keys are opaque
lbx_secrets. lb-api accepts both legacy JWT keys and opaque keys, but the SDK's embedding methods bypass lb-api and send the customer's bearer token directly to ADV. ADV assumes every token is a JWT, returns a non-JSON 401, andAdvClientsurfaces that asJSONDecodeError.Fixes PLT-4347.
Change
Keep the public SDK API unchanged, but route embedding metadata operations through lb-api's existing GraphQL resolvers:
Client.create_embedding()→createEmbeddingClient.get_embeddings()→embeddingsClient.get_embedding_by_id()→ filters the bounded GraphQL list (organizations are limited to 10 embeddings)Embedding.delete()→deleteEmbeddingEmbeddingnow receives the top-levelClient, which implements the small interface needed by the model.No platform/ADV authentication changes and no nginx routing changes are required.
Follow-up: remaining direct ADV calls
These data-plane operations intentionally remain on
AdvClient:PUT /adv/v1/embeddings/{id}/_import_ndjson(Embedding.import_vectors_from_file)GET /adv/v1/embeddings/{id}/vectors/_count(Embedding.get_imported_vector_count)They still require a legacy JWT API key today. We are checking Datadog usage before deciding whether to add narrow lb-api proxy endpoints, migrate them another way, or deprecate them.
AdvClienthas been reduced to only those remaining operations so the boundary is explicit.Verification
libs/labelbox/tests/unitsuite with data extras: 291 passedMade with Cursor