Skip to content

fix(models): accept the Comfy custom Stripe checkout domain - #17668

Merged
MaanilVerma merged 1 commit into
mainfrom
fix/topup-checkout-custom-domain
Sep 14, 2026
Merged

MaanilVerma merged 1 commit into
mainfrom
fix/topup-checkout-custom-domain

Conversation

@MaanilVerma

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #17466. The top-up "Buy credits" dialog showed "Checkout could not start" on every Continue click, even though the backend was creating the Stripe session fine.

The client validator in buy-credits.ts only accepted checkout.stripe.com, but the Comfy Stripe account serves its hosted Checkout page from a custom domain, checkout.comfy.org, in every environment (confirmed in the cloud repo's environments/prod/api_checkout_test.tf). So a valid 200 with a checkout.comfy.org URL was rejected as INVALID_RESPONSE, which falls through to the generic failure state. The backend had already opened the session, so the user was blocked on a checkout that actually existed.

Reproduced locally against staging: Continue returned 200 with checkout_url: https://checkout.comfy.org/c/pay/cs_test_... and the dialog still failed.

Changes

  • Allowlist both checkout.stripe.com and checkout.comfy.org in the checkout-URL validator, via an exact-match Set. All the other guards stay (https only, no port, no embedded credentials), so look-alikes like checkout.comfy.org.evil.test are still refused.
  • Add unit coverage: accept the custom domain, and reject the custom-domain look-alike.

Review Focus

Testing

  • vitest run src/lib/workshop/buy-credits.test.ts — 11 pass (2 new)
  • vitest run src/components/workshop/BuyCreditsDialog.test.ts — 17 pass
  • Full workshop + credits suite — 414 pass, 49 files
  • astro check — 0 errors, 0 warnings
  • eslint / oxfmt on changed files — clean

@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 90281836-7062-4eb6-9f0c-8bc5767d5ca5

📥 Commits

Reviewing files that changed from the base of the PR and between 6eb376d and 5597ec6.

📒 Files selected for processing (2)
  • apps/website/src/lib/workshop/buy-credits.test.ts
  • apps/website/src/lib/workshop/buy-credits.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The checkout URL validation now trusts checkout.stripe.com and checkout.comfy.org. Tests cover valid Comfy checkout URLs and reject a lookalike attacker-controlled hostname.

Changes

Checkout host validation

Layer / File(s) Summary
Trusted hosts and URL validation
apps/website/src/lib/workshop/buy-credits.ts, apps/website/src/lib/workshop/buy-credits.test.ts
The checkout URL refinement uses an allowlist containing both trusted hosts. Tests verify the Comfy domain is accepted and checkout.comfy.org.evil.test is rejected.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: anupreet-comfy

Merge Risk: ⚪ Minimal · up to 5597e

The checkout validator supports both trusted domains while retaining hostname safety checks, so the change is ready to merge.


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore (reviewers only)

❌ Failed checks (1 error, 1 inconclusive)

Check name Status Explanation Resolution
Website End-To-End Regression Coverage ❌ Error The PR changes website runtime behavior in apps/website/src/lib/workshop/buy-credits.ts: it changes checkout URL validation so checkout.comfy.org is accepted, which fixes the user-visible Buy Cred… Add or update a Playwright regression test under apps/website/e2e/ that exercises the Buy Credits checkout flow. If an end-to-end test is not practical, record the concrete reason in the PR description.
End-To-End Regression Coverage For Fixes ❓ Inconclusive The review context identifies the changed files and PR description, but it does not provide the PR title or the actual commit subjects. The custom check requires those fields to determine whether bug-… Provide the PR title and commit subjects, then reassess the three stated conditions. Do not infer bug-fix language from the PR description alone.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: accepting Comfy’s custom Stripe checkout domain.
Description check ✅ Passed The description follows the repository template and provides the problem, implementation, security considerations, review focus, and test results. The omitted optional Breaking, Dependencies, and Scre…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Adr Compliance For Entity/Litegraph Changes ✅ Passed The changed files are apps/website/src/lib/workshop/buy-credits.test.ts and apps/website/src/lib/workshop/buy-credits.ts. None are under src/lib/litegraph/, src/ecs/, or graph-entity-related p…
Full details: End-To-End Regression Coverage For Fixes

Explanation

The review context identifies the changed files and PR description, but it does not provide the PR title or the actual commit subjects. The custom check requires those fields to determine whether bug-fix language is present. The available metadata shows changes only under apps/website, which would be exempt if that scope is exclusive, but the required bug-fix signal cannot be verified.

Full details: Website End-To-End Regression Coverage

Explanation

The PR changes website runtime behavior in apps/website/src/lib/workshop/buy-credits.ts: it changes checkout URL validation so checkout.comfy.org is accepted, which fixes the user-visible Buy Credits flow. The changed files include unit tests but no Playwright spec under apps/website/e2e/**/*.spec.ts. The PR description explains the bug and lists unit tests, but it does not give a concrete reason why an end-to-end regression test was not added.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/topup-checkout-custom-domain

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🌐 Website E2E

Tip

All tests passed.

Status ✅ Passed
Report View Report

🔗 Website Preview

Website Preview: https://comfy-website-preview-pr-17668.vercel.app

Models is built and gated by PostHog (workshop-enabled), using staging Cloud.

This commit: https://website-frontend-dzwaupdht-comfyui.vercel.app

Last updated: 2026-09-14T19:39:11Z for 5597ec6

@codecov

codecov Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@           Coverage Diff           @@
##             main   #17668   +/-   ##
=======================================
  Coverage   82.82%   82.82%           
=======================================
  Files        2763     2763           
  Lines      139124   139125    +1     
  Branches    35765    35765           
=======================================
+ Hits       115224   115225    +1     
  Misses      22799    22799           
  Partials     1101     1101           
Flag Coverage Δ
website-unit 75.79% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
apps/website/src/lib/workshop/buy-credits.ts 95.65% <100.00%> (+0.19%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the risk:high PR risk grade (advisory shadow check; grader-owned) label Sep 14, 2026
benjcooley
benjcooley previously approved these changes Sep 14, 2026

@benjcooley benjcooley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the changed validator and its caller, the custom-domain DNS target, and the focused regression coverage. The exact hostname allowlist preserves the existing HTTPS, no-port, and no-credentials protections.

Severity Count
BLOCKER 0
SHOULD FIX 0
TRIVIAL 0

No actionable issues found.

@benjcooley
benjcooley force-pushed the benjcooley/posthog-cohort-feature-flag branch from 8390ad9 to ca12b7b Compare September 14, 2026 19:03
Base automatically changed from benjcooley/posthog-cohort-feature-flag to main September 14, 2026 19:29
@benjcooley
benjcooley dismissed their stale review September 14, 2026 19:29

The base branch was changed.

@benjcooley
benjcooley requested review from a team September 14, 2026 19:29
The top-up checkout validator only accepted checkout.stripe.com, but the
Comfy Stripe account serves hosted Checkout from its custom domain
checkout.comfy.org in every environment. A valid 200 response was rejected
as INVALID_RESPONSE, so Continue surfaced "Checkout could not start" even
though the backend had created the session.

Allowlist both hosts, keeping the https/no-port/no-credentials guards and
exact-hostname matching so look-alikes are still refused.

@benjcooley benjcooley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed only the replacement commit after the rebase. Its two file patches are byte-for-byte identical to the previously approved commit; only the parent changed to merged PR #17466 on main. There were no prior inline threads to resolve.

Severity Count
BLOCKER 0
SHOULD FIX 0
TRIVIAL 0

No new actionable issues found.

@MaanilVerma
MaanilVerma added this pull request to the merge queue Sep 14, 2026
Merged via the queue into main with commit 08362dd Sep 14, 2026
66 checks passed
@MaanilVerma
MaanilVerma deleted the fix/topup-checkout-custom-domain branch September 14, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants