Repository navigation
feat(store): billing account delete hides the account's token transactions with the row - #1999
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 Summary
Merge Risk: 🟡 Moderate · up to
|
Coverage Report for CI Build 39420937993Coverage increased (+0.05%) to 55.627%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
4f3a2c0 to
88f48ee
Compare
be61aad to
49f5fe5
Compare
88f48ee to
55510df
Compare
49f5fe5 to
170adbe
Compare
55510df to
5a6a5bc
Compare
170adbe to
c2b82b8
Compare
c2b82b8 to
e625872
Compare
5a6a5bc to
0286c5f
Compare
5d7f7fc to
7f9267e
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: raystack/frontier/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e8cc6bc4-0fe1-4ef3-ac62-1754a045a56d
📒 Files selected for processing: 18
billing/customer/errors.gobilling/customer/mocks/repository.gobilling/customer/service.gobilling/customer/service_test.gocmd/serve.gocore/audit/audit.gocore/deleter/delete_notice.gocore/deleter/delete_notice_test.gocore/deleter/mocks/audit_record_service.gocore/deleter/mocks/credit_service.gocore/deleter/service.gocore/deleter/service_test.godocs/content/docs/reference/webhook.mdxinternal/api/v1beta1connect/billing_errors.gointernal/api/v1beta1connect/billing_errors_test.gointernal/store/postgres/billing_customer_repository.gointernal/store/postgres/billing_customer_repository_pg_test.goweb/sdk/admin/utils/webhook-events.ts
💤 Files with no reviewable changes: 4
- docs/content/docs/reference/webhook.mdx
- core/deleter/mocks/credit_service.go
- web/sdk/admin/utils/webhook-events.ts
- core/audit/audit.go
|
The description still says the forfeit goes to |
…t calls the billing provider
7f9267e to
fc474d7
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: raystack/frontier/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b586b7de-26b5-4bc9-9f41-9ab440e0527f
📒 Files selected for processing: 19
billing/credit/mocks/transaction_repository.gobilling/credit/service.gobilling/customer/customer.gobilling/customer/mocks/repository.gobilling/customer/service.gobilling/customer/service_test.gocmd/serve.gocore/deleter/delete_notice.gocore/deleter/delete_notice_test.gocore/deleter/mocks/customer_service.gocore/deleter/service.gocore/deleter/service_test.gointernal/api/v1beta1connect/billing_customer.gointernal/api/v1beta1connect/interfaces.gointernal/api/v1beta1connect/mocks/customer_service.gointernal/store/postgres/billing_customer_repository.gointernal/store/postgres/billing_customer_repository_pg_test.gointernal/store/postgres/billing_transactions_repository.gointernal/store/postgres/billing_transactions_repository_pg_test.go
💤 Files with no reviewable changes: 4
- internal/store/postgres/billing_transactions_repository.go
- billing/credit/service.go
- internal/store/postgres/billing_transactions_repository_pg_test.go
- billing/credit/mocks/transaction_repository.go
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
Summary
Deleting a billing account now hides the account's token transactions and records what was forfeited on the account's
billing_customer.deletedaudit record.An account that owes tokens cannot be deleted. The API answers with failed precondition.
Changes
HasLiveRecordsrepository method.ErrHasTokenDebterror to failed precondition.billing_customer.deletedrecords. Only records written by an org delete count, so an account deleted on its own is not added to the notice. The record carriesorg_teardown: truefor this.app.billing.tokens.forfeitedaudit log event is removed, together with its entries in the webhook docs and the admin webhook event list. The event has shipped since v0.116.0. It was only an audit log entry and the forfeit now lives on the audit record, so it will no longer be sent as a webhook event.DeleteByAccountIDon the credit service and repository is removed.Technical Details
account_idis the customer id, never the system account.system.buy, kept between zero and the forfeited amount.org_teardownflag, so a retry that started before the deploy recovers nothing.Test Plan
go build ./...go veton the touched packagesgo test ./internal/store/postgres/ ./billing/... ./core/deleter/... ./internal/api/v1beta1connect/golangci-lint runon the touched packages, 0 issuesgofmton the changed filesSQL Safety