Repository navigation
fix(main): make desktop update state reporting honest - #483
Merged
Merged
Conversation
Contributor
Greptile SummaryThe PR introduces a unified desktop updater state model and keeps renderer state synchronized with the main process.
Confidence Score: 5/5The PR appears safe to merge with no blocking updater-state failure remaining. No blocking failure remains; the previously actionable install-ready update check is now disabled while the staged update awaits restart.
|
| Filename | Overview |
|---|---|
| frontend/src/app/(dashboard)/settings/page.tsx | Updates the Settings UI for the expanded updater states and correctly disables checks when installation is ready. |
| frontend/src/hooks/useUpdateStatus.ts | Synchronizes persisted and live updater state while preventing a stale initial response from replacing a newer event. |
| main/index.ts | Centralizes updater transitions, guards concurrent and install-ready checks, and persists honest updater state for IPC. |
| main/update-state.ts | Defines and classifies updater states, failures, runtime artifact modes, and IPC payloads. |
| scripts/mark-unpacked-artifact.cjs | Marks unpacked packaging output so runtime updater behavior can distinguish it from installed artifacts. |
| tests/update-state.test.ts | Adds focused coverage for updater classification, synchronization, serialization, and artifact-boundary behavior. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Desktop updater state] --> B{Current status}
B -->|checking / available / downloading| C[Disable update check]
B -->|ready-to-install| D[Disable update check and offer restart]
B -->|store-managed / linux-managed| E[Hide in-app update controls]
B -->|failure / offline| F[Show localized status and details]
B -->|idle / completed check| G[Allow update check]
Reviews (5): Last reviewed commit: "no-mistakes(review): Mark unpacked build..." | Re-trigger Greptile
khaira777
force-pushed
the
fm/flocafe-467-update-state-model
branch
from
August 23, 2026 17:04
9b9b88b to
fa783a9
Compare
This was referenced Aug 23, 2026
khaira777
force-pushed
the
fm/flocafe-467-update-state-model
branch
from
August 23, 2026 18:54
ab56649 to
bd42de9
Compare
…as up-to-date Implements the app-side update state model for #467 (epic #463): - Add main/update-state.ts: pure, unit-tested state machine with a persisted status enum (not-checked-yet | checking | up-to-date | available | downloading | ready-to-install | check-failed | offline | store-managed | linux-managed | dev-mode), error classification by electron-updater error code and phase, one-shot seeding helpers, and the IPC derivation function. - main/index.ts: replace the substring mask that rendered 404/Cannot find latest/ENOENT errors as up-to-date; channel-file-not-found and 404-class errors now map to check-failed (manifest-missing), network codes to offline, and download-phase failures to check-failed (download-failed). Classifications are logged at info level and an error path can never emit up-to-date. All transitions (including linux-managed/store-managed/dev-mode seeds) go through one stored state so renderer reloads recover it via get-update-status; store builds seed store-managed at startup instead of skipping silently. - Renderer: extend the UpdateStatus.status union in electron.d.ts, thread reason/error through useUpdateStatus (plus an isElectron flag), and rework the Settings updates tab to render honest per-state panels with friendly failure copy and raw details behind a disclosure. Update controls are hidden entirely outside the desktop app instead of showing a dead Check button. New i18n keys added to en/es/pt/fa. Tests: tests/update-state.test.ts covers every error class -> state mapping, the full IPC derivation table, and one-shot seeding; wired into npm test as test:update-state. Discovered but not implemented here (out of scope): Restart-Now confirmation dialog before quitAndInstall (code-scout F5).
…d missing-file matches
khaira777
force-pushed
the
fm/flocafe-467-update-state-model
branch
from
August 23, 2026 19:03
bd42de9 to
7c411f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Follow-up correction for Greptile review on FloCafe PR #483 (issue #467, no merge): in frontend/src/app/(dashboard)/settings/page.tsx, disable the Check for Updates action when status is ready-to-install because the main process intentionally ignores checks while a staged update awaits installation; use the reviewer-suggested disabled condition, preserving the existing checking/available/downloading guards. Keep the ready-to-install/restart flow honest and do not add a Restart-Now confirmation dialog. Preserve all prior #467 requirements and pipeline fixes. Commit and push this correction to the existing PR, rerun required validation, and resolve the Greptile review thread. Do not merge.
What Changed
Risk Assessment
✅ Low: The reviewed updater state transitions, artifact classification, renderer synchronization, UI guards, translations, and accepted #467 requirements are consistent with no substantiated source defect.
Testing
Update-state tests passed and the desktop frontend build compiled successfully. Browser UI evidence could not be captured because no browser connection was available; transient dependencies/build output were removed afterward. Linters and the full suite were not run per phase constraints.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (7) ✅
main/index.ts:176- The serialization guard only blocks checks afterupdaterPhasebecomesdownload. A second check can still start through the Help menu while the first ischecking; its laterchecking-for-updateevent can reset the shared phase tocheckafter the first emitsupdate-available, causing a subsequent download error to be classified ascheck-failed/unknowninstead ofcheck-failed/download-failed. Guard whilestoredUpdateStatus.status === 'checking'or use an in-flight attempt token.🔧 Fix: Guard overlapping updater checks during active operations
1 warning still open:
main/update-state.ts:131- The check-phase matcher treats any error text containingapp-update.ymlascheck-failed/manifest-missing. A packaged build whose existing config is unreadable can produceEACCES ... app-update.yml, which is then shown as “No update package was found” instead of an unknown/configuration failure. Restrict this branch to missing-file/config-specific signatures or inspect the structured error while preserving true 404/channel-file mappings.🔧 Fix: Restrict updater config errors to evidence-backed missing-file matches
1 error still open:
main/index.ts:203- A packaged non-store build whoseresources/app-update.ymlis missing is classified asdev-modeand returns beforeclassifyUpdateErrorruns. That can hide a broken NSIS/ZIP/AppImage artifact as an expected development install and silently disable update checks. Distinguish explicitly unpacked/dev artifacts from packaged builds, or let packaged missing-config errors becomecheck-failed/manifest-missing.🔧 Fix: Surface packaged updater config failures honestly
2 issues (1 error, 1 warning) still open:
main/index.ts:203- The packaged-versus-unpacked decision still relies onisDev(NODE_ENV === 'development' || !app.isPackaged) at the changed branch around line 203, rather than an explicit artifact classifier. The repository’selectron-builder --dirworkflow produces an unpacked directory while Electron can still reportapp.isPackaged === true; with noNODE_ENV=developmentand noapp-update.yml, this path reachesmissingUpdateConfigState(false, ...)and reportscheck-failed/manifest-missinginstead ofdev-mode. Conversely, a packaged non-store executable launched withNODE_ENV=developmenttakes the dev-mode branch and suppresses updater checks. This contradicts the required criterion: “Preserve dev-mode only for explicitly unpacked/development artifacts. For packaged non-store builds, a missing resources/app-update.yml must be classified as the honest check-failed/manifest-missing state.” Use an explicit runtime artifact classification and cover the actual packaged/unpacked boundary.main/index.ts:201-!fs.existsSync(configPath)conflates an absent config with any stat failure. If a packaged build’s resources directory is unreadable (EACCES) or has another I/O error,existsSyncreturns false and line 213 reportsmanifest-missingbeforeautoUpdatercan surface the structured unreadable-config error thatclassifyUpdateErrorcorrectly maps tocheck-failed/unknown. DistinguishENOENTfrom other filesystem errors (or let the updater classify them) so unreadable/configuration failures retain an honest generic failure reason.🔧 Fix: Preserve structured updater configuration probe failures
1 error still open:
main/index.ts:218-isDevstill controls the missing-config branch. With a packaged non-store build launched underNODE_ENV=development, a missingapp-update.ymlis silently reported asdev-modeinstead ofcheck-failed/manifest-missing; unpackedelectron-builder --dirartifacts can likewise be misclassified based onapp.isPackaged. Use an explicit runtime artifact classifier so only genuinely unpacked/development artifacts usedev-mode.🔧 Fix: Classify updater mode by runtime artifact
2 issues (1 error, 1 warning) still open:
main/update-state.ts:41- The path heuristic treats any packaged executable under a directory namedmac,win-unpacked, orlinux-unpackedas development/unpacked. For example, a real packaged app at/tmp/mac/Flo Cafe.app/...returns true, somain/index.ts:224-227reportsdev-modeand skips config probing. This contradicts the required criterion that a packaged non-store build with missingapp-update.ymlmust becheck-failed/manifest-missing, even under development-like paths. Detect the actual unpacked artifact boundary rather than arbitrary parent-directory names.frontend/src/hooks/useUpdateStatus.ts:32- The initial IPC seed can overwrite a newer live event: ifgetUpdateStatus()readsdownloading, thenupdate-downloadedarrives and the listener setsready-to-install, the stale IPC response later sets the renderer back todownloading, hiding the restart action until another updater event. Guard the seed against any live event received after subscription, or add a monotonic status revision.🔧 Fix: Harden artifact classification and stale update seeding
1 error still open:
main/update-state.ts:40- The classifier still cannot distinguish this repository’selectron-builder --diroutput from an installed package. That artifact can run withapp.isPackaged === trueandprocess.defaultApp === false, so line 40 returns false;checkForUpdates()then maps missingresources/app-update.ymlat line 245 tocheck-failed/manifest-missinginstead of the approved dev/unpacked behavior. Use an explicit artifact marker or supported launch-boundary signal without directory-name heuristics, and cover both artifact types behaviorally.🔧 Fix: Mark unpacked builds without path heuristics
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npm ci --ignore-scriptsnpm run test:update-statecd frontend && npm ci --ignore-scriptsNEXT_BUILD_MODE=desktop npm run buildChrome connection check; no browser was available✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.