Skip to content

feat: deprecate splitline group tax fields - #4449

Merged
turip merged 2 commits into
mainfrom
remove-split-line-group-tax-fields
May 27, 2026
Merged

turip merged 2 commits into
mainfrom
remove-split-line-group-tax-fields

Conversation

@turip

@turip turip commented May 27, 2026 •

Copy link
Copy Markdown
Member

Summary

This removes tax configuration from the billing split line group domain model and stops persisting or reading split-line-group-level tax fields during split group create, update, and fetch flows.

Included changes:

  • Remove TaxConfig from SplitLineGroupMutableFields.
  • Stop split line group create, update, and mapping code from writing or backfilling tax_config, tax_code_id, and tax_behavior on split line groups.
  • Keep the underlying Ent fields for DB compatibility, but mark split-line-group tax fields as deprecated in schema metadata.
  • Regenerate Ent code for the split line group schema change.
  • Update the billing tax test to assert line and detailed-line tax persistence without expecting tax columns on the split line group row.

Impact

Tax configuration remains owned by invoice lines and detailed lines. Split line group tax columns remain in the generated schema for compatibility, but new billing split group flows no longer populate or depend on them.

Validation

  • go test -tags=dynamic ./openmeter/billing ./openmeter/billing/adapter ./openmeter/billing/lineengine ./openmeter/ent/schema
  • go vet -tags=dynamic ./openmeter/billing ./openmeter/billing/adapter ./openmeter/billing/lineengine ./openmeter/ent/schema
  • go vet -tags=dynamic ./test/billing

Attempted the focused DB-backed billing tax test, but local Postgres was not listening on 127.0.0.1:5432:

  • env POSTGRES_HOST=127.0.0.1 go test -tags=dynamic ./test/billing -run 'TestInvoicingTax/TestLineSplittingRetainsTaxConfig'

Summary by CodeRabbit

  • Refactor
    • Simplified tax handling for split line groups: tax code/behavior are no longer applied or backfilled on split line groups; related split-group fields are now deprecated and split-group creation/update flows no longer set tax config.
  • Tests
    • Updated tests to remove assertions that normalized tax columns exist on split line groups; tax validation remains at invoice and line levels.

Review Change Stack

@turip turip added release-note/deprecation Release note: Deprecations kind/refactor Code refactor, cleanup or minor improvement area/billing labels May 27, 2026
@turip
turip marked this pull request as ready for review May 27, 2026 13:38
@turip
turip requested a review from a team as a code owner May 27, 2026 13:38
@turip turip changed the title feat:remove splitline group tax fields feat: deprecate splitline group tax fields May 27, 2026
@coderabbitai

coderabbitai Bot commented May 27, 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: ce5b3536-8f7b-4f35-b875-027349e62f7e

📥 Commits

Reviewing files that changed from the base of the PR and between d37d25e and 65794b7.

📒 Files selected for processing (1)
  • test/billing/tax_test.go
💤 Files with no reviewable changes (1)
  • test/billing/tax_test.go

📝 Walkthrough

Walkthrough

This PR removes TaxConfig handling from split line groups: the domain type drops TaxConfig, adapter create/update/read paths stop backfilling or expanding tax-code edges, callers stop passing TaxConfig, schema tax fields are deprecated, and tests are updated accordingly.

Changes

Tax Config Removal from Split Line Groups

Layer / File(s) Summary
Domain model: remove TaxConfig from split line groups
openmeter/billing/invoicelinesplitgroup.go
SplitLineGroupMutableFields drops TaxConfig. ValidateForPrice and Clone no longer validate or copy tax config; RatecardDiscounts cloning remains.
Adapter cleanup: remove tax imports and helpers
openmeter/billing/adapter/invoicelinesplitgroup.go
Removes imports for productcatalog, taxcode, and taxcodeadapter. Deletes taxCodeFromSplitLineGroupEdge helper.
Adapter write operations: remove tax config from create and update
openmeter/billing/adapter/invoicelinesplitgroup.go
CreateSplitLineGroup no longer backfills tax config in the create builder. UpdateSplitLineGroup no longer sets/clears tax config fields and remains namespaced-scoped for mutable updates.
Adapter read operations: remove tax code expansion and backfilling
openmeter/billing/adapter/invoicelinesplitgroup.go
GetSplitLineGroup and fetchAllSplitLineGroups remove WithTaxCode() expansion. mapSplitLineGroupFromDB no longer constructs/backfills TaxConfig from edge tax code.
Caller updates: stop passing TaxConfig to split line group creation
openmeter/billing/lineengine/splitlinegroup.go
SplitGatheringLine stops passing TaxConfig: line.TaxConfig when calling CreateSplitLineGroup.
Database schema: deprecate tax fields and add index
openmeter/ent/schema/billing.go
BillingInvoiceSplitLineGroup.Fields() marks tax_config, tax_code_id, and tax_behavior deprecated, adds a currency field, and reorders fields. Indexes() adds an index on tax_code_id.
Test alignment: remove split line group tax assertions
test/billing/tax_test.go
Removes billinginvoicesplitlinegroupdb import and deletes split line group DB assertions verifying tax_code_id NULL and tax_behavior exclusive; invoice/detailed-line tax assertions remain.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • openmeterio/openmeter#4049: Earlier PR that added tax-code handling to split line groups; this PR reverts/removes that edge-based tax backfilling.

Suggested labels

release-note/misc

Suggested reviewers

  • tothandras
  • borbelyr-kong
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: deprecating tax fields in the split line group domain model, which aligns with the core objective of removing TaxConfig and marking tax fields as deprecated.
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 remove-split-line-group-tax-fields

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.

@turip
turip enabled auto-merge (squash) May 27, 2026 14:27
@turip
turip merged commit d8ccce6 into main May 27, 2026
26 checks passed
@turip
turip deleted the remove-split-line-group-tax-fields branch May 27, 2026 14:35

This branch was previously deployed

1 inactive deployment
dev — 65794b72 Deployed May 27, 2026 by turip via Migration Checks #14690
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/billing kind/refactor Code refactor, cleanup or minor improvement release-note/deprecation Release note: Deprecations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants