Repository navigation
fix(onboarding): Set up no longer misses a legacy ComfyUI Desktop install found at startup - #2131
Conversation
…tall found at startup On a cold start the app looks for an old ComfyUI Desktop install and, when it finds one, adds it to the builds list. The Set up screen then offers "Bring over workflows, models and settings from ComfyUI Desktop" and its button reads Migrate instead of Install. The screen asks for that once, when it opens, and the answer is read from the builds list on disk. The legacy install is added by a write that startup requests and does not wait for, queued behind three other startup writes, and reads of the list did not wait for queued writes. The first window is created about 70 ms after those writes are requested, so the two race on every cold start. When the read comes first the screen shows a plain Install with no offer and never asks again. Reads of the builds list now wait for the writes that were requested before them. Startup reads the list before it opens the first window, so the window now opens after the legacy install is in the list, and the Set up screen's question cannot be answered from an older list either. Seen as a flaky e2e/lifecycle-first-use-migrate.test.ts on Windows. On main, 10 of 60 repeats of that spec had no offer; in all 10 the legacy install was in the list afterwards, written 100 to 300 ms after the panel had loaded (run 43751943810, throwaway branch bl/diag-lifecycle-migrate-windows).
When the app refused the delete, the build's card showed Error and the spec waited 30 seconds for the card to go away, then failed with "deleted tile never disappeared from chooser". That is what happened in run 43676395717: the delete was refused because the build's own update check held its operation slot, which #2117 has since fixed. The spec now stops waiting when the card shows Error, opens it, and fails with the message the app gives.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…folder on Linux On Linux the builds list lives under XDG_DATA_HOME when that is set, so the new test could have read and written the real app data folder of whoever ran it. It now runs with the same platform stub as installations.test.ts, which puts the list in the test's temporary folder on every platform.
What this is about
Two specs in the Lifecycle suite failed once and passed on retry in run 43676395717, which
failOnFlakyTeststurns into a red job. The run was for #2115, which touches neither spec, and it was built frommainat5d85efd8.Both failures are the app, not the specs:
e2e/lifecycle-first-use-migrate.test.ts:44src/main/installations.ts)e2e/lifecycle-delete-untrack.test.ts:1191. Set up did not offer to migrate
cold start with legacy desktop offers to migrate it on Set up, ticked by defaultWhat was on screen
From the failure artifact's trace and screenshots (times from the start of the test's
beforeAll):(
error-context.mdfor this test is a snapshot of a different page, an empty menu. The panel istest-failed-4.png.)Cause
Set up shows the row when it is told there is a legacy install. It asks the main process once when it opens (
get-first-use-state;PanelAppasks twice in quick succession while it loads) and never again. The answer is read from the builds list on disk.The legacy install gets into that list at startup:
ipc.register()detects it and requests a write, without waiting for it, behind three other startup writes to the same file. Reads of the list did not wait for requested writes. The first window starts loading about 75 ms after the first of those writes begins, so the write and the Set up screen's question race on every cold start. If the question is answered first, the screen shows a plain Install and stays that way however long anyone waits. The spec's 5 second wait was never the problem.This is older than the new Set up screen: the one-time question has been in
usePanelOverlayssince May. The spec that looks for the row is from #2072.What a user would see
Someone upgrading from the old ComfyUI Desktop opens the app for the first time. When the write loses the race, Set up has no migrate row and its button says Install instead of Migrate. Agreeing to the EULA and pressing it downloads a fresh install. Their old install still turns up under Builds afterwards, with its own Migrate action, so nothing is lost, but the offer the screen exists to make is skipped.
Fix
Reads of the builds list (
list,get,hasNameConflict,getRecent,getRecentByCategory) now wait for the writes that had been requested before them, then read. Writes are unchanged and do not wait for reads, and a write that fails does not hold up or fail the reads behind it.Two things follow for a cold start:
migrateDefaults) before it opens the first window, so the window now opens after the legacy install is in the list.A narrower fix would be to have startup wait for its own four writes. I changed the read instead because the read is what was wrong: the app could be handed a list older than a write it had already asked for, and that holds for every reader, not only this one. Every reader of the builds list in the main process is affected: each now waits for writes already in the queue. Measured below, that wait is a median of 6 ms at startup.
The spec is unchanged.
Evidence
All on GitHub's Windows runner, on the throwaway branch
bl/diag-lifecycle-migrate-windows: this spec file repeated with no retries, and the spec printing wheninstallations.jsonwas written, when the panel loaded, and what the app said afterwards.main(run 43751943810)mainthe legacy install was in the builds list and ininstallations.jsonwhen the test looked afterwards, and the app log had no failed write. The registration was late, not missing: the list was written 99 to 299 ms after the panel finished loading. In the 50 that passed it was written a median of 426 ms before.mainthe startup writes overlap the creation of the window and take a median of 160 ms even when the row shows. With the fix they finish before the window is created, in a median of 6 ms, so waiting for them costs nothing that shows: the window did not start later. (Runners differ from run to run, so read the last row as "no slower", not "faster".)With the legacy registration held for 3 seconds on purpose (one
setTimeoutin the queued write, on the throwaway branch only), 10 repeats each:Unit tests (
src/main/installations.test.ts, newsrc/main/lib/firstUseDetection.test.ts), with the real builds list in a real temporary folder and one write held at its rename:Without the change to
installations.tsthe first three fail: the list comes back empty, the build comes back with its old name, and Set up is toldhasLegacyDesktop: false.2. Delete did not remove the build
kebab Delete drops the record AND removes the install directoryWhat was on screen
From the trace (times from the start of the test):
Cause
On
5d85efd8a build's update check held the build's operation slot and Delete was refused while it ran. This is exactly what #2117 found on this spec and fixed (2 of 20 repeats failed before it, 40 of 40 passed after, 14 of those with the check still in flight). With #2117 in the build, its own PR run, the nightly onmainand one other PR's run have passed this spec.Change here
The spec used to wait 30 seconds for the card to go away and then fail with "deleted tile never disappeared from chooser", which says nothing about why. It now stops waiting as soon as the card shows Error, opens the error, and fails with the message the app gives.
Not in this PR
detectDesktopInstall()throws when the old install's folder and its parent folder are both gone, andipc.register()calls it unguarded before the first window opens. Read from the code, not reproduced.bl/diag-lifecycle-migrate-windowsis still on the remote. It was never a PR.Checks
Only the changed test files were run locally. CI runs the rest, and the Lifecycle suite runs on this PR through the
run-lifecyclelabel.Lifecycle suite on this PR's head (
fc737582), twice:run-lifecyclelabelTwo green runs of a spec that failed one time in six say little by themselves. The repeats above are the evidence for the migrate spec, and #2117's repeats are the evidence for the delete spec.