Skip to content

FE-3257 fix(billing-web): a late sign-in no longer sends an open checkout to the home page - #20319

Merged
dante01yoon merged 3 commits into
mainfrom
fix/billing-web-signin-stale-return
Oct 6, 2026
Merged

dante01yoon merged 3 commits into
mainfrom
fix/billing-web-signin-stale-return

Conversation

@dante01yoon

@dante01yoon dante01yoon commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Why

In QA, opening testbilling from the app's subscribe sometimes landed on the billing home page ("Open billing from your Comfy product to manage your plan…") instead of the checkout, with preview-subscribe canceled in DevTools. Denys reproduced it often by opening checkout, closing the tab, and subscribing again.

Root cause

A fresh billing-web tab always goes through /sign-in?returnTo=/v1/checkout…. SignInView reads route.query.returnTo only when onSignedIn fires. With the shared web session, App.vue remounts the router view under BillingShell once the workspace scope arrives, so a second sign-in page mounts and starts its own mint for the already-restored user. The first page's mint navigates to /v1/checkout correctly. When the second one resolves later, the current route is the checkout, which has no returnTo. safeReturnTo(undefined) then falls back to /, and the router replaces the checkout with the home page mid-preview. The timing depends on the shell remount and the second /workspaces/current round trip, which is why it's intermittent.

How

onSignedIn navigates only while the tab is still on the sign-in route. A sign-in that resolves after the tab has moved on does nothing.

AS IS / TO BE

AS IS (testbilling, QA report) TO BE (this branch, local billing-web against testcloud)
The subscribe link lands on the billing home page at / The same link goes through /sign-in and stays on /v1/checkout

Test plan

  • SignInView: a sign-in returns to the returnTo link; a sign-in resolving after the route moved to the entry does not call router.replace (red before the fix)

  • vitest apps/billing-web/src/views + src/auth: 391 passed

  • Local billing-web against testcloud: opened the checkout link fresh twice, and both went through /sign-in and landed on /v1/checkout

  • Verify on testbilling after deploy

  • Fixes FE-3257

  • QA thread: https://comfy-organization.slack.com/archives/C0932CGKT5K/p1791299972813079

@dante01yoon
dante01yoon requested a review from a team October 6, 2026 15:50
@dante01yoon dante01yoon added needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch core/1.56 Backport PRs for core 1.56 cloud/1.56 Backport PRs for cloud 1.56 labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🌾 Fallow: ✅ Passed

Fallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened.

No new findings in the changed files.

Reproduce locally
# the base the gate compared against
npx fallow audit --root . --quiet --format json \
  --changed-since ed459b7cac5d170f749da06a8e3015bcea41c54f

Full docs: ADR-DEVEX-LINT-0015

🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measure

Executes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight ecosystem-matrix shard checks are a harness self-test; the pack verdict is matrix-verdict.

This candidate changes nothing the matrix measures, so every expensive stage was skipped.

Reproduce locally
# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
  npx vitest run --config vitest.matrix.config.mts

Full docs: scripts/registry-census/README.md

@github-actions github-actions Bot added the risk:xhigh PR risk grade (advisory shadow check; grader-owned) label Oct 6, 2026
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 39fe4542-90b9-45d9-ad84-b33fb81e20c0
📥 Commits

Reviewing files that changed from the base of the PR and between ed459b7 and fdf35fc.

📒 Files selected for processing (2)
  • apps/billing-web/src/views/SignInView.test.ts
  • apps/billing-web/src/views/SignInView.vue

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


📝 Walkthrough

Walkthrough

The sign-in completion callback now skips return navigation when the current route is not named sign-in. Tests cover navigation to the encoded return destination and a late callback after reaching that destination.

Changes

Sign-in return navigation

Layer / File(s) Summary
Guard sign-in return navigation
apps/billing-web/src/views/SignInView.vue, apps/billing-web/src/views/SignInView.test.ts
The callback replaces the route only when the current route is named sign-in. Tests capture the callback and verify navigation to the encoded returnTo destination and no additional replacement after reaching it.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: anupreet-comfy

Merge Risk: ⚪ Minimal · up to fdf35

This change preserves the requested destination after sign-in while preventing a late completion from redirecting users away from checkout. No actionable merge-blocking risk is evident.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to fdf35

The change prevents late sign-in completion from redirecting a tab that has already left sign-in. It preserves destination validation and authentication behavior, with no material security risk identified in the changed flow.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed authority is navigation within the current billing-web tab. The added condition reduces opportunities for a completion callback to replace the route; the base-to-head change does not grant new session, workspace or service authority.

Trust Boundaries and Controls

  • observed — The URL-controlled returnTo query reaches router.replace only through safeReturnTo. Its underlying validator rejects non-path inputs, protocol-relative and backslash prefixes, control characters, and resolutions outside the current origin, falling back to home.

Resilience and Maintainability Implications

  • inferred — The guard checks the live route name, not the originating sign-in attempt. An older completion could therefore navigate after the tab leaves and later returns to sign-in. That limitation predates this PR, remains subject to the existing destination validator, and is not evidence of newly weakened identity or authorization controls.
🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
End-To-End Regression Coverage For Fixes ⚠️ Warning The PR title and commit subject include the bug-fix signal “fix.” The listed changes are under apps/billing-web/src/, and no changed file under browser_tests/ is listed. The PR description reports… Add or update a Playwright regression test under browser_tests/, or add a concrete explanation in the PR description of why an end-to-end regression test is not practical.
✅ Passed checks (6 passed)
Check name Status Explanation
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.
Website End-To-End Regression Coverage ✅ Passed The PR changes apps/billing-web/src/views/SignInView.vue and its test. It does not change website runtime files under apps/website/src/ or apps/website/public/, so this check does not apply.
Adr Compliance For Entity/Litegraph Changes ✅ Passed The PR changes apps/billing-web/src/views/SignInView.test.ts and apps/billing-web/src/views/SignInView.vue. Neither path is under src/lib/litegraph/ or src/ecs/, and neither file concerns grap…
Title check ✅ Passed The title clearly describes the main fix: a late sign-in no longer redirects an open checkout to the home page.
Description check ✅ Passed The description explains the problem, root cause, behavior change, and verification. Its “Why” and “Test plan” sections cover the template’s summary and verification requirements, though the headings …
Full details: End-To-End Regression Coverage For Fixes

Explanation

The PR title and commit subject include the bug-fix signal “fix.” The listed changes are under apps/billing-web/src/, and no changed file under browser_tests/ is listed. The PR description reports unit and local testing, but it does not explain why an end-to-end regression test is not practical.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🔧 Auto-fixes Applied

This PR has been automatically updated to fix linting and formatting issues.

⚠️ Important: Your local branch is now behind. Run git pull before making additional changes to avoid conflicts.

Changes made:

  • ESLint auto-fixes
  • Oxfmt formatting

@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main   #20319      +/-   ##
==========================================
+ Coverage   85.46%   86.38%   +0.92%     
==========================================
  Files        3523     2581     -942     
  Lines      169083   144235   -24848     
  Branches    46302    39415    -6887     
==========================================
- Hits       144505   124603   -19902     
+ Misses      22593    19100    -3493     
+ Partials     1985      532    -1453     
Flag Coverage Δ
billing-web-unit 92.23% <100.00%> (-0.03%) ⬇️
website-unit ?

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

Files with missing lines Coverage Δ
apps/billing-web/src/views/SignInView.vue 93.44% <100.00%> (+0.10%) ⬆️

... and 943 files with indirect coverage changes

🚀 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.

@christian-byrne christian-byrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the exact current head, changed files, regression coverage, settled required checks, and existing review threads. The implementation is sound and ready for the author to queue.

@dante01yoon
dante01yoon added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit 18cafc5 Oct 6, 2026
91 checks passed
@dante01yoon
dante01yoon deleted the fix/billing-web-signin-stale-return branch October 6, 2026 17:25
@comfy-pr-bot

Copy link
Copy Markdown
Member

@dante01yoon Successfully backported to #20324

@comfy-pr-bot

Copy link
Copy Markdown
Member

@dante01yoon Successfully backported to #20326

comfy-pr-bot added a commit that referenced this pull request Oct 6, 2026
…er sends an open checkout to the home page (#20324)

Backport of #20319 to `core/1.56`

Automatically created by backport workflow.

Co-authored-by: Dante <bunggl@naver.com>
Co-authored-by: GitHub Action <action@github.com>
comfy-pr-bot added a commit that referenced this pull request Oct 6, 2026
…ger sends an open checkout to the home page (#20326)

Backport of #20319 to `cloud/1.56`

Automatically created by backport workflow.

Co-authored-by: Dante <bunggl@naver.com>
Co-authored-by: GitHub Action <action@github.com>
@comfy-pr-bot comfy-pr-bot added the released:cloud PR has been released to cloud label Oct 10, 2026
@comfy-pr-bot

Copy link
Copy Markdown
Member

⚠️ Backport to core/1.56 failed

Reason: Merge conflicts detected during cherry-pick of 18cafc5

The auto-backport could not be completed automatically. Please backport
manually onto branch backport-20319-to-core-1.56 (from origin/core/1.56) and
open a PR to core/1.56.

This may be a stacking conflict rather than a real one. #20698, #20347 are still open against core/1.56. If this PR sits on top of any of them, the conflict will disappear once they merge — wait for that, then remove and re-add the needs-backport label to re-run this workflow.

📄 Conflicting files
apps/billing-web/src/views/SignInView.test.ts
🤖 Prompt for AI Agents
Backport PR #20319 (https://github.com/Comfy-Org/ComfyUI_frontend/pull/20319) to core/1.56.
Cherry-pick merge commit 18cafc588761528c90b79b50bccdb0b9b47010b7 onto new branch
backport-20319-to-core-1.56 from origin/core/1.56.
Resolve conflicts in: apps/billing-web/src/views/SignInView.test.ts .

> **This may be a stacking conflict rather than a real one.** #20698, #20347 are still open against `core/1.56`. If this PR sits on top of any of them, the conflict will disappear once they merge — wait for that, then remove and re-add the `needs-backport` label to re-run this workflow.

For test snapshots (browser_tests/**/*-snapshots/), accept PR version if
changed in original PR, else keep target. For package.json versions, keep
target branch. For pnpm-lock.yaml, regenerate with pnpm install.
Ask user for non-obvious conflicts.
Create PR titled "[backport core/1.56] <original title>" with label "backport".
See .github/workflows/pr-backport.yaml for workflow details.

cc @dante01yoon

@comfy-pr-bot

Copy link
Copy Markdown
Member

⚠️ Backport to cloud/1.56 failed

Reason: Merge conflicts detected during cherry-pick of 18cafc5

The auto-backport could not be completed automatically. Please backport
manually onto branch backport-20319-to-cloud-1.56 (from origin/cloud/1.56) and
open a PR to cloud/1.56.

This may be a stacking conflict rather than a real one. #20699 are still open against cloud/1.56. If this PR sits on top of any of them, the conflict will disappear once they merge — wait for that, then remove and re-add the needs-backport label to re-run this workflow.

📄 Conflicting files
apps/billing-web/src/views/SignInView.test.ts
🤖 Prompt for AI Agents
Backport PR #20319 (https://github.com/Comfy-Org/ComfyUI_frontend/pull/20319) to cloud/1.56.
Cherry-pick merge commit 18cafc588761528c90b79b50bccdb0b9b47010b7 onto new branch
backport-20319-to-cloud-1.56 from origin/cloud/1.56.
Resolve conflicts in: apps/billing-web/src/views/SignInView.test.ts .

> **This may be a stacking conflict rather than a real one.** #20699 are still open against `cloud/1.56`. If this PR sits on top of any of them, the conflict will disappear once they merge — wait for that, then remove and re-add the `needs-backport` label to re-run this workflow.

For test snapshots (browser_tests/**/*-snapshots/), accept PR version if
changed in original PR, else keep target. For package.json versions, keep
target branch. For pnpm-lock.yaml, regenerate with pnpm install.
Ask user for non-obvious conflicts.
Create PR titled "[backport cloud/1.56] <original title>" with label "backport".
See .github/workflows/pr-backport.yaml for workflow details.

cc @dante01yoon

DrJKL pushed a commit to mcmerdith/ComfyUI_frontend that referenced this pull request Oct 17, 2026
…still resolving (Comfy-Org#21146)

## Summary

Every cold load of billing-web's `/sign-in` briefly showed "Sign-in is
unavailable right now." before the sign-in providers appeared. The
notice now renders only after the identity configuration has actually
failed to resolve.

**Why:** Hunter hit the flash on production while re-testing IR-146
(billing-web upgrade flow, build `24f1250`). It reads as a failure on a
healthy page and is the same copy an incident would show, so it misleads
users and would make a notice-based monitor fire on every visit.

**Root cause:** `useSignInController` exposed `available = identity !==
undefined`. `identity` is `undefined` both while `/api/features` is
still being fetched and after the fetch has failed, so `SignInView`
showed the unavailable notice (and its retry) for the whole resolution
window.

**How:** the controller now reports `identityStatus: 'resolving' |
'ready' | 'unavailable'`.
- `unavailable`: the notice and "Try again" render.
- `resolving`: no notice, provider buttons stay disabled.
- `ready`: unchanged.

The existing 4s config-fetch timeout still ends a hung request in
`unavailable`, so a dead config endpoint still surfaces the notice. The
two `billingWebAuth.flagOff` tests that asserted the notice during the
undecided first render now assert the opposite; their routing intent
(reach `/sign-in` without waiting for the flag) is unchanged.

## Verification

- Tests: `pnpm exec vitest run --root apps/billing-web` passes (1516
tests). New controller test: `resolving` until the identity resolution
settles, then `unavailable`. New view test: no alert and no retry while
resolving, with providers disabled. `pnpm typecheck:billing-web` passes.
- Human QA: signed-out cold load of
`/v1/checkout?product=comfyui&return_to=comfyui_workspace&plan=standard-annual`
in a fresh headless Chromium context, with only `GET /api/features` held
back 3s (network delay, the real backend still answers). AS IS =
production billing.comfy.org (`24f1250`, cloud.comfy.org); TO BE = this
PR's Vercel preview (testcloud.comfy.org). Screenshots at ~1s (config in
flight) and after the providers enable.

| AS IS (prod `24f1250`) | TO BE (this branch) |
|---|---|
| **Resolving** (~1s, `/api/features` in flight)<br><img width="480"
alt="as-is-resolving"
src="https://github.com/user-attachments/assets/25b0815c-be63-4abc-91d8-981deacabff6"
/><br>"Sign-in is unavailable right now." + "Try again" | <img
width="480" alt="to-be-resolving"
src="https://github.com/user-attachments/assets/916af223-99dc-42d5-81b2-625d08f5f6e6"
/><br>No alert, providers disabled |
| **Settled** (config resolved)<br><img width="480" alt="as-is-settled"
src="https://github.com/user-attachments/assets/2ce46f0d-3419-4a40-b599-325b703385fe"
/> | <img width="480" alt="to-be-settled"
src="https://github.com/user-attachments/assets/6f81666f-4554-4032-b34d-b76980b38813"
/> |

## Plan position (IR-146 follow-ups)

| Item | Owner | PR | Status |
|---|---|---|---|
| Roll back `hosted_billing_destination` to stripe 100% | FE | — | Done
|
| Production deploy of billing-web `24f1250` (Comfy-Org#20319, Comfy-Org#20532) | FE | — |
Done |
| **B1: no "unavailable" flash while sign-in resolves** | FE | **this
PR** | **In review** |
| B2: card form on billing-web checkout (`embedded_checked_enabled`) |
FE + Hunter | — | Testing |
| B3: revert a scheduled change from the UI | Product | — | Needs ticket
|
| A1: production drift alert for billing-web | FE | — | Planned |

```mermaid
graph LR
  R["Flag rollback"] --> D["Prod deploy 24f1250"]
  D --> B1["B1: sign-in flash fix (this PR)"]
  D --> B2["B2: embedded checkout decision"]
  B1 --> RR["Re-ramp billing_web"]
  B2 --> RR
  A1["A1: prod drift alert"] --> RR
  style B1 fill:#f9d71c,stroke:Comfy-Org#333,stroke-width:2px
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cloud/1.56 Backport PRs for cloud 1.56 core/1.56 Backport PRs for core 1.56 needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch released:cloud PR has been released to cloud risk:xhigh PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants