feat: add non-blocking in-app update for patch-behind container installs - #124
Merged
Conversation
ContainerCompatibility.mismatch() deliberately ignores patch versions, so a daemon on the same major.minor as requiredVersion (e.g. 1.2.0 vs pinned 1.2.2) reads as fully compatible — no gate, no prompt, and no way in the app to reach the pinned patch. That left patch-gated capabilities (isAtLeast, e.g. running-container export from #107) silently unreachable with no signal why. Adds ContainerCompatibility.isPatchBehind and a "Update Container to v1.2.2…" affordance on the System page, distinct from DaemonGateView's hard version-mismatch gate. upgradeContainer still stops the daemon mid-flight, which would tear SystemView down before the update finishes, so the progress-tracking state (previously private to DaemonGateView) is lifted into a DaemonOperationCoordinator injected via .environment — the System page's button and DaemonGateView's own triggers now share it. Fixes #123
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.
Summary
ContainerCompatibility.mismatch()deliberately compares major.minor only —patch releases are ignored, since a patch bump upstream is additive/bugfix,
not an API break. That means a daemon on the same major.minor as
requiredVersion(e.g. installed1.2.0vs pinned1.2.2) reads as fullycompatible: no gate, no prompt, and — since
SystemView.swiftnever calledupgradeContainer/installContaineroutsideDaemonGateView's blockinggate — no way in the app to actually reach the pinned patch.
That left patch-gated capabilities (
ContainerCompatibility.isAtLeast, e.g.running-container export added in 1.2.1, #107) silently unreachable on an
otherwise-healthy install, with zero UI signal why. Discovered directly:
this machine's real daemon reports 1.2.0 against Berthly's 1.2.2 pin, and
nothing in the app said so.
Changes
ContainerCompatibility.isPatchBehind(installed:required:)— samemajor.minor as required (so
mismatchstill reads compatible) but behindthe exact pinned patch.
install, plus a new "Update Container to v1.2.2…" button (non-blocking —
the page stays reachable, unlike the hard version-mismatch gate).
upgradeContainerstill stops the daemon mid-flight, which would tearSystemViewdown before the update finishes. The progress-tracking statethat used to be private
@StateinsideDaemonGateViewis lifted into anew
DaemonOperationCoordinator(@Observable, injected via.environment), so bothDaemonGateView's own triggers (install/start/hard-mismatch-update) and the System page's new button share one place
that survives the daemon-restart teardown.
"Newer than Berthly supports") that were missing from
Localizable.xcstringseven before this change — the.tooOld/.tooNewcases existed in source but were apparently never extracted. Caught while
reusing that same
statusTextswitch.Test plan
swiftlint lint --strict— 0 violationsBerthlyTests(unit) — full suite passes, including newisPatchBehindcases (exact match, older patch same minor, newer patch,older minor, newer major)
BerthlyUITests(mock mode) —testNotInstalledGateInstallsAndConnectsand
testVersionMismatchGateUpdatesAndConnectspass unchanged (regressioncheck on the
DaemonGateViewrefactor), plus a newSystemViewTests.testPatchUpdateSurvivesDaemonRestartcovering the newbutton end-to-end in mock mode, including that the progress screen
survives the daemon-restart teardown
built and launched the app, confirmed the System page shows "Update
available" / Installed 1.2.0 / Required 1.2.2 / "Update Container to
v1.2.2…" — screenshot-verified. Did not click through the actual upgrade
(admin-elevated system change); that's for the user to trigger deliberately.
Fixes #123