Skip to content

fix(api/spec): typespec dependency update - #4798

Merged
tothandras merged 2 commits into
mainfrom
fix/python-sdk-client-import
Jul 27, 2026
Merged

tothandras merged 2 commits into
mainfrom
fix/python-sdk-client-import

Conversation

@tothandras

@tothandras tothandras commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4530

Summary by CodeRabbit

  • Documentation
    • Refreshed Swagger/OpenAPI specifications and improved formatting for credit purchase examples, including guidance for zero-cost funding.
  • Maintenance
    • Updated TypeSpec/TypeScript/related tooling and version pins.
    • Improved generated client type formatting (no contract/behavior changes).
    • Adjusted workspace package resolution and tool package extensions.
  • Tests
    • Updated compilation/test templates to rely on existing TypeSpec “using” directives rather than explicit imports.

Greptile Summary

Updates the TypeSpec toolchain and regenerates the corresponding API artifacts.

  • Refreshes TypeSpec dependencies, patches, workspace configuration, and emitter tests.
  • Regenerates OpenAPI documents and Go, Python, and TypeScript clients.
  • Updates API descriptions and generated model formatting.

Confidence Score: 4/5

The PR appears safe to merge, although the previously reported regeneration-preservation concern remains unresolved.

The checked-in Python initializer currently exports Client correctly, but the refreshed emitter patch does not explicitly ensure that this handwritten wrapper survives a future SDK regeneration.

Files Needing Attention: api/spec/patches/@typespec__http-client-python.patch

Important Files Changed

Filename Overview
api/spec/patches/@typespec__http-client-python.patch Refreshes the Python emitter patch.
api/client/python/openmeter/init.py Expands the package initializer to expose the handwritten Client wrapper, version metadata, and generated SDK patches.
api/spec/pnpm-lock.yaml Updates the resolved TypeSpec dependency graph for the toolchain upgrade.
api/openapi.yaml Regenerates the primary OpenAPI specification with documentation and formatting updates.
api/v3/openapi.yaml Regenerates the v3 OpenAPI specification and associated schema formatting.

Reviews (3): Last reviewed commit: "fix(api/spec): drop duplicate test fixtu..." | Re-trigger Greptile

Context used:

@tothandras
tothandras requested a review from a team as a code owner July 27, 2026 16:31
@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Refreshes API specification tooling and TypeSpec declarations, updates generated client formatting and test compilation setup, and replaces embedded Swagger payloads in generated Go API files.

Changes

API specification refresh

Layer / File(s) Summary
Specification tooling and workspace configuration
api/spec/package.json, api/spec/pnpm-workspace.yaml, api/spec/packages/*/package.json, api/spec/packages/aip-client-javascript/tsconfig.json
Updates package versions, pnpm workspace policies, package extensions, overrides, patches, and Node.js TypeScript configuration.
TypeSpec declaration updates
api/spec/packages/aip/src/**/*.tsp, api/spec/packages/legacy/src/**/*.tsp, api/spec/packages/typespec-go/src/*
Reformats request, charge, entitlement, subscription, credit, and generator-specific declarations while preserving their listed properties and type members.
Generated client type and runtime formatting
api/spec/packages/aip-client-javascript/src/**/*.ts, api/spec/packages/typespec-typescript/templates/runtime/*.ts
Reflows credit-purchase documentation and compacts generated union and runtime type declarations without changing their shapes or behavior.
TypeSpec test harness updates
api/spec/packages/aip/test/*, api/spec/packages/typespec-go/test/*
Removes explicit HTTP and OpenAPI imports from compilation wrappers and uses configured test libraries instead.
Embedded Swagger regeneration
api/api.gen.go, api/v3/api.gen.go, api/v3/client/models_customers.go
Replaces embedded encoded Swagger data and updates generated credit-purchase documentation comments.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: release-note/dependency-update

Suggested reviewers: chrisgacsal, turip, galexihu

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR objectives mention restoring from openmeter import Client, but the reviewable summary shows no Python SDK file changes, so #4530 can't be verified. Provide the Python package-root export diff or the relevant file path so the import fix can be checked against #4530.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The listed changes stay focused on toolchain bumps, regenerated specs, and test-fixture cleanup; no unrelated work stands out.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: updating the TypeSpec dependency/toolchain stack in api/spec.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/python-sdk-client-import

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.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
api/v3/client/models_customers.go (1)

1038-1041: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Tiny nit: the per_unit_cost_basis doc wrap reads a little choppy.

All these sites flow from the same TypeSpec doc string, so the stubby $100.00, the total charge line shows up everywhere it's emitted. Content is correct and unchanged — purely a readability polish if you're touching the source text anyway.

  • api/v3/client/models_customers.go#L1038-L1041: comes from the shared doc string; also applies to the duplicate block at L1294-L1297.
  • api/v3/api.gen.go#L3042-L3045: same generated text; also at L5364-L5367.
  • api/spec/packages/aip-client-javascript/src/models/types.ts#L1701-L1704: same generated text; also at L1755-L1758, L5801-L5804, and L5847-L5850.

Fix once in the TypeSpec doc comment and regenerate rather than editing any of the generated files.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api/v3/client/models_customers.go` around lines 1038 - 1041, Rewrap the
shared TypeSpec documentation for per_unit_cost_basis to improve readability
without changing its content, then regenerate all outputs. This updates
api/v3/client/models_customers.go ranges 1038-1041 and 1294-1297,
api/v3/api.gen.go ranges 3042-3045 and 5364-5367, and
api/spec/packages/aip-client-javascript/src/models/types.ts ranges 1701-1704,
1755-1758, 5801-5804, and 5847-5850; do not edit generated files directly.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@api/v3/client/models_customers.go`:
- Around line 1038-1041: Rewrap the shared TypeSpec documentation for
per_unit_cost_basis to improve readability without changing its content, then
regenerate all outputs. This updates api/v3/client/models_customers.go ranges
1038-1041 and 1294-1297, api/v3/api.gen.go ranges 3042-3045 and 5364-5367, and
api/spec/packages/aip-client-javascript/src/models/types.ts ranges 1701-1704,
1755-1758, 5801-5804, and 5847-5850; do not edit generated files directly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8428f7a0-6b9b-4da2-9282-d0a514e05301

📥 Commits

Reviewing files that changed from the base of the PR and between 0c9c299 and 093569e.

⛔ Files ignored due to path filters (24)
  • api/client/go/client.gen.go is excluded by !api/client/**
  • api/client/python/openmeter/__init__.py is excluded by !api/client/**
  • api/client/python/openmeter/_generated/_client.py is excluded by !**/_generated/**, !api/client/**
  • api/client/python/openmeter/_generated/_unions.py is excluded by !**/_generated/**, !api/client/**
  • api/client/python/openmeter/_generated/_utils/model_base.py is excluded by !**/_generated/**, !api/client/**
  • api/client/python/openmeter/_generated/_utils/serialization.py is excluded by !**/_generated/**, !api/client/**
  • api/client/python/openmeter/_generated/aio/_client.py is excluded by !**/_generated/**, !api/client/**
  • api/client/python/openmeter/_generated/aio/operations/_operations.py is excluded by !**/_generated/**, !api/client/**
  • api/client/python/openmeter/_generated/models/_models.py is excluded by !**/_generated/**, !api/client/**
  • api/client/python/openmeter/_generated/operations/_operations.py is excluded by !**/_generated/**, !api/client/**
  • api/client/python/openmeter/_generated/types.py is excluded by !**/_generated/**, !api/client/**
  • api/openapi.cloud.yaml is excluded by !**/openapi.cloud.yaml
  • api/openapi.yaml is excluded by !**/openapi.yaml
  • api/spec/patches/@typespec__compiler.patch is excluded by !api/spec/patches/**
  • api/spec/patches/@typespec__emitter-framework.patch is excluded by !api/spec/patches/**
  • api/spec/patches/@[email protected] is excluded by !api/spec/patches/**
  • api/spec/patches/@typespec__http-client-python.patch is excluded by !api/spec/patches/**
  • api/spec/patches/@typespec__http-client.patch is excluded by !api/spec/patches/**
  • api/spec/patches/@typespec__http.patch is excluded by !api/spec/patches/**
  • api/spec/patches/@typespec__openapi.patch is excluded by !api/spec/patches/**
  • api/spec/patches/@typespec__openapi3.patch is excluded by !api/spec/patches/**
  • api/spec/patches/@[email protected] is excluded by !api/spec/patches/**
  • api/spec/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • api/v3/openapi.yaml is excluded by !**/openapi.yaml
📒 Files selected for processing (26)
  • api/api.gen.go
  • api/spec/AGENTS.md
  • api/spec/package.json
  • api/spec/packages/aip-client-javascript/package.json
  • api/spec/packages/aip-client-javascript/src/lib/types.ts
  • api/spec/packages/aip-client-javascript/src/models/errors.ts
  • api/spec/packages/aip-client-javascript/src/models/types.ts
  • api/spec/packages/aip-client-javascript/tsconfig.json
  • api/spec/packages/aip/package.json
  • api/spec/packages/aip/src/customers/charges/charges.tsp
  • api/spec/packages/aip/src/customers/credits/grant.tsp
  • api/spec/packages/aip/src/shared/request.tsp
  • api/spec/packages/legacy/package.json
  • api/spec/packages/legacy/src/entitlements/entitlements.tsp
  • api/spec/packages/legacy/src/entitlements/v2/entitlements.tsp
  • api/spec/packages/legacy/src/productcatalog/ratecards.tsp
  • api/spec/packages/legacy/src/productcatalog/subscription.tsp
  • api/spec/packages/typespec-go/package.json
  • api/spec/packages/typespec-go/src/go-types.tsx
  • api/spec/packages/typespec-go/src/projections.ts
  • api/spec/packages/typespec-typescript/package.json
  • api/spec/packages/typespec-typescript/templates/runtime/errors.ts
  • api/spec/packages/typespec-typescript/templates/runtime/types.ts
  • api/spec/pnpm-workspace.yaml
  • api/v3/api.gen.go
  • api/v3/client/models_customers.go

@tothandras
tothandras force-pushed the fix/python-sdk-client-import branch from 093569e to 0756e0e Compare July 27, 2026 17:05
@tothandras tothandras added release-note/bug-fix Release note: Bug Fixes release-note/misc Miscellaneous changes labels Jul 27, 2026
…grant doc

TypeSpec 1.14 warns on duplicate imports; createTestRunner already
auto-imports the host libraries, so the explicit imports in the
typespec-go and aip lint-rule test fixtures now fail
expectDiagnosticEmpty. Also reflows the per_unit_cost_basis doc
comment at its TypeSpec source so the generated docs stop wrapping
mid-sentence.
@tothandras
tothandras merged commit 1cdc2cb into main Jul 27, 2026
28 of 30 checks passed
@tothandras
tothandras deleted the fix/python-sdk-client-import branch July 27, 2026 17:26
@coderabbitai coderabbitai Bot mentioned this pull request Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/bug-fix Release note: Bug Fixes release-note/misc Miscellaneous changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python - openmeter-1.0.0b228 - from openmeter import Client now fails

2 participants