Commit f9ec97a
authored
fix(first-run-tour): do not spend the tutorial flag on a deferred url-intent boot (#15355)
## What
Two fixes from chasing the reported ~1-in-10 flake in
`gettingStartedTour.spec.ts › arriving on a template link › tours the
template the link loaded`
(`coach-spotlight` never appears).
**1. The flake is a harness defect, not an app race.**
`comfyPage.setupSettings()` seeds `initialSettings` through the devtools
`/devtools/set_settings` route. The fixture wrapped that call in
`try { … } catch (e) { console.error(e) }`, so when the route is
unavailable the
seed is silently skipped and every test runs against whatever the shared
per-worker user (`playwright-test-<parallelIndex>`) last persisted
server-side.
For this test that means `Comfy.TutorialCompleted` stays `true` from an
earlier
test, `resolveStartupOutcome()` returns `restored` instead of
`url-intent`,
`handleUrlWorkflow` correctly declines, and the failure surfaces as
`coach-spotlight` not found — several layers away from the cause.
Whether a
given worker's user file happens to hold `true` is what makes it look
like a
low-rate race. Adding `waitForNodes()` does not help because the nodes
were
never the problem.
Instrumented proof (temporary build, since `console.info`/`log` are
dropped from
cloud builds by the `pure` list in `vite.config.mts`):
```
[TOURDBG] initializeWorkflow {"search":"","tabState":null,"tutorialCompleted":true}
[TOURDBG] resolveStartupOutcome{"search":"?template=image_z_image_turbo","tutorialCompleted":true,…}
[TOURDBG] handleStartupOutcome {"outcome":"restored","tutorialCompleted":true}
[TOURDBG] handleUrlWorkflow {"outcome":"restored","templateId":"image_z_image_turbo","candidate":false}
```
Every decision input the tour reads (`onboardingTourEnabled`,
`isDesktopWidth`,
`isSubscriptionEnabled`, `isNewUser`) was settled and correct. The seed
was the
only thing missing.
The fixture now lets the failure through, so a broken backend reports
`Failed to setup settings: 405: Method Not Allowed` on the first test
instead of
flaking somewhere else later.
**2. A real user-facing bug the same investigation exposed.**
`handleStartupOutcome` marked `Comfy.TutorialCompleted` unconditionally
for a
`url-intent` startup, *before* `handleUrlWorkflow` decided whether the
tour would
run. That flag is write-once and server-side. So a new cloud user
opening a
template or share link while the decision defers — window below the `md`
breakpoint, `onboarding_tour_enabled` off, `subscription_required` not
in remote
config yet — has their one first-run tour spent without ever seeing it,
on that
boot and every later boot, on every device.
The same write was also too early even for an eligible boot:
`handleUrlWorkflow`
can still decline when the link loaded nothing (the case
`arriving on a link that loads nothing` covers), spending the flag on a
tour
that never ran.
So the write now belongs to whatever earns it. `handleStartupOutcome`
marks a
`url-intent` boot only for a `complete` decision; `handleUrlWorkflow`
marks it
once `beginTour()` reports a tour actually started. A deferred boot, a
dead
link, or a start the engine refused all leave the account eligible — the
next
boot has no URL to honour, so it offers Getting Started, which is the
onboarding
the failed boot owed. Candidacy is still read once per boot:
`isNewUser()` is
decided by `initializeIfNewUser()` and cached, not re-read per call,
which is
what makes this ordering safe.
## Measurements
| harness | before | after |
| --- | --- | --- |
| devtools route down (as reported) | 4/10, then 0/6 as the leaked
`true` accumulates | fails immediately with the real reason |
| devtools route healthy | 50/50 | 20/20, and 18/18 for the whole spec
file |
`--repeat-each=50 --workers=14` on a healthy backend does not reproduce
the
flake before or after, which is the control for "this was never a timing
race".
No timeouts were raised.
The `405` came from `custom_nodes/ComfyUI_devtools/__init__.py` aborting
on
`from comfy_api.v0_0_2 import IO` against an older ComfyUI checkout —
the node
import runs before the route registrations, so all of its endpoints go
missing.
Worth pinning devtools to the backend it is tested against separately;
this PR
only makes the frontend notice.
## Test plan
- `pnpm vitest run
src/renderer/extensions/firstRunTour/gettingStarted/firstRunEntry.test.ts`
— 37 passed; 5 of them fail without the source change (red/green
verified).
- `pnpm vitest run
src/components/graph/GraphCanvas.firstRunEntry.test.ts` — passed.
- `pnpm typecheck`, `pnpm typecheck:browser`, `pnpm lint`, `pnpm
format:check` — clean.
- `browser_tests/tests/gettingStartedTour.spec.ts` full file,
`--repeat-each=3` — 18/18.
- `nodeSearchBox.spec.ts` run with and without the fixture change to
confirm its 23 local failures are pre-existing environment breakage, not
this diff.
## Note for reviewers
`browser_tests/tests/gettingStartedTour.spec.ts` is also edited on
`glary/layout-ref-retain-release` (#15092), which adds a test to this
same
describe. This PR deliberately leaves that spec untouched — the fixes
are in app
code and in the shared fixture — so there is no conflict.1 parent 21ca5a3 commit f9ec97a
3 files changed
Lines changed: 143 additions & 33 deletions
File tree
- browser_tests/fixtures
- src/renderer/extensions/firstRunTour/gettingStarted
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
| 648 | + | |
653 | 649 | | |
654 | 650 | | |
655 | 651 | | |
| |||
Lines changed: 130 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| 81 | + | |
| 82 | + | |
80 | 83 | | |
81 | 84 | | |
82 | 85 | | |
| |||
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
91 | 97 | | |
92 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
93 | 111 | | |
94 | 112 | | |
95 | 113 | | |
| |||
100 | 118 | | |
101 | 119 | | |
102 | 120 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
| |||
174 | 180 | | |
175 | 181 | | |
176 | 182 | | |
177 | | - | |
| 183 | + | |
178 | 184 | | |
179 | 185 | | |
180 | 186 | | |
| |||
184 | 190 | | |
185 | 191 | | |
186 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
187 | 196 | | |
188 | 197 | | |
189 | 198 | | |
190 | 199 | | |
191 | 200 | | |
192 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
193 | 273 | | |
194 | 274 | | |
195 | 275 | | |
| |||
205 | 285 | | |
206 | 286 | | |
207 | 287 | | |
208 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
209 | 303 | | |
210 | | - | |
| 304 | + | |
211 | 305 | | |
212 | 306 | | |
213 | 307 | | |
| 308 | + | |
214 | 309 | | |
215 | 310 | | |
216 | 311 | | |
| 312 | + | |
217 | 313 | | |
218 | 314 | | |
219 | | - | |
| 315 | + | |
220 | 316 | | |
221 | 317 | | |
222 | 318 | | |
| |||
259 | 355 | | |
260 | 356 | | |
261 | 357 | | |
262 | | - | |
| 358 | + | |
263 | 359 | | |
264 | 360 | | |
265 | 361 | | |
| |||
269 | 365 | | |
270 | 366 | | |
271 | 367 | | |
272 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
273 | 385 | | |
274 | 386 | | |
275 | 387 | | |
| |||
Lines changed: 12 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 55 | + | |
| 56 | + | |
62 | 57 | | |
63 | 58 | | |
64 | 59 | | |
65 | 60 | | |
| 61 | + | |
| 62 | + | |
66 | 63 | | |
67 | | - | |
| 64 | + | |
68 | 65 | | |
69 | 66 | | |
70 | 67 | | |
71 | | - | |
72 | 68 | | |
73 | 69 | | |
74 | 70 | | |
| |||
82 | 78 | | |
83 | 79 | | |
84 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
95 | | - | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
0 commit comments