refactor(billing): extract domain module - #272
Merged
Merged
Conversation
astaxie
approved these changes
Aug 21, 2026
astaxie
left a comment
Owner
There was a problem hiding this comment.
Reviewed the complete current diff at exact head d0b2a1f. The new billing package establishes the intended domain service and narrow ports while the temporary server bridge keeps the incremental slice compatible. No blocking standards, behavior, or security findings remain.
The full backend suite, go vet, billing and server race-focused regressions, all repository tests and gates, git diff checks, and all GitHub checks pass. Approving this exact head.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Billing synchronization, retry handling, checkpoint recovery, and scheduler lifecycle were implemented inside the
serverpackage, which left the billing domain without an enforceable boundary. This PR introduces a standalone billing domain package while preserving the existing server-facing API and persistence behavior through temporary compatibility adapters.Related Issue
Related to #169
Changes
backend/internal/billingdomain package with billing types, synchronization orchestration, narrow persistence and upstream adapter ports, and domain error types.billing.Service.Type of Change
Verification
go test ./...passgo vet ./...passgo test -race ./internal/billingpassgo test -race ./internal/server -run '^(TestBillingSchedulerRestartsAfterShutdown|TestBillingConnectorTestAndScheduledSync|TestDomainBilling)'passnode --test tools/*.test.mjspassnode tools/check-doc-translations.mjspassnode tools/check-ui-translations.mjspassnode tools/check-env-contract.mjspassnode tools/check-source-lines.mjspassgit diff --checkpassCompatibility, Security, and Operations
No public API, response format, authentication, authorization, routing, billing rule, database schema, migration result, environment variable, or deployment change is included.
The server compatibility bridge is intentionally temporary. A follow-up PR will move the remaining persistence, admin HTTP, and upstream adapter implementations, then remove the bridge and server billing wrapper. This PR can be rolled back by removing the new billing package and restoring the prior server billing implementation.
Checklist
.envfiles, databases, backups, or runtime logs are included.start.sh, and deployment documentation where applicable.data/model-catalog.yamlremains tracked and catalog changes were reviewed where applicable.git diff --checkpasses.