Stop writing cliAutoInstalled, deprecate in favour of cliUserUninstalled - #3781
Conversation
fredrikekelund
left a comment
There was a problem hiding this comment.
Nice to see it was such a simple change. We have an explicit framework for migration in apps/studio/src/migrations, though, so I advise we put the migration code there.
| // Migration: before cliUserUninstalled existed, an absent CLI dir with cliAutoInstalled | ||
| // set was the only signal that the user had uninstalled the CLI via Settings. Preserve | ||
| // that intent rather than silently reinstalling on the first launch of this version. | ||
| if ( userData.cliAutoInstalled && ! ( await this.isCliInstalled() ) ) { | ||
| await updateAppdata( { cliUserUninstalled: true } ); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Let's put this in a apps/studio/src/migrations migration instead.
📊 Performance Test ResultsComparing e7b9c91 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
fredrikekelund
left a comment
There was a problem hiding this comment.
I tweaked the migration logic so we rely on the canonical isStudioCliInstalled function instead of a custom reimplementation. I've tested this manually and reviewed with Claude locally. LGTM 👍
…c/studio into remove-cli-auto-installed-flag
|
Thanks for tweaking that @fredrikekelund . I've merged trunk to the branch and solved the conflict. |
Related issues
How AI was used in this PR
Developed with Claude Code assistance.
Proposed Changes
Now that
cliUserUninstalledexists as an explicit signal,cliAutoInstalledno longer serves an ongoing purpose. Its original role — preventing re-installation after first launch — is fully handled bycliUserUninstalled(absent = not uninstalled).The only remaining use is a one-time migration: on first launch of the new version,
cliAutoInstalled: true+ absent symlink/directory is treated as a deliberate uninstall and setscliUserUninstalled: true. After that migration runs once per user,cliAutoInstalledis never meaningfully consulted again.This PR stops writing
cliAutoInstalledon new installs and marks it@deprecatedin the storage type. The migration block still reads it, so existing users who uninstalled before #3713 shipped are correctly preserved. The flag and migration block can be removed entirely in a follow-up release.On Windows, this also fixes
updateWindowsCliVersionedPathIfNeeded()to run on every launch where the CLI is installed (not only whencliAutoInstalledwas set), keeping the proxy.batpath up to date after app updates.Testing Instructions
cliAutoInstalled: true+ symlink absent inapp.json→cliUserUninstalledshould be set totrue, CLI not reinstalledcliAutoInstalled: true+ symlink present but stale → symlink re-pointed to current appcliAutoInstalledis NOT writtenPre-merge Checklist