Skip to content

Remove pricing package and quota checking system #28

@BrewingCoder

Description

@BrewingCoder

Parent: #25 — Remove all SaaS billing code

⚠️ Largest blast radius — do this one carefully

What to Remove

  • model/pricing.go — PricingProductType, PricingSubscriptionInterval enums
  • pricing/pricing.go — entire package (ProductPrices, GetLimitAmount, IncludedAmount, get7DayAverageImpl, getWorkspaceMeterImpl, ProductToBasePriceCents, WorkspaceOverages, ProductTypeToQuotaConfig)
  • pricing/pricing_test.go — tests for above
  • Quota checking functions in public-graph/graph/resolver.go: IsWithinQuota, SetBillingQuotaExceeded
  • Redis billing quota keys in redis/utils.go: BillingQuotaExceededKey, IsBillingQuotaExceeded, SetBillingQuotaExceeded

Callers (100+ references — most complex removal)

Public Graph Resolver

Line Usage
688 IsWithinQuota — PricingProductTypeErrors
1129, 2631, 2981 IsWithinQuota — PricingProductTypeSessions
1132 SetBillingQuotaExceeded — PricingProductTypeSessions
1618 IsWithinQuota function definition

Private Graph Resolver

Line Usage
schema.resolvers.go:6420-6476 IncludedAmount, GetLimitAmount, ProductToBasePriceCents calls

Worker

Line Usage
kafka_worker.go:309, 366-374, 398, 473 getQuotaExceededByProject, product type case statements
worker.go:954 IsWithinQuota call

OTEL

Line Usage
otel.go:575, 643, 749, 797 getQuotaExceededByProject, product type calls

Redis

Line Usage
utils.go:56, 604, 608 Billing quota key functions

Tests

File Usage
public-graph/graph/resolver_test.go:638,641 IsWithinQuota tests
worker/worker_test.go:848-894 Pricing table setup (47 assignments)

Strategy

IsWithinQuota should be replaced with a function that always returns true (no quotas in self-hosted), then callers can be simplified. The pricing package can be deleted entirely.

Test Plan

  • Replace IsWithinQuota → always true
  • Remove SetBillingQuotaExceeded calls
  • Remove pricing package
  • Remove Redis billing quota functions
  • Remove model/pricing.go
  • Update all tests
  • Verify build + all tests pass
  • Verify data ingestion still works (sessions, errors, logs, traces, metrics all accepted)

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions