Skip to content

Commit 6814511

Browse files
committed
docs(coding-plans): clarify auto_top_up_triggered counter semantics
The counter intentionally measures triggered auto-top-up attempts (not successful charges), matching spec rule 5.5. Document that a best-effort maybePerformAutoTopUp failure still counts as a triggered attempt.
1 parent 50911c6 commit 6814511

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

apps/web/src/lib/coding-plans/billing-lifecycle-cron.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ async function sweepRenewals(
237237
error: error instanceof Error ? error.message : String(error),
238238
});
239239
}
240+
// Counts auto-top-up attempts that were triggered, not successful charges.
241+
// maybePerformAutoTopUp is best-effort, so the attempt still counts when it
242+
// throws (the failure is logged above). This matches spec rule 5.5: at most
243+
// one auto-top-up attempt is triggered per due term, regardless of outcome.
240244
summary.auto_top_up_triggered++;
241245
} else if (result === 'terminated') {
242246
summary.canceled_insufficient_balance++;

0 commit comments

Comments
 (0)