(hopefully) fixes some parts of the updater again#1867
Conversation
…nd Mac quit flow issues
fix(updater): resolve legacy cache pathing, Windows silent startup, a…
⏳ Approval required for deploying to Cloudflare Workers (Preview) for stage-web.
Hey, maintainers, kindly take some time to review and approve this deployment when you are available. Thank you! 🙏 |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates Stage Tamagotchi’s Electron app shutdown flow and installer behavior, and adjusts legacy cache path resolution to be platform-appropriate.
Changes:
- Implement platform-specific legacy cache root paths (Windows/macOS/Linux).
- Change normal shutdown to use
app.quit()while keeping abnormal shutdown asapp.exit(1), and add a recursion guard inbefore-quit. - Configure NSIS installer to allow “run after finish”.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/stage-tamagotchi/src/main/services/electron/auto-updater.ts | Reworks legacy cache directory selection by platform/env vars. |
| apps/stage-tamagotchi/src/main/index.ts | Adjusts exit strategy and before-quit handling to avoid re-entrancy. |
| apps/stage-tamagotchi/electron-builder.config.ts | Enables running the app after installation completes. |
| switch (process.platform) { | ||
| case 'win32': | ||
| return process.env.LOCALAPPDATA || join(process.env.USERPROFILE || '', 'AppData', 'Local') | ||
| case 'darwin': | ||
| return join(process.env.HOME || '', 'Library', 'Caches') | ||
| default: | ||
| return process.env.XDG_CACHE_HOME || join(process.env.HOME || '', '.cache') | ||
| } |
| app.on('before-quit', (event) => { | ||
| if (appExiting) | ||
| return | ||
|
|
||
| event.preventDefault() | ||
| handleAppExit() | ||
| }) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5a027dc9e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| case 'darwin': | ||
| return join(process.env.HOME || '', 'Library', 'Caches') | ||
| default: | ||
| return process.env.XDG_CACHE_HOME || join(process.env.HOME || '', '.cache') |
There was a problem hiding this comment.
Use absolute fallback paths for legacy cache root
When the expected environment variables are missing, this fallback builds relative paths (for example join('', '.cache') or join('', 'Library', 'Caches')). cleanupStaleUpdateFiles() later calls rm(..., { recursive: true, force: true }) on the derived updater cache directory, so in those environments it can delete a directory relative to the current working directory instead of the user cache location, and it will also miss the actual legacy cache directory. Use an absolute fallback such as app.getPath('home')/os.homedir() before appending cache segments.
Useful? React with 👍 / 👎.
Description
This PR resolves several critical issues across different platforms relating to our auto-updater and launcher behavior:
app.exit(0)call inindex.tstoapp.quit(). This allows Electron'sbefore-quithooks to execute properly, enablingelectron-updaterto safely swap the binary payload and finish the installation instead of doing nothing when "Install" is clicked.runAfterFinish: trueto the NSIS configuration inelectron-builder.config.ts. This ensures the application automatically launches after a silent background update completes.getLegacyCacheRoot()(auto-updater.ts) to fix pathing errors and ensure backwards compatibility for older cache layouts during cleanup.Linked Issues
#1626
Additional Context
I have a 2012 macbook pro with OCLP now and I can test release versions of airi but its too weak to build the versions on my device so i cant test at the moment on the mac.