feat(balances): support pooled customer check and track - #2349
Open
johnyeocx wants to merge 196 commits into
Open
feat(balances): support pooled customer check and track#2349johnyeocx wants to merge 196 commits into
johnyeocx wants to merge 196 commits into
Conversation
…t-json-safe fix(billing): restore JSON-safe license billing context
…tion fix(vite): restore admin hover without Option key
Bumps [idna](https://github.com/kjd/idna) from 3.11 to 3.15. - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md) - [Commits](kjd/idna@v3.11...v3.15) --- updated-dependencies: - dependency-name: idna dependency-version: '3.15' dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [idna](https://github.com/kjd/idna) from 3.11 to 3.15. - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md) - [Commits](kjd/idna@v3.11...v3.15) --- updated-dependencies: - dependency-name: idna dependency-version: '3.15' dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
fix: support versioned Mobbin catalog sync
…t-collections-main fix(catalog): tolerate incomplete product collections
…t-collections-dev fix(catalog): tolerate incomplete product collections
…ponse-main fix(catalog): normalize missing product entitlements
…ponse-dev fix(catalog): normalize missing product entitlements
…-counts Lazy load plan customer counts
…ponse-main fix(catalog): normalize missing product prices
…ponse-dev fix(catalog): normalize missing product prices
feat: resets
…ustomer-check-track # Conflicts: # server/tests/_groups/core/coreBilling.ts # server/tests/_groups/temp.ts # shared/drizzle/meta/0047_snapshot.json # shared/drizzle/meta/_journal.json # shared/models/cusProductModels/cusEntModels/cusEntTable.ts
feat(billing): add Autumn billing plan rollback action
fix: register miscellaneous edge config in workers
…-day fix: reduce track idempotency TTL to one day
…rollovers) A lazy reset racing the worker (or a duplicate SQS delivery) could re-apply a stale reset: wiping post-reset usage and inserting a second rollover row. The execute UPDATE now only applies while next_reset_at still matches the value the mutation was computed from; rollover writes are filtered to rows that actually applied. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat: batch reset cron V2 (scan + SQS fan-out)
…ustomer-check-track
fix(billing): 🐛 reject promotion codes for unrelated products
…ed state Pooled balance source rows and subscription-reset synthetic rows must not be reset by the V2 batch scan — sources have no balance of their own and subscription-mode pools reset off the invoice instead. - classifyNoAction: no-action for pooled sources, resets_via_invoice for subscription-mode synthetic rows - initPooledBalanceGraph: set reset_by_invoice from the identity's reset mode - revertTrialExpiry: reapply pooled customer-product transitions on revert - reset scan: heap-filter pooled sources rather than widening the index Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ff drift) The tw swarm VMs have no Trigger.dev runner, and several suites raced or asserted against stale state. - shouldRunTriggerTasksInline: single toggle for running Trigger tasks in process on tw workers; executeCustomerLicenseTransitions calls batchTransition directly there. shouldRunMigrationInline now re-exports it so there is one gate, not two. - setupPatchContext: snapshot the patched product after every handler that mutates finalCustomerProduct. handleCustomizePrice ran after the snapshot, so its base-price removal was invisible and validateProductItems rejected the result as two fixed prices on one interval. It no longer takes the snapshot, matching handleCustomizeUpdateItems. - diffPlanV1: only emit `pooled` when the item sets it. Emitting a default injected `pooled: false` into items that never had it, breaking the diff -> applyDiff round trip. - invoiceCheckout: .first() on the payment-element iframe lookups; Stripe now renders two matching frames and strict mode threw. - track tests: poll for the async Postgres/Tinybird flush instead of sleeping. - split update-paid-features into included-usage and interval suites. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ustomer-check-track # Conflicts: # server/src/internal/billing/v2/execute/executeAutumnActions/executeCustomerLicenseTransitions.ts # server/tests/integration/balances/track/basic/track-deductions.test.ts # server/tests/utils/browserPool/playwright/invoiceCheckout.ts
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
Stacked on #2347.
Validation
bun ts(commit hook)Summary by cubic
Adds pooled balance support to customer check/track, exposes aggregated pooled grants in customer/entity/check/track responses, and completes pooled lifecycle transitions across subscription updates, schedules, Stripe sync, and rollovers. Also ships
invoices.insert, writable auto top-uppurchase_limit.count, and plan propagation updates.New Features
@useautumn/sdkandautumn_sdkwith docs/OpenAPI.purchase_limit.countto set the current window’s consumed top-ups (validated on write; runtime-only).update_license_parentsto propagate license-plan updates.Migration
update_license_parents; regenerate SDKs.Written for commit c415a44. Summary will update on new commits.
Greptile Summary
This PR adds pooled customer balances to balance checks, tracking, and customer responses. The main changes are:
Confidence Score: 5/5
This looks safe to merge.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR Sources[Entity pooled contributions] --> Pool[Synthetic pooled customer entitlement] Pool --> Read[Customer and entity responses] Pool --> Check[Balance check] Pool --> Track[Balance tracking] Track --> Deduct[Apply deduction] Track --> Rollover[Apply rollover updates] Deduct --> Pool Rollover --> PoolReviews (1): Last reviewed commit: "feat(balances): 🎸 support pooled custom..." | Re-trigger Greptile
Context used (4)