Skip to content

fix: avoid duplicate Stripe sale wiring during onboarding - #41

Merged
sonpiaz merged 8 commits into
mainfrom
fix/onboard-skip-tracksale-when-connected
Oct 18, 2026
Merged

sonpiaz merged 8 commits into
mainfrom
fix/onboard-skip-tracksale-when-connected

Conversation

@sonpiaz

@sonpiaz sonpiaz commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Prevent onboard from adding a second sale writer when Stripe Connect may record payments. A current binding=false/missing remains unknown; status is trusted only for one unambiguous runtime credential matching the checked key.

Following the r4 decision, uncertainty now asks interactively whether to keep the existing webhook unchanged (default Yes). Conflicting/duplicate keys, unknown root .env* layers, unreadable files and missing runtime credentials remain unknown; unattended runs preserve the snippet. Only explicit confirmation of the runtime program and absence of current/shared/delayed Connect sales, followed by a separate diff approval, can add manual sale tracking. Unknown advice never recommends deleting an existing call.

Use pinned dotenv17.3.1 for values and its quote-aware grammar for duplicate boundaries, handling colon assignments and multiline values. Ambiguous env files are preserved; genuinely missing keys can still be initialized. README documents conservative custom/template handling. Branch includes merged CLI#42 without modifying its installer.

Validation: build/lint, 284 tests (25 recipes, 239 CLI, 20 MCP; two Windows tests skipped locally). Nineteen new-decision/baseline regressions reproduced before fixing. Real @next/env confirms colon/multiline behavior. Four isolated mutants killed by 4/26/25/2 tests with submitted source hashes unchanged. CI Linux/Windows on exact head required before release. No publish or version bump; npm refreshed the MCP lock metadata to its existing package version0.2.2. CMS#539 and manager release gates still apply.

sonpiaz and others added 4 commits October 17, 2026 19:39
…; sale snippets never throw without a key

With Stripe connected, Affitor records each payment from the connected account, so the injected trackSale recorded a subscription's first payment twice (cs_ and in_ ids). onboard now reads stripe_connected from GET /v1/cli/status: connected → webhook unchanged, Connect recipe printed, an existing trackSale call is pointed out; unknown → ask, or with --yes/--json change nothing.

The Stripe sale, Stripe renewal and Paddle snippets skip the call (Stripe ones log) when there is no customer key, instead of letting the SDK throw inside the brand's webhook. Tests run each snippet for real against an SDK-like stub.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ackSale advice when Stripe records sales

Codex r1 on #41: stripe_connected is false while a bound account is pending_verification, yet Connect still credits its sales, and before CMS v3.16.91 it was true for any Server API program. onboard now reads stripe_account_bound (affiliate-cms#539) and treats its absence as unknown; it reads the binding before the wizard, which then prints the lead step only; a different AFFITOR_API_KEY already in the env file makes the answer unknown; comments mentioning trackSale are not reported as a double count; the Paddle snippet also skips a $0 total. Tests go through runOnboard; the snippet stub checks amount and invoiceId like the SDK.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sonpiaz sonpiaz changed the title fix: onboard adds no trackSale when Stripe is connected; sale snippets never throw without a key fix: avoid duplicate Stripe sale wiring during onboarding Oct 18, 2026
@sonpiaz
sonpiaz merged commit 5e8be06 into main Oct 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant