Skip to content

fix(api): resolve TypeSpec AIP compiler warnings#4079

Merged
hekike merged 1 commit intomainfrom
fix/typespec-aip-warnings
Apr 3, 2026
Merged

fix(api): resolve TypeSpec AIP compiler warnings#4079
hekike merged 1 commit intomainfrom
fix/typespec-aip-warnings

Conversation

@hekike
Copy link
Copy Markdown
Contributor

@hekike hekike commented Apr 3, 2026

Summary

  • Fix PascalCase violations for enum/model type names (FeatureLLM*FeatureLlm*) and enum members (inputInput, etc.) — API-facing names preserved via @friendlyName
  • Add missing doc comments for type discriminator fields on FeatureManualUnitCost and FeatureLlmUnitCost
  • Suppress repeated-prefix-grouping warnings for established API fields (effective_from/effective_to, token_type/token_type_property, cache_read/cache_write) that would be breaking changes to restructure

Test plan

  • pnpm compile in api/spec/packages/aip passes with 0 warnings
  • Verify generated OpenAPI spec has no unintended changes (enum values and field names unchanged)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Breaking Changes
    • Updated API billing feature type names and enum members for improved consistency. References to FeatureLLMUnitCost, FeatureLLMTokenType, and related types have been renamed. Applications using these API types require updates.

Fix 18 warnings from the AIP linter:
- Use PascalCase for enum/model type names (FeatureLLM* → FeatureLlm*)
- Use PascalCase for enum members (input → Input, etc.)
- Add missing doc comments for type discriminator fields
- Suppress repeated-prefix-grouping for established API fields

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hekike hekike requested a review from a team as a code owner April 3, 2026 13:06
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

📝 Walkthrough

Walkthrough

Standardized naming conventions across the unit-cost specification by renaming enum members and model types from mixed-case (llm, LLM) to consistent PascalCase (Llm, Llm). Updated all discriminator references and model field types accordingly, added suppress directives for linting warnings, and regenerated Go API code.

Changes

Cohort / File(s) Summary
TypeSpec Unit Cost Spec
api/spec/packages/aip/src/features/unitcost.tsp
Renamed enum FeatureLLMTokenTypeFeatureLlmTokenType with member updates (input/output/cache_read/cache_write/reasoning → Input/Output/CacheRead/CacheWrite/Reasoning), model FeatureLLMUnitCostFeatureLlmUnitCost, and FeatureLLMUnitCostPricingFeatureLlmUnitCostPricing. Updated FeatureUnitCostType enum members (llm → Llm, manual → Manual) and aligned discriminators. Added #suppress directives for repeated-prefix-grouping warnings.
TypeSpec Catalog Suppressions
api/spec/packages/aip/src/productcatalog/addon.tsp, api/spec/packages/aip/src/productcatalog/plan.tsp
Added #suppress directives on Addon and Plan models to suppress repeated-prefix-grouping warnings for temporal fields (effective_from/effective_to).
Generated Go Code
api/v3/api.gen.go
Updated struct field documentation and alignment for BillingFeatureLLMUnitCost (reordered Type discriminator field) and BillingFeatureManualUnitCost (reordered Type field with clarified comments). Regenerated embedded swagger spec payload.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • fix(feature): unit cost clear #4046 — Concurrent modifications to unit-cost models and related enums in both the API spec and generated code (unitcost.tsp and BillingFeature\* structs).

Suggested labels

release-note/bug-fix

Suggested reviewers

  • solkimicreb
  • tothandras
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The PR title accurately summarizes the main objective: resolving TypeSpec AIP compiler warnings through naming convention fixes and suppression directives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/typespec-aip-warnings

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 and usage tips.

@hekike hekike requested a review from tothandras April 3, 2026 13:06
@hekike hekike added the release-note/ignore Ignore this change when generating release notes label Apr 3, 2026
@hekike hekike enabled auto-merge (squash) April 3, 2026 13:07
@hekike hekike changed the title fix: resolve TypeSpec AIP compiler warnings fix(api): resolve TypeSpec AIP compiler warnings Apr 3, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@api/v3/api.gen.go`:
- Around line 9164-9499: The embedded OpenAPI spec blob in api/v3/api.gen.go is
out of date and missing the BillingFeatureLLMUnitCostType enum (should contain
["llm"]); regenerate the embedded spec by updating the TypeSpec in api/spec/ if
needed and running the codegen target (make gen-api) so the embedded blob (the
large base64/string blob in api/v3/api.gen.go) includes the updated schema with
BillingFeatureLLMUnitCostType.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a913790b-9f79-4dd3-9a97-77321f857e73

📥 Commits

Reviewing files that changed from the base of the PR and between fe83424 and 8101e66.

⛔ Files ignored due to path filters (1)
  • api/v3/openapi.yaml is excluded by !**/openapi.yaml
📒 Files selected for processing (4)
  • api/spec/packages/aip/src/features/unitcost.tsp
  • api/spec/packages/aip/src/productcatalog/addon.tsp
  • api/spec/packages/aip/src/productcatalog/plan.tsp
  • api/v3/api.gen.go

Comment thread api/v3/api.gen.go
@hekike hekike merged commit 1a3d438 into main Apr 3, 2026
27 of 28 checks passed
@hekike hekike deleted the fix/typespec-aip-warnings branch April 3, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/ignore Ignore this change when generating release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants