fix(builder-api): customer ULID for access/grants + USAGE.md - #87
fix(builder-api): customer ULID for access/grants + USAGE.md#87eliteprox wants to merge 1 commit into
Conversation
Access and grant handlers were passing the compound customer key into credits/entitlement routes, which Konnect addresses by ULID only (key → 404). Look up the customer by key first. Add USAGE.md for live admin queries.
|
Superseded: reverting #81 on main and reopening the admin usage PR with this fix folded in (customer ULID resolve + USAGE.md). |
There was a problem hiding this comment.
Pull request overview
This PR fixes builder-api’s admin “access” and “grants” routes to resolve a tenant-scoped OpenMeter customer key ({clientId}:{externalUserId}) into the Konnect/OpenMeter customer ULID before calling credits/entitlement APIs (which require the ULID). It also adds integrator-facing documentation for querying usage against the live admin API and updates tenant-isolation docs to match the actual platform admin env var names.
Changes:
- Add
LookupCustomerByKeyto the OpenMeter client/admin interface and use it in access/grant handlers to map key → ULID before downstream calls. - Extend boundary tests to assert that access/grant routes perform the key→ULID resolution and return 404 for missing customers.
- Add
docs/USAGE.mdand update existing docs/README to reference it and correct env var names.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| openmeter-collector/builder-api/README.md | Links to the new usage guide for live admin API curl examples. |
| openmeter-collector/builder-api/internal/openmeter/customer.go | Exposes LookupCustomerByKey on the OpenMeter client (delegates to existing key lookup). |
| openmeter-collector/builder-api/internal/httpapi/admin.go | Adds key→ULID resolution helper and switches access/grant handlers to use customer ULID. |
| openmeter-collector/builder-api/internal/httpapi/boundary_test.go | Updates fakes + adds tests covering resolution behavior and missing-customer 404. |
| openmeter-collector/builder-api/docs/USAGE.md | New operator/integrator documentation for usage/access/grants querying via builder-api. |
| openmeter-collector/builder-api/docs/TENANT-ISOLATION.md | Corrects platform admin env var names to AUTH0_SIGNER_M2M_*. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
{clientId}:{externalUserId}→ Konnect customer ULID before calling credits/entitlement APIs (keys return 404 on those paths).AUTH0_SIGNER_M2M_*.Test plan
go test ./...inopenmeter-collector/builder-apiTestAccessAndGrantResolveCustomerID/TestAccessMissingCustomerIs404/users/{id}/accesshits credits by ULID (non-404)