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.
miravoss26
left a comment
There was a problem hiding this comment.
Clean and well-scoped. New components.Bundle (read from FTW_BUNDLE / FTW_BUNDLE_VERSION); /api/components emits bundle only when set and native installs omit the key; Settings → System collapses to one "FTW bundled" row for the Home Assistant add-on, with a note that HA owns updates and rollback.
Correctness: bundleDisplay returns null for native and for non-HA bundle kinds, so the existing per-component view is untouched; the new note + version render through escHtml. Good coverage on both sides (Go: env parsing, /api/components with and without a bundle; JS: bundleDisplay native vs bundled). Full stack CI green.
Security: no secrets, no new dependencies, no network calls, no authz change. It reads two env vars, nothing more.
Safe to merge from my read. ftw isn't in my merge allowlist, so it's yours to land (mergeable currently shows UNKNOWN, so it may want a rebase on main first).
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