Skip to content

refactor: make endpoints stable or public - #5227

Merged
borosr merged 2 commits into
mainfrom
refactor/remove-api-extensions
Oct 2, 2026
Merged

borosr merged 2 commits into
mainfrom
refactor/remove-api-extensions

Conversation

@borosr

@borosr borosr commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Ticket: OM-550

Overview

Fixes #(issue)

Notes for reviewer

Summary by CodeRabbit

  • New Features
    • Expanded the JavaScript SDK with access to grants, invoices, charges, currencies, entitlement access, and notifications.
    • Added app catalog and installation management, customer entitlement and charge operations, and subscription unscheduling, restoration, and migration.
    • Added listing and pagination support across more resources, including plan add-ons, entitlements, and grants.
  • Changes
    • Several API operations are now marked as unstable.
    • The LLM cost pricing endpoint is deprecated.

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no new actionable issue or outstanding previous finding was identified.

Fix All in Claude CodeFindings

  1. P1 SDK tests no longer compile ▶
Fix with agent prompt
### Issue 1
api/spec/packages/aip-client-javascript/src/sdk/sdk.ts:80-84
Moving these operations to public getters removes the old `client.internal.*` paths, but the checked-in tests and their generator templates still use `internal.customers.*` and `internal.currencies.*`. They also assert that `currencies` is not public. The SDK typecheck fails with three `TS2339` errors, blocking the generated-package check. Update both sets of tests to use and verify the new public paths.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR changes endpoint visibility in TypeSpec and OpenAPI, moves the corresponding JavaScript SDK operations from internal to public clients, and updates the generated documentation and tests. The changes since the previous review update both the checked-in tests and their generator templates for the new client paths.

Reviews (2) · Last reviewed commit: "test(api): align SDK conformance tests w..."

@borosr borosr self-assigned this Oct 1, 2026
@borosr borosr added release-note/misc Miscellaneous changes kind/refactor Code refactor, cleanup or minor improvement labels Oct 1, 2026
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openmeterio/openmeter/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 987aed05-21f1-418d-adbc-989422cd7cdc

📥 Commits

Reviewing files that changed from the base of the PR and between 72c0e47 and f61faf2.

⛔ Files ignored due to path filters (1)
  • api/v3/openapi.yaml is excluded by !**/openapi.yaml
📒 Files selected for processing (35)
  • api/spec/packages/aip-client-javascript/README.md
  • api/spec/packages/aip-client-javascript/src/index.ts
  • api/spec/packages/aip-client-javascript/src/sdk/apps.ts
  • api/spec/packages/aip-client-javascript/src/sdk/charges.ts
  • api/spec/packages/aip-client-javascript/src/sdk/currencies.ts
  • api/spec/packages/aip-client-javascript/src/sdk/customers.ts
  • api/spec/packages/aip-client-javascript/src/sdk/entitlementAccess.ts
  • api/spec/packages/aip-client-javascript/src/sdk/entitlements.ts
  • api/spec/packages/aip-client-javascript/src/sdk/grants.ts
  • api/spec/packages/aip-client-javascript/src/sdk/internal.ts
  • api/spec/packages/aip-client-javascript/src/sdk/planAddons.ts
  • api/spec/packages/aip-client-javascript/src/sdk/sdk.ts
  • api/spec/packages/aip-client-javascript/src/sdk/subscriptions.ts
  • api/spec/packages/aip-client-javascript/tests/internal.spec.ts
  • api/spec/packages/aip-client-javascript/tests/nesting.spec.ts
  • api/spec/packages/aip/src/apps/operations.tsp
  • api/spec/packages/aip/src/charges/operations.tsp
  • api/spec/packages/aip/src/currencies/cost-bases/operations.tsp
  • api/spec/packages/aip/src/currencies/operations.tsp
  • api/spec/packages/aip/src/customers/charges/operations.tsp
  • api/spec/packages/aip/src/customers/credits/operations.tsp
  • api/spec/packages/aip/src/customers/entitlements/grants/operations.tsp
  • api/spec/packages/aip/src/customers/entitlements/operations.tsp
  • api/spec/packages/aip/src/entitlement-access/operations.tsp
  • api/spec/packages/aip/src/entitlements/operations.tsp
  • api/spec/packages/aip/src/grants/operations.tsp
  • api/spec/packages/aip/src/invoices/operations.tsp
  • api/spec/packages/aip/src/konnect.tsp
  • api/spec/packages/aip/src/notifications/operations.tsp
  • api/spec/packages/aip/src/productcatalog/operations.tsp
  • api/spec/packages/aip/src/subscriptions/operations.tsp
  • api/spec/packages/aip/src/tax/operations.tsp
  • api/spec/packages/typespec-typescript/templates/tests/internal.spec.ts
  • api/spec/packages/typespec-typescript/templates/tests/nesting.spec.ts
  • api/v3/api.gen.go
💤 Files with no reviewable changes (15)
  • api/spec/packages/aip/src/charges/operations.tsp
  • api/spec/packages/aip/src/customers/charges/operations.tsp
  • api/spec/packages/aip/src/grants/operations.tsp
  • api/spec/packages/aip/src/customers/credits/operations.tsp
  • api/spec/packages/aip/src/apps/operations.tsp
  • api/spec/packages/aip/src/entitlements/operations.tsp
  • api/spec/packages/aip/src/tax/operations.tsp
  • api/spec/packages/aip/src/entitlement-access/operations.tsp
  • api/spec/packages/aip/src/subscriptions/operations.tsp
  • api/spec/packages/aip/src/notifications/operations.tsp
  • api/spec/packages/aip/src/customers/entitlements/grants/operations.tsp
  • api/spec/packages/aip/src/currencies/cost-bases/operations.tsp
  • api/spec/packages/aip/src/invoices/operations.tsp
  • api/spec/packages/aip/src/customers/entitlements/operations.tsp
  • api/spec/packages/aip/src/currencies/operations.tsp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The pull request changes API operation annotations and expands the JavaScript SDK with clients and methods for app, billing, entitlement, grant, notification, and subscription operations. It also updates SDK exports, internal accessors, and route tests.

Changes

SDK and API operation updates

Layer / File(s) Summary
Update API operation metadata
api/spec/packages/aip/src/..., api/v3/api.gen.go
Operation annotations change across multiple API areas. The LLM cost prices endpoint is marked deprecated. The embedded OpenAPI payload changes, but the decoded specification changes are not visible in the diff.
Add resource SDK methods and clients
api/spec/packages/aip-client-javascript/src/sdk/apps.ts, charges.ts, currencies.ts, entitlementAccess.ts, entitlements.ts, grants.ts, planAddons.ts
The SDK adds app management and catalog methods, new clients for charges, currencies, entitlement access, and grants, and paginated list methods for several resources.
Add customer and subscription operations
api/spec/packages/aip-client-javascript/src/sdk/customers.ts, subscriptions.ts
Customer clients add entitlement and grant operations, credit-grant voiding, and customer charge methods. Subscription methods add unschedule, restore, and migrate operations.
Wire SDK clients and revise internal access
api/spec/packages/aip-client-javascript/src/index.ts, sdk.ts, internal.ts, tests/*, api/spec/packages/typespec-typescript/templates/tests/*
The package and OpenMeter expose additional clients. Internal retains subscription add-on creation and update methods. Tests check those routes and use customers.charges.list() directly.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Suggested reviewers: borbelyr-kong

Merge Risk: ⚪ Minimal · up to f61fa

The SDK exposure changes and revised tests are consistent with the intended public surface. No merge-blocking issue was identified; complete the normal package checks with dependencies available before merging.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to f61fa

The change makes sensitive administrative operations available through public API contracts. Existing server-side namespace and lifecycle checks provide important controls, but deployed authorization and failure-recovery guarantees have not been established. No authentication bypass or cross-tenant vulnerability was verified.

Retained concerns

  • Medium · security · inferred: The expanded specification feeds runtime request validation as well as public documentation. Newly represented sensitive operations may therefore gain effective reachability, while the deployed authorization and identity-to-namespace controls for those callers remain unverified. Configurable middleware and namespaced subscription requests are counterevidence against assuming an authentication bypass.
Security review details

Security Blast Radius

  • inferred — The potential affected assets include installed applications, customer feature-access and balance state, currency cost bases and subscription lifecycle records. Administrative grant listing spans multiple customers and entitlements. The maximum independently attackable scope depends on deployed credential privileges and namespace binding, which were not established.

Security Findings and Attack Paths

  • inferred — The security-relevant path is caller-supplied resource identifiers and mutation bodies through shared client credentials, server middleware and namespace resolution to authoritative state-changing services. Inspection did not verify an attacker-controlled identity transition or control bypass along this path; deployed enforcement remains unresolved.

Trust Boundaries and Controls

  • observed — Subscription handlers preserve namespaced resource identity. Migration also resolves the target plan within that namespace and rejects custom subscriptions, non-later plan versions, deleted plans and unsuitable plan statuses. These controls limit invalid transitions but do not establish caller authorization.

Resilience and Maintainability Implications

  • observed — Inspected end-to-end tests cover scheduled-subscription removal, active-state rejection and restore successor cleanup while retaining the current identity. They do not establish the full interruption, repetition, concurrency and partial-failure contract for newly public lifecycle operations.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: promoting selected endpoints to stable or public access while refactoring the SDK surface.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@borosr
borosr marked this pull request as ready for review October 1, 2026 20:38
@borosr
borosr requested a review from a team as a code owner October 1, 2026 20:38
@borosr
borosr requested review from rolosp and tothandras October 1, 2026 20:38
@borosr
borosr marked this pull request as draft October 1, 2026 20:39
@borosr
borosr removed request for rolosp and tothandras October 1, 2026 20:39
Comment on lines 80 to +84
}

private _currencies?: Currencies
get currencies(): Currencies {
return (this._currencies ??= new Currencies(this))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 SDK tests no longer compile

Moving these operations to public getters removes the old client.internal.* paths, but the checked-in tests and their generator templates still use internal.customers.* and internal.currencies.*. They also assert that currencies is not public. The SDK typecheck fails with three TS2339 errors, blocking the generated-package check. Update both sets of tests to use and verify the new public paths.

Prompt To Fix With AI
This is a comment left during a code review.
Path: api/spec/packages/aip-client-javascript/src/sdk/sdk.ts
Line: 80-84

Comment:
**SDK tests no longer compile**

Moving these operations to public getters removes the old `client.internal.*` paths, but the checked-in tests and their generator templates still use `internal.customers.*` and `internal.currencies.*`. They also assert that `currencies` is not public. The SDK typecheck fails with three `TS2339` errors, blocking the generated-package check. Update both sets of tests to use and verify the new public paths.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

Credit grant void, currencies and customer charges are public now; only
subscription add-on create/update remain x-internal.
@borosr
borosr marked this pull request as ready for review October 1, 2026 20:47
@borosr
borosr requested review from rolosp and tothandras October 1, 2026 21:04
@borosr
borosr merged commit e609679 into main Oct 2, 2026
1 check passed
@borosr
borosr deleted the refactor/remove-api-extensions branch October 2, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor Code refactor, cleanup or minor improvement release-note/misc Miscellaneous changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants