Skip to content

feat: scope services and usage by tenant#247

Open
Muyutxd1 wants to merge 1 commit into
Agentpay-Org:mainfrom
Muyutxd1:feature/api-09-tenant-scoping
Open

feat: scope services and usage by tenant#247
Muyutxd1 wants to merge 1 commit into
Agentpay-Org:mainfrom
Muyutxd1:feature/api-09-tenant-scoping

Conversation

@Muyutxd1

@Muyutxd1 Muyutxd1 commented Jul 8, 2026

Copy link
Copy Markdown

Closes #39

/claim #39

Summary

  • add a request tenant resolver that derives tenant scope from a recognized X-API-Key and falls back to the legacy public tenant when no valid key is present
  • scope service registration, reads, metadata, disabled state, price/delete mutations, usage accumulation, exports, billing, settlement, and service/agent rollups by tenant
  • keep cross-tenant service access as 404 not_found and add regression tests for same-service-id isolation, mutation isolation, settlement isolation, and public-tenant fallback
  • document the multi-tenant behavior and internal API-key hashing

Tests

pm run build

pm test (93 tests passed; on Windows run with
pm_config_script_shell pointed at Git Bash so the existing POSIX NODE_ENV=test script executes as written)

pm run lint

Isolation notes

  • Store keys keep the existing public-tenant shape for backwards compatibility, while recognized API-key tenants use hashed internal tenant ids.
  • Cross-tenant reads and mutations intentionally return 404 not_found so service ids cannot be enumerated across tenants.

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.

Add per-service multi-tenant ownership so services and usage are scoped to a tenant

1 participant