Two robustness suggestions Gemini raised on the release PR #50. They concern already-released code (shipped in 4167a72 via #45), surfaced on the release PR only because the squash-based develop→main PR re-lists #45's commits. Deferred out of #50 (a release of the unrelated onboard picker #49 + CI #48) to avoid changing live billing/onboarding behavior in an unrelated release. Both are worth doing in a dedicated PR:
1. lib/actions/onboarding-actions.ts — resolveTenantClient should promote an existing client's status to LIVE on onboard
Currently, if a Client already exists for the slug (same partner), it's returned as-is. If it was LEAD/CONTACTED/AGREED, onboarding it (creating a billing plan) leaves its CRM status stale. Consider flipping to LIVE when onboarded. Product nuance to decide: what about a CHURNED client being re-onboarded?
2. lib/billing-onboarding.ts — startFirstPayment reuses an open checkout URL without an age check
Mollie hosted-checkout URLs expire (~1h). Reusing an open/pending first-payment checkoutUrl older than the expiry lands the partner on a Mollie error page. Add a freshness threshold (e.g. only reuse if Date.now() - createdAt < 60min), else mint a fresh checkout.
Not money-safety issues (no double-charge risk); UX/consistency robustness.
Two robustness suggestions Gemini raised on the release PR #50. They concern already-released code (shipped in
4167a72via #45), surfaced on the release PR only because the squash-baseddevelop→mainPR re-lists #45's commits. Deferred out of #50 (a release of the unrelated onboard picker #49 + CI #48) to avoid changing live billing/onboarding behavior in an unrelated release. Both are worth doing in a dedicated PR:1.
lib/actions/onboarding-actions.ts—resolveTenantClientshould promote an existing client's status toLIVEon onboardCurrently, if a
Clientalready exists for the slug (same partner), it's returned as-is. If it wasLEAD/CONTACTED/AGREED, onboarding it (creating a billing plan) leaves its CRM status stale. Consider flipping toLIVEwhen onboarded. Product nuance to decide: what about aCHURNEDclient being re-onboarded?2.
lib/billing-onboarding.ts—startFirstPaymentreuses an open checkout URL without an age checkMollie hosted-checkout URLs expire (~1h). Reusing an
open/pendingfirst-paymentcheckoutUrlolder than the expiry lands the partner on a Mollie error page. Add a freshness threshold (e.g. only reuse ifDate.now() - createdAt < 60min), else mint a fresh checkout.Not money-safety issues (no double-charge risk); UX/consistency robustness.