feat: show one bundled FTW version when packaged as the Home Assistant add-on - #701
feat: show one bundled FTW version when packaged as the Home Assistant add-on#701HuggeK wants to merge 1 commit into
Conversation
…t add-on When FTW_BUNDLE=home_assistant_addon is set by the bundle image, /api/components reports the packaging and Settings -> System shows the single bundled FTW version instead of the per-container Core/Optimizer breakdown with update and rollback buttons that Supervisor-owned installs cannot use. Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
frahlg
left a comment
There was a problem hiding this comment.
Read the whole diff. Clean and well-scoped, and it keeps the part that matters: the degraded-optimizer warning still renders in the bundled branch even though the Optimizer row is gone. Collapsing the row without keeping the warning would have hidden a real fault behind a packaging decision, and it does not.
Checked and liked:
bundleDisplay()is pure, exported through_pure, and covered on both sides — native install returnsnull, and an unrecognisedbundle.kindalso returnsnull, so a future bundle kind cannot silently collapse the UI.BundleFromEnv()returnsnilfor an unsetFTW_BUNDLEeven whenFTW_BUNDLE_VERSIONis set, which is the right precedence and is pinned by a test./api/componentsomitsbundleentirely for native installs rather than emitting an empty object, and there is a test asserting the key is absent.
One small thing, not blocking: bundleDisplay gates on the literal "home_assistant_addon" while the Bundle type is generic over Kind. That is the conservative choice today, but the next bundle kind will need this branch touched as well as the packaging. Worth a comment at the gate saying so, so the next person does not assume the UI is already generic.
@erikarenhill owns web/, so web/settings/tabs/system.js is his call. The Go side reads correctly to me.
What
When Core runs inside a single-image bundle that sets
FTW_BUNDLE=home_assistant_addon(the Home Assistant add-on), Settings → System now shows one bundled FTW version row instead of the per-container Core/Optimizer breakdown, and the Optimizer Update/Rollback buttons are not rendered there. Native installs are unchanged.go/internal/components/bundle.go: newBundletype +BundleFromEnv()readingFTW_BUNDLE/FTW_BUNDLE_VERSION./api/componentsincludes abundleobject when set; omitted for native installs.web/settings/tabs/system.js: new purebundleDisplay()helper picks the collapsed view; drivers row, optimizer fallback warning, and the component-action status line stay.Why
In the Home Assistant add-on, Core and the Optimizer ship in one image whose updates and rollback belong to Supervisor (
srcfl/home-assistant-addons, self-update disabled). A per-container version breakdown with update buttons misleads there: nothing updates independently, and the operator's real question is "which FTW version is this add-on running?"Behaviour details and safety notes
if (btn)guards already tolerate the buttons being absent from the DOM.bundle.version(the add-on version) is optional; the FTW version shown is Core's compiled-in version.FTW_BUNDLEkinds keep the native view, so nothing changes until a packaging opts in.Testing
go test ./internal/components/ ./internal/api/— new tests:TestBundleFromEnv*,TestComponentsReportsBundlePackaging,TestComponentsOmitsBundleForNativeInstalls(pre-existing failures ininternal/apion Windows — backup lifecycle + myUplink OAuth — fail identically on the untouched base).node --test web/settings/tabs/system.test.mjs— 6/6 pass, including three newbundleDisplaycases.node --test web/javascript-syntax.test.mjs— pass.gofmt/go vetclean for the touched packages (two pre-existing gofmt offsides inapi.go/api_components.goleft as-is to keep the diff small).Companion add-on change: HuggeK/home-assistant-addons sets
FTW_BUNDLE/FTW_BUNDLE_VERSIONin the add-on image; it is a no-op until an FTW release containing this PR is pinned there.🤖 Generated with Claude Code