Repository navigation
fix(onboarding): refuse the first-run tour when the canvas is hidden - #14673
Conversation
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 1800 passed, 0 failed · 4 flaky📊 Browser Reports
📦 Bundle: 8.69 MB gzip 🔴 +155 BDetailsSummary
Category Glance App Entry Points — 3.67 kB (baseline 3.67 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.36 MB (baseline 1.36 MB) • 🔴 +463 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed / 2 unchanged Views & Navigation — 124 kB (baseline 124 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces Status: 17 unchanged Panels & Settings — 565 kB (baseline 565 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens Status: 26 unchanged User & Accounts — 27 kB (baseline 27 kB) • ⚪ 0 BAuthentication, profile, and account management bundles Status: 10 unchanged Editors & Dialogs — 125 kB (baseline 125 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors Status: 8 unchanged UI Components — 67.1 kB (baseline 67.1 kB) • ⚪ 0 BReusable component library chunks Status: 14 unchanged Data & Services — 3.5 MB (baseline 3.5 MB) • ⚪ 0 BStores, services, APIs, and repositories Status: 17 unchanged Utilities & Hooks — 550 kB (baseline 550 kB) • ⚪ 0 BHelpers, composables, and utility bundles Status: 38 unchanged Vendor & Third-Party — 16.3 MB (baseline 16.3 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 17 unchanged Other — 14 MB (baseline 14 MB) • ⚪ 0 BBundles that do not match a named category
Status: 1 added / 1 removed / 284 unchanged ⚡ Performance
|
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe first-run tour now checks for desktop layout and non-linear mode before startup. It rechecks the canvas context after the preview delay. Invalid contexts prevent engine startup and renderer side effects. ChangesFirst-run tour startup gating
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 inconclusive)
✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.ts (1)
494-494: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep regression coverage for mid-tour context loss.
The controller still uses
tourContextHoldsafter a tour starts, and the PR objective requires that behavior to remain unchanged. Line 494 removes the tests for Linear mode and narrow viewports during an active tour.Retain both tests, or add equivalent tests that start the tour and then change each context. Otherwise, a regression in the existing hold path can pass CI.
As per path instructions, tests should cover relevant edge cases while exercising real code. Based on the PR objective, existing mid-tour hold behavior must remain unchanged.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.ts` at line 494, Restore regression coverage in the first-run tour controller tests for both context-loss cases: switching to Linear view and entering a narrow viewport after the tour starts. Ensure each test starts an active tour, changes the relevant context, and verifies the existing tourContextHolds behavior remains intact, using the real controller flow.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.ts`:
- Around line 302-313: Update both refusal-case tests around the starting
assertions to verify the mocked settingStore.set was not called with
('Comfy.VueNodes.Enabled', true), while retaining the existing final
mocks.vueNodesEnabled false assertions and real startup-code execution.
In `@src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.ts`:
- Around line 151-155: In the pending-tour startup flow around
settingStore.set(), delay(), and engine.startTour(), re-check
canvasContextHolds.value after all awaited setup and before starting the tour.
If the hold is no longer active, restore Comfy.VueNodes.Enabled and return false
without calling engine.startTour(), preserving the existing hold-watcher cleanup
behavior.
---
Outside diff comments:
In `@src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.ts`:
- Line 494: Restore regression coverage in the first-run tour controller tests
for both context-loss cases: switching to Linear view and entering a narrow
viewport after the tour starts. Ensure each test starts an active tour, changes
the relevant context, and verifies the existing tourContextHolds behavior
remains intact, using the real controller flow.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 226629f6-d413-4091-8c0c-901c5f37c74e
📒 Files selected for processing (2)
src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.tssrc/renderer/extensions/firstRunTour/tour/useFirstRunTourController.ts
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #14673 +/- ##
==========================================
+ Coverage 81.29% 81.32% +0.02%
==========================================
Files 1873 1873
Lines 106900 106703 -197
Branches 32977 33376 +399
==========================================
- Hits 86902 86773 -129
+ Misses 19641 19574 -67
+ Partials 357 356 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 16 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Review feedback on #14673. The entry guard runs before `beginTour` awaits the renderer write and the 500 ms intro preview, so a switch into linear mode inside that window still opened the tour: the holds watcher fires while `activeTour` is still null, so it has nothing to end, and `engine.startTour` does not consult holds on the way in. Re-check before starting; the existing `!started` path already hands the renderer switch back. Also spy on `settingStore.set` rather than only reading the resulting value, so a refusal that flipped `Comfy.VueNodes.Enabled` and put it back can no longer pass as one that never touched it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Not restoring these two, and I don't think equivalent tests are worth adding. Reasons, in order: 1. The deleted tests were not mid-tour tests. Both set the context before it('refuses to hold a tour on a viewport below the desktop layout', async () => {
setViewportWidth(500)
await tourOnRunStep() // ← beginTour now refuses here
expect(registeredTourHolds()).toBe(false)
})With the precondition this PR adds, 2. Mid-tour linear-mode loss is still covered, at 3. Mid-tour viewport narrowing is not reachable in this harness.
4. Every term of the hold is still pinned.
So a regression in the hold path cannot pass CI. Happy to revisit if the viewport case becomes drivable. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Review feedback on #14673. The entry guard runs before `beginTour` awaits the renderer write and the 500 ms intro preview, so a switch into linear mode inside that window still opened the tour: the holds watcher fires while `activeTour` is still null, so it has nothing to end, and `engine.startTour` does not consult holds on the way in. Re-check before starting; the existing `!started` path already hands the renderer switch back. Also spy on `settingStore.set` rather than only reading the resulting value, so a refusal that flipped `Comfy.VueNodes.Enabled` and put it back can no longer pass as one that never touched it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
3d36326
a38d5d2 to
3d36326
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.ts`:
- Around line 374-381: Update the test around beginTour to flush the initial
setup and arm the intro-preview timer before setting mocks.linearMode.value to
true, then use async timer advancement through INTRO_PREVIEW_MS. Ensure the test
specifically verifies that losing the canvas context during the intro delay
prevents the tour from opening, rather than losing it while beginTour is still
awaiting setup.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: f3057dff-558e-4acd-bfbe-2a4a492dde5a
📒 Files selected for processing (2)
src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.tssrc/renderer/extensions/firstRunTour/tour/useFirstRunTourController.ts
|
Both CodeRabbit points checked against the code. One is answered by evidence, 1. "the test may be losing the canvas during setup, not during the intro preview"The test does exercise the new path. Proof by mutation — reverting only the - const started =
- canvasContextHolds.value && (await engine.startTour('firstRun'))
+ const started = await engine.startTour('firstRun')Exactly one test fails, and it is that one. Restoring the guard returns 51/51. 2. "keep regression coverage for mid-tour context loss"Half of this is already there — The viewport limb genuinely has no mid-tour test, and you are right that it
So Reaching it would mean either stubbing Recording the gap here rather than filing it silently: mid-tour viewport |
`?template=X&mode=linear` boots straight into the Linear view, which `display:none`s the graph canvas. The tour opened over it anyway: coach cards floated above the Linear view pointing at nothing until their targets timed out (~8s), then an error toast — and `Comfy.VueNodes.Enabled` was left flipped on, because it is only reverted when the engine turns the start down. `tourContextHolds` already knew about linear mode, but holds are a running-tour mechanism: the engine's watcher only ends a tour that is already active, and only when holds *change*. A context that was already lost when the tour was requested produces no change, so nothing fired. Split the canvas half of the predicate out as `canvasContextHolds` — the part that is meaningful before a tour exists — and check it at the top of `beginTour`, ahead of the renderer switch so there is nothing to undo. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review feedback on #14673. The entry guard runs before `beginTour` awaits the renderer write and the 500 ms intro preview, so a switch into linear mode inside that window still opened the tour: the holds watcher fires while `activeTour` is still null, so it has nothing to end, and `engine.startTour` does not consult holds on the way in. Re-check before starting; the existing `!started` path already hands the renderer switch back. Also spy on `settingStore.set` rather than only reading the resulting value, so a refusal that flipped `Comfy.VueNodes.Enabled` and put it back can no longer pass as one that never touched it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
3d36326 to
c27d65b
Compare
`beginTour` awaits the renderer switch before `delay(INTRO_PREVIEW_MS)`, so flipping `linearMode` immediately after calling it changed the value while setup was still running rather than during the preview the test names. The test was already mutation-proof either way - removing the post-delay re-check fails it and nothing else - because no check sits between the setting write and the delay. But that is a property of today's code, not of the test, so a later check added there would have quietly made this pass for the wrong reason. Flushes setup with a zero-length tick first. Addresses #14673 (comment)
|
Done in What you spotted is real. What it did not affect: the test was already mutation-proof. Removing the That is because no check currently sits between the setting write and the Still 51/51 unmutated. |
|
Follow-up opened: https://github.com/Comfy-Org/ComfyUI_frontend/pull/16598\n\n Full context for agent readers\n\nThe follow-up adds the deferred general holds precondition in the tour store, updates the store harness to use valid context, and adds real-browser coverage for mid-tour viewport narrowing.\n\n |
|
Follow-up #16598 carries the deferred tour-hold coverage. Full context for agent readers
The mandatory dedupe check found #16598 before another PR was opened. Its body links the source review records, it has the default FE assignees, and roster reviewer benceruleanlu is requested. |
…n and viewport coverage (Comfy-Org#16598) Follow-up to Comfy-Org#14673 ## Summary - refuse registered tours before state mutation when their context already fails - make store tests start from a valid app-mode context - cover active-tour teardown when a real browser viewport drops below desktop size Follow-up to Comfy-Org#14673. Addressed review records: - Comfy-Org#14673 (comment) - Comfy-Org#14673 (comment) ## Verification - `pnpm typecheck` - `pnpm typecheck:browser` - `pnpm test:unit src/platform/onboarding` (188 passed) - `pnpm test:unit src/renderer/extensions/firstRunTour src/platform/onboarding` (435 passed; one unrelated timing test failed under parallel load and passed alone) - browser test authored and typechecked; local execution unavailable because no frontend was running on localhost:5173 <!-- authored-by:agent addr-drain -->
Closes #14628
The failure
Open
/?template=image_z_image_turbo&mode=linearas a new cloud user.GraphViewputsv-show="!linearMode"on the canvas container, so the graph canvas isdisplay:noneand the Linear view covers the screen. Adisplay:noneelement still yields a (all-zero)DOMRect, so the tour's targets read as mounted and the tour opens anyway. The user gets coach cards floating over the Linear view pointing at nothing, until the targets time out (~8s) and an error toast fires.Comfy.VueNodes.Enabledis left flipped on as well, sincebeginTouronly reverts it when the engine turns the start down — and here it did not.Why the existing guard did not catch it
tourContextHoldsalready contains!canvasStore.linearMode, and it correctly ends a tour when the user switches into linear mode mid-walk. But holds are a running-tour mechanism:begin()has no holds precondition.onboardingTourStore.tsfires only on a change, and only ends a tour that is alreadyactiveTour.If linear mode is already on when the tour is requested, holds are already
false, nothing changes, and nothing fires.Worth stating explicitly, since the issue raises it: adding
{ immediate: true }to that watcher would not have fixed this. It runs at store construction, when no tour is active, so it has nothing to end. The gap is the missing precondition, not the watcher's timing.The fix
tourContextHoldswas doing two jobs. This splits out the half that is meaningful before a tour exists:The workflow-identity half can only be evaluated once
tourWorkflowis set, whichbeginTouritself does — so it cannot serve as a precondition. The canvas half can, and it is the half this bug is about.beginTournow checks it immediately after the already-running check, ahead of theComfy.VueNodes.Enabledflip, so a refused tour leaves nothing behind to undo.It is checked a second time after the 500 ms intro preview. That window is long enough for the user to switch into linear mode themselves, and the holds watcher cannot catch that either — it fires while
activeTouris stillnull, so it has nothing to end, andengine.startTourdoes not consult holds on the way in. The re-check routes into the existing!startedpath, which already hands the renderer switch back. (Raised in review; the first version of this PR had the entry guard only.)Why here and not in
begin()The issue notes a more general fix: a holds precondition inside
begin()inonboardingTourStore.ts, which would close the class for every tour. I did not take it, deliberately:begin()refuses afterbeginTourhas already flipped the renderer setting and burned the 500 ms intro delay. It would be reverted (started === falsetakes the revert path), but the guard here avoids the write entirely.beginTouris where this tour's context is known and wheretourContextHoldsis constructed; checking your own precondition at the point you build the tour is local and obvious.The general precondition in
begin()remains worth doing as follow-up work, together with the store test setup it needs.Test fallout, handled
Returning before
registerTourmeanstourHolds('firstRun')stays at its unregistered default oftrue— correctly, since no tour is registered and there is nothing to hold. Two existing tests assertedregisteredTourHolds() === falsefor linear mode and for narrow viewports. Rather than delete them, they now assert the stronger property that those contexts were always about: the tour never opens.refuses to open over the linear view, which hides the canvasrefuses to open on a viewport below the desktop layoutEach asserts
beginTourreturnsfalse,engine.startTourwas never called, andsettingStore.setwas never called with('Comfy.VueNodes.Enabled', true). They moved from therun outcomeblock tostarting, where a refusal to open belongs.A third test,
refuses to open when the canvas goes away during the intro preview, covers the window described above. The setting mock is now a spy rather than a plain writer, so a refusal that flipped the renderer on and put it back can no longer read as one that never touched it — also raised in review.The mid-walk test (
ends the tour when the user switches into the linear view mid-walk) is unchanged and still passing — the end-condition behaviour is untouched.Verified
pnpm install --frozen-lockfile,pnpm format:check,pnpm lint,pnpm typecheck— all clean.pnpm test:unit src/renderer/extensions/firstRunTour src/platform/onboarding— 356 passed, 23 files. No test outside the two rewritten ones changed behaviour.pnpm test:unit— 1095 files, 14954 passed, 8 skipped, 1 failed:onboardingCloudRoutes.test.ts > lazily resolves the /oauth layout and consent view componentstimes out at 5 s. Unrelated and flaky — it comes and goes between runs on this worktree and on a sibling worktree that does not contain these changes, and it is a lazy dynamic-import timing flake in this environment.if (!canvasContextHolds.value) return falserefuses to open over the linear viewandrefuses to open on a viewport below the desktop layoutfail (2 failed, 38 passed)canvasContextHolds.value &&re-check beforestartTourrefuses to open when the canvas goes away during the intro previewfails (1 failed, 39 passed)Each guard is gated by its own tests, and neither is carrying the other.
Not verified
?template=X&mode=linearboot. The reproduction path (v-showon the canvas container, zero-DOMRecttargets reading as mounted) is taken from the issue and reasoned about, not re-observed in a browser.GettingStartedScreencall site (await beginTour(id)) now has one more way to getfalseback. It already handled a refusal — the engine could always turn a start down — so no change was made there, but that path was reasoned about rather than exercised.firstRuntour is fixed.appModestill has no precondition on its holds; in practice it is shielded because itsautoOpencondition is a subset of its holds, but the class of bug remains open there.