Skip to content

feat(config): gate custom currency catalog use#4752

Draft
turip wants to merge 2 commits into
codex/custom-currency-productcatalog-subscriptionfrom
feat/credits-custom-currency
Draft

feat(config): gate custom currency catalog use#4752
turip wants to merge 2 commits into
codex/custom-currency-productcatalog-subscriptionfrom
feat/credits-custom-currency

Conversation

@turip

@turip turip commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

  • add credits.customCurrency, enabled only when both it and credits.enabled are true
  • reject plan and add-on create, update, publish, and next-version operations when they use custom currencies on unsupported deployments
  • keep fiat plans and add-ons unaffected
  • enable custom currencies in E2E and quickstart configuration
  • document the experimental migration risk in config.example.yaml

Why

PR #4738 adds product catalog persistence for custom currencies. This follow-up keeps that experimental storage path disabled by default and makes deployments opt in explicitly.

Impact

Existing resources remain readable, archivable, and deletable when the switch is off. The service checks both a custom plan/add-on currency and custom currencies used by individual rate cards.

Validation

  • go test ./app/config ./openmeter/productcatalog
  • POSTGRES_HOST=127.0.0.1 go test -tags=dynamic ./app/config ./app/common ./openmeter/productcatalog/... ./test/productcatalog
  • go vet -tags=dynamic ./app/config ./app/common ./openmeter/productcatalog/... ./test/productcatalog
  • go test -tags=dynamic ./quickstart
  • go test -C e2e -run '^$' ./...
  • go test -tags=dynamic -run '^$' ./...

make lint-go-fast still reports existing generated-code findings outside this change.

Greptile Summary

This PR makes custom-currency catalog storage an explicit opt-in feature. The main changes are:

  • Adds the default-disabled credits.customCurrency setting.
  • Gates plan and add-on create, update, publish, and version operations.
  • Detects custom currencies at both resource and rate-card levels.
  • Enables the feature in quickstart and E2E environments.
  • Adds configuration and lifecycle tests.

Confidence Score: 5/5

This looks safe to merge.

  • The new setting is disabled by default.
  • Plan and add-on mutation paths enforce the setting before persistence.
  • No blocking issue remains in the updated code.

Important Files Changed

Filename Overview
app/config/credits.go Adds the default-disabled custom-currency option and requires credits to be enabled.
app/common/productcatalog.go Passes the effective feature setting into the plan and add-on services.
openmeter/productcatalog/plan/service/plan.go Enforces the custom-currency setting across plan mutation operations.
openmeter/productcatalog/addon/service/addon.go Enforces the custom-currency setting across add-on mutation operations.
openmeter/productcatalog/ratecard.go Adds detection for explicit custom-currency rate-card overrides.
test/productcatalog/custom_currency_test.go Covers disabled custom-currency mutations and unaffected fiat resources.

Reviews (2): Last reviewed commit: "style: separate catalog validation check..." | Re-trigger Greptile

Context used:

  • Context used - CLAUDE.md (source)
  • Context used - AGENTS.md (source)

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 00bdb595-b542-4dfa-a5ef-3ad7a2bdd428

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/credits-custom-currency

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.

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.

1 participant