Skip to content

feat(api): typed feature meter reference - #4332

Merged
tothandras merged 1 commit into
mainfrom
feat/v3-feature-api-improvements
May 11, 2026
Merged

feat(api): typed feature meter reference#4332
tothandras merged 1 commit into
mainfrom
feat/v3-feature-api-improvements

Conversation

@tothandras

@tothandras tothandras commented May 10, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor
    • Restructured meter reference definitions in the feature API for improved code organization and maintainability. JSON serialization and API behavior remain unchanged.

Review Change Stack

@tothandras
tothandras requested a review from a team as a code owner May 10, 2026 11:58
@tothandras tothandras added the release-note/feature Release note: Exciting New Features label May 10, 2026
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bf508cda-ef0b-4808-bfaa-d41b0c46d0c5

📥 Commits

Reviewing files that changed from the base of the PR and between b2e7c9d and 6756adf.

⛔ Files ignored due to path filters (1)
  • api/v3/openapi.yaml is excluded by !**/openapi.yaml
📒 Files selected for processing (5)
  • api/spec/packages/aip/src/features/feature.tsp
  • api/v3/api.gen.go
  • api/v3/handlers/features/convert.go
  • api/v3/handlers/features/convert_test.go
  • e2e/productcatalog_smoke_v3_test.go

📝 Walkthrough

Walkthrough

This PR extracts meter reference definitions into a reusable FeatureMeterReference type. The change flows from API specification through generated Go code, handler conversion logic, and test fixtures—replacing previously inline anonymous struct definitions with the consolidated named type while preserving all structural and serialization behavior.

Changes

Meter Reference Consolidation

Layer / File(s) Summary
API Spec Type Definition
api/spec/packages/aip/src/features/feature.tsp
New FeatureMeterReference model added with id: Shared.ULID and optional filters field; Feature.meter updated to reference the new model instead of inline definition.
Generated Go Types
api/v3/api.gen.go
New exported FeatureMeterReference struct introduced with Filters and Id fields; CreateFeatureRequest.Meter and Feature.Meter updated to use *FeatureMeterReference instead of inline anonymous structs.
Handler Implementation
api/v3/handlers/features/convert.go
convertFeatureToAPI refactored to construct resp.Meter using explicit api.FeatureMeterReference type while maintaining identical Id and Filters assignment logic.
Tests & Integration
api/v3/handlers/features/convert_test.go, e2e/productcatalog_smoke_v3_test.go
Test fixtures updated to instantiate CreateFeatureRequest.Meter using the new FeatureMeterReference type instead of inline struct literals.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • borosr
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: introducing a typed FeatureMeterReference model across the API codebase to replace inline anonymous structs.
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.

✏️ 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 feat/v3-feature-api-improvements

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.

@tothandras
tothandras merged commit 10999a2 into main May 11, 2026
45 of 48 checks passed
@tothandras
tothandras deleted the feat/v3-feature-api-improvements branch May 11, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/feature Release note: Exciting New Features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants