Skip to content

chore: review - #4391

Merged
borbelyr-kong merged 1 commit into
feat/add-default-tax-code-provisionfrom
feat/add-default-tax-code-provision-review
May 19, 2026
Merged

borbelyr-kong merged 1 commit into
feat/add-default-tax-code-provisionfrom
feat/add-default-tax-code-provision-review

Conversation

@tothandras

@tothandras tothandras commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed query filtering to exclude deleted tax code records from processing.
  • Improvements

    • Enhanced validation for Stripe tax code mappings to enforce correct formatting requirements.
    • Strengthened namespace configuration validation to ensure exactly one default invoicing and one default credit grant entry are configured.

Review Change Stack

@tothandras
tothandras requested a review from a team as a code owner May 19, 2026 21:16
@coderabbitai

coderabbitai Bot commented May 19, 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: c36cdb16-1f2d-4272-bc74-9539c4512394

📥 Commits

Reviewing files that changed from the base of the PR and between 3f45613 and 24213ba.

📒 Files selected for processing (3)
  • app/config/taxcode.go
  • openmeter/taxcode/adapter/taxcode.go
  • openmeter/taxcode/namespacehandler.go

📝 Walkthrough

Walkthrough

This PR hardens tax code initialization and data access across three files: it adds Stripe tax-code regex validation at the app configuration layer, updates namespace seed validation to require exactly one default invoicing and one default credit-grant entry, simplifies organization defaults idempotency to check existence rather than completeness, and adds soft-delete filtering to the tax code repository query.

Changes

Tax Code Initialization, Validation, and Data Layer Filtering

Layer / File(s) Summary
Namespace seed validation for default invoicing and credit-grant
openmeter/taxcode/namespacehandler.go
NamespaceHandlerConfig.validate now enforces that exactly one seed is marked DefaultInvoicing=true and exactly one is marked DefaultCreditGrant=true, returning aggregated errors otherwise.
Organization defaults creation and idempotency logic
openmeter/taxcode/namespacehandler.go
CreateNamespace idempotency is simplified: the org-defaults upsert is skipped whenever GetOrganizationDefaultTaxCodes succeeds (any row exists), instead of checking whether the row is complete.
Stripe tax code validation in application config
app/config/taxcode.go
TaxCodeConfiguration.Validate now enforces that mappings with AppType="stripe" have a TaxCode matching taxcode.TaxCodeStripeRegexp, appending validation errors for non-matching codes.
Soft-delete filtering in tax code queries
openmeter/taxcode/adapter/taxcode.go
GetTaxCode query now includes a DeletedAtIsNil() filter to exclude soft-deleted records before returning the selected tax code.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • openmeterio/openmeter#4294: Introduced the organization_default_tax_codes Ent schema and related edges that this PR's NamespaceHandler validation and idempotency logic directly depends on.

Suggested labels

release-note/misc, area/api

Suggested reviewers

  • borbelyr-kong
  • turip
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'chore: review' is vague and generic, using a non-descriptive term that doesn't convey meaningful information about what's actually changing in this PR. Consider a more specific title that captures the main changes, like 'chore: refactor tax code validation and namespace handler idempotency' or similar.
✅ Passed checks (4 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.
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/add-default-tax-code-provision-review

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.

@borbelyr-kong
borbelyr-kong merged commit 07c5512 into feat/add-default-tax-code-provision May 19, 2026
22 of 23 checks passed
@borbelyr-kong
borbelyr-kong deleted the feat/add-default-tax-code-provision-review branch May 19, 2026 21:27
borbelyr-kong pushed a commit that referenced this pull request May 20, 2026

This branch was previously deployed

1 inactive deployment
dev — 24213bac Deployed May 19, 2026 by tothandras via Migration Checks #14509
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.

2 participants