Respect the selected channel when updating firmware - #75
Merged
Conversation
The confirm button was gated on the device-wide has_updates flag while the release panel was gated per channel, so picking a channel with no firmware left the button live and sent the device an update it had nothing to install. Gate both on the same per-channel lookup, and show a message where the release panel would be when the channel is empty. The local source stays exempt: it resolves the release from the Shelly firmware index rather than from what the device reported.
A channel the device advertises without naming a build installs nothing, but the dialog read the raw entry as truthy, so it offered a release with a blank version and left the confirm button live. Read every channel through one helper that requires a version, and use it for the release panel, the confirm button, the channel labels and the header badges so they cannot drift apart again. The empty-channel message now separates a channel with no update from a device with no updates at all, and stays hidden until the status has loaded rather than claiming there is nothing while the request is still in flight. Check for Update now refreshes the cached status it invalidates, so a channel that gained a release stops reading as empty. UpdateInfo now marks the device-reported fields optional, and the filtered summary shape gets its own type, since it renames desc to description and is not interchangeable.
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.
The confirm button in the device firmware dialog was gated on a device-wide "has updates" flag while the release panel beside it was gated per channel. On a device with a stable release and no beta, selecting Beta hid the panel but left the button live, and pressing it asked the device to install firmware that does not exist.
Both now read the same per-channel lookup, and that lookup requires the channel to name an actual build. A channel the device advertises without a version installs nothing, so it no longer counts as an update anywhere: not for the release panel, the confirm button, the channel labels, or the header badges.
When the selected channel has nothing to install, the dialog says so, and it distinguishes a channel with no update from a device with no updates at all. It stays quiet until the status has loaded rather than claiming there is nothing while the request is still in flight.
Check for Update now refreshes the cached status, so a channel that has just gained a release stops reading as empty.
Updating via the manager is unaffected. That path resolves the release from the Shelly firmware index rather than from what the device reported, and does its own check for already being current.
Verifying
There is no test setup in
packages/web, so this was driven by hand against a stubbed API, checking the confirm button, the release panel and the message for each case:Starting an update from a channel that has a release still sends that channel.
Worth knowing
The gate is advisory rather than enforced. The bulk dialog, the raw RPC console on the same page, the CLI and the API itself can all still ask a device for a channel it has nothing on.
What a device does with a beta request when it has no beta is still unconfirmed. It either refuses or accepts and does nothing. The dialog no longer offers the choice either way, but the answer belongs next to the note in
to_update_parameters.