refactor(billing): remove request-scoped Autumn tracking (AUTUMN_REQUEST_TRACK_EXPERIMENT)#3314
Open
firecrawl-spring[bot] wants to merge 1 commit intoremove-autumn-bypass-org-idsfrom
Open
Conversation
…EST_TRACK_EXPERIMENT) Remove the dual-track billing path where credits could be tracked either per-request (requestScoped=true) or in the batch billing worker. With Autumn fully ramped, simplify to always track credits in the batch billing path after successful Supabase billing. This eliminates: - isAutumnRequestTrackEnabled() and its config keys - requestScoped parameter from trackCredits/TrackCreditsParams - Request-scoped tracking + refund logic in scrape-worker.ts - autumnTrackInRequest field from BillingOperation interface - refundRequestTrackedCredits() from batch_billing.ts - Request-scoped tracking + refund logic in credit_billing.ts billTeam Co-Authored-By: micahstairs <micah@sideguide.dev>
3 tasks
Contributor
There was a problem hiding this comment.
1 issue found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/api/src/services/billing/credit_billing.ts">
<violation number="1" location="apps/api/src/services/billing/credit_billing.ts:19">
P1: `billTeam` no longer honors the DB-auth bypass, so billing operations are enqueued even when auth is disabled. That can lead to Autumn credit tracking without a real Supabase bill.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
| }, | ||
| { success: true, message: "No DB, bypassed." }, | ||
| )(team_id, subscription_id, credits, api_key_id, billing, logger); | ||
| return queueBillingOperation( |
Contributor
There was a problem hiding this comment.
P1: billTeam no longer honors the DB-auth bypass, so billing operations are enqueued even when auth is disabled. That can lead to Autumn credit tracking without a real Supabase bill.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/api/src/services/billing/credit_billing.ts, line 19:
<comment>`billTeam` no longer honors the DB-auth bypass, so billing operations are enqueued even when auth is disabled. That can lead to Autumn credit tracking without a real Supabase bill.</comment>
<file context>
@@ -17,49 +16,14 @@ export async function billTeam(
- },
- { success: true, message: "No DB, bypassed." },
- )(team_id, subscription_id, credits, api_key_id, billing, logger);
+ return queueBillingOperation(
+ team_id,
+ subscription_id,
</file context>
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
requestScoped/autumnTrackInRequest)isAutumnRequestTrackEnabled(),refundRequestTrackedCredits(), and related plumbingbillTeamto just queue the billing operationAUTUMN_REQUEST_TRACK_EXPERIMENTandAUTUMN_REQUEST_TRACK_EXPERIMENT_PERCENTconfig keysStack
Test plan
autumn.service.test.tspassesbatch_billing.test.tspassescredit_billing.test.tspassesCo-Authored-By: micahstairs micah@sideguide.dev
Summary by cubic
Removes request-scoped Autumn credit tracking and always tracks credits in the batch billing worker after successful Supabase billing. Simplifies billing flow and deletes the experiment flags.
Refactors
processBillingBatchafter billing succeeds.credit_billing,scrape-worker, and batch worker.isAutumnRequestTrackEnabled(), therequestScopedparam intrackCredits, and related tests/types.AUTUMN_REQUEST_TRACK_EXPERIMENTandAUTUMN_REQUEST_TRACK_EXPERIMENT_PERCENTconfig keys.billTeamto only enqueue billing.Migration
AUTUMN_REQUEST_TRACK_EXPERIMENTandAUTUMN_REQUEST_TRACK_EXPERIMENT_PERCENTfrom environment/config.Written for commit 56ae8b7. Summary will update on new commits.