Skip to content

fix(builder-api): customer ULID for access/grants + USAGE.md - #87

Closed
eliteprox wants to merge 1 commit into
mainfrom
fix/admin-customer-id
Closed

fix(builder-api): customer ULID for access/grants + USAGE.md#87
eliteprox wants to merge 1 commit into
mainfrom
fix/admin-customer-id

Conversation

@eliteprox

Copy link
Copy Markdown
Collaborator

Summary

  • Addresses the two open Copilot comments on feat(builder-api): tenant-scoped usage and allowance admin API #81: access and grant routes now resolve {clientId}:{externalUserId} → Konnect customer ULID before calling credits/entitlement APIs (keys return 404 on those paths).
  • Adds docs/USAGE.md for querying usage against the live builder-api.
  • Corrects platform admin env var names in TENANT-ISOLATION.md to match AUTH0_SIGNER_M2M_*.

Test plan

  • go test ./... in openmeter-collector/builder-api
  • New TestAccessAndGrantResolveCustomerID / TestAccessMissingCustomerIs404
  • Redeploy builder-api and confirm /users/{id}/access hits credits by ULID (non-404)

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.
Copilot AI lite review requested due to automatic review settings August 17, 2026 22:01
@eliteprox

Copy link
Copy Markdown
Collaborator Author

Superseded: reverting #81 on main and reopening the admin usage PR with this fix folded in (customer ULID resolve + USAGE.md).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 LookupCustomerByKey to 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.md and 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants