Repository navigation
fix(update): decide from how the app was installed, not from one file's existence - #575
Merged
Merged
Conversation
…'s existence Closes #354, #571. The check was `Path::new("/usr/bin/rpm-ostree").exists()`, which answers a narrower question than the one being asked and gets the important case backwards. Inside a Flatpak sandbox the host's /usr is not visible. A Flatpak on Silverblue therefore sees no rpm-ostree binary, reports itself as an ordinary install, and is offered an auto-update its runtime will not let it apply. The opposite mistake is available too: plenty of ordinary Fedora systems have the rpm-ostree binary installed without being OSTree-booted, and were told to use a manual command they do not need. get_platform_info replaces it, returning how the app was installed and on what architecture: Flatpak /.flatpak-info, or FLATPAK_ID Snap SNAP AppImage APPIMAGE RpmOstree /run/ostree-booted — whether the host booted from an OSTree, rather than whether a binary happens to be present Standard none of the above Sandboxes are tested first and deliberately: inside one, the host's markers are either invisible or not ours to act on. Only Standard and AppImage may update themselves. Flatpak, Snap and OSTree all have a runtime that owns the installed files, and each now gets its own command and a sentence saying why the app is not doing it. The rpm-ostree URL uses the running architecture — an aarch64 machine was handed an x86_64 download. A detection failure means "do not offer to update", which is the safe direction: an update the app cannot apply is worse than one it does not offer. The decision is a pure function over a probe trait, so each packaging is tested without arranging the real thing — I cannot produce a Flatpak sandbox or an OSTree host here, and would rather say so than imply the detection has been exercised in the wild. What is verified is that the rules are the ones intended, including the Flatpak-on-OSTree case that motivated this. Seven Rust tests, six on the channel policy. The status bar's diagnostic blob now reports the install type rather than a yes/no for rpm-ostree. Also: the Path import was Linux-only, because the old check was. The probe reads paths on every target, so it is unconditional now — left as it was, this would have compiled here and failed on the macOS and Windows release builds. Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Closes #354, #571. Fourth of the update-system work.
The check got the important case backwards
Inside a Flatpak sandbox the host's
/usris not visible. So a Flatpak on Silverblue sees no rpm-ostree binary, reports itself as an ordinary install, and is offered an auto-update its runtime will not let it apply.The opposite mistake was available too: plenty of ordinary Fedora systems have the rpm-ostree binary installed without being OSTree-booted, and were sent to a manual command they don't need.
What replaces it
get_platform_inforeturns how the app was installed and on what architecture:/.flatpak-info, orFLATPAK_IDSNAPAPPIMAGE/run/ostree-booted— whether the host booted from an OSTree, not whether a binary happens to existSandboxes are tested first, deliberately — inside one, the host's markers are either invisible or not ours to act on. That ordering is what makes the Flatpak-on-Silverblue case come out right.
Only
StandardandAppImagemay self-update. Flatpak, Snap and OSTree each have a runtime that owns the installed files, and each now gets its own command plus a sentence saying why the app isn't doing it itself. The rpm-ostree URL uses the running architecture — an aarch64 machine was previously handed an x86_64 download (#571).A detection failure means "don't offer to update". That's the safe direction: an update the app can't apply is worse than one it doesn't offer.
On verification
The decision is a pure function over a probe trait, so each packaging is tested without arranging the real thing. I can't produce a Flatpak sandbox or an OSTree host here, and I'd rather say that than imply the detection has been exercised in the wild. What's verified is that the rules are the ones intended — including the Flatpak-on-OSTree case that motivated this.
One thing that would have failed at release time
The
Pathimport was#[cfg(target_os = "linux")], because the old check was Linux-only. The new probe reads paths on every target, so it's unconditional now. Left as it was, this compiles here and on theLint (Rust)job — and breaks the macOS and Windows release builds, which nothing exercises until a tag is pushed.Seven Rust tests, six on the channel policy. 1837 unit + 303 browser; clippy/tsc/dprint/eslint clean.
Left in this area
#353 (no preview of what's being installed) is the last one, plus #355 which is mislabelled into this area — it's about the formatter settings dialog, not updates.
🤖 Generated with Claude Code