-
-
Notifications
You must be signed in to change notification settings - Fork 20
Use store for uninstalled addons and remove deprecated fields #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Use store for uninstalled addons and remove deprecated fields #176
Conversation
WalkthroughRefactors addon info retrieval to choose between installed and store endpoints, introduces per-addon info caching and a new Changes
Sequence DiagramsequenceDiagram
participant Caller
participant Addons as bashio::addons()
participant Supervisor as Supervisor API
participant Cache as Cache (addons.{slug}.info)
Caller->>Addons: bashio::addons(slug)
Addons->>Addons: determine installed & info_source
alt installed
Addons->>Supervisor: GET /addons/{slug}/info
else not installed
Addons->>Supervisor: GET /store/{slug}/info
end
Supervisor-->>Addons: addon info
Addons->>Cache: store addons.{slug}.info
Addons-->>Caller: return addon info
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-09-27T21:45:12.814ZApplied to files:
🧬 Code graph analysis (1)lib/addons.sh (4)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/addons.sh(3 hunks)lib/supervisor.sh(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
lib/addons.sh (5)
lib/cache.sh (3)
bashio::cache.exists(16-26)bashio::cache.get(34-45)bashio::cache.set(54-71)lib/api.sh (1)
bashio::api.supervisor(20-108)lib/log.sh (2)
bashio::log.error(198-203)bashio::log.trace(137-140)lib/var.sh (1)
bashio::var.false(34-44)lib/jq.sh (1)
bashio::jq(17-28)
lib/supervisor.sh (2)
lib/addons.sh (2)
bashio::addons.installed(226-242)bashio::addons.repositories(247-250)lib/log.sh (1)
bashio::log.trace(137-140)
🔇 Additional comments (2)
lib/supervisor.sh (1)
284-295: Refactoring approved; verification pending on callee.The delegation to
bashio::addons.installed()andbashio::addons.repositories()is correct. However, the implementation ofbashio::addons.repositories()in lib/addons.sh contains a critical bug (see lib/addons.sh review). Ensure that issue is fixed before merging.lib/addons.sh (1)
187-205: Verify API response structure for installation status detection.Line 191 assumes that
/store/inforeturns JSON with structure.addons[] | select(.slug == "...") | .installed. This is the foundation for detecting whether an addon is installed vs. available-only (line 192-196). Confirm that the Supervisor API/store/infoendpoint actually provides this structure and that.installedcorrectly differentiates installed from non-installed addons.You can verify this by:
- Checking the Supervisor API documentation or source code (see home-assistant/supervisor#6226 referenced in PR objectives).
- Confirming that the
/store/inforesponse includes an.addons[]array with.installedfield present for all addons.- Testing the logic locally to ensure uninstalled addons correctly resolve to the
/store/${slug}/infoendpoint and installed ones to/addons/${slug}/info.
Proposed Changes
Supervisor is removing several long-deprecated fields from its API including:
wait_boot- fromsupervisor/infoandsupervisor/optionsaddons- fromsupervisor/infoaddons_repositories- fromsupervisor/infoandsupervisor/optionswait_bootis simply being removed as it is no longer necessary. Addons can now add healthchecks and Supervisor will wait until they are marked as healthy before considering them started. Adding a fixed delay at startup to try and guess when all your addons will be ready is inefficient and unnecessary now.For the other two, all info on installed addons is available at
/addonsand info on all addons (installed or uninstalled) is available at/store. I refactored the corebashio::addonsin light of this to use/storeas its core cache and then get info for individual addons from either/addons/{slug}/infoor/store/{slug}/infodepending on whether it was installed or not.After that I added the missing
bashio::addons.repositoriesand directedbashio::supervisor.addonstobashio::addons.installedandbashio::supervisor.addons_repositoriestobashio::addons.repositories. This way the only breaking change is the removal ofbashio::supervisor.wait_bootand I believe everything else should keep working. I didn't see anywhere that bashio was adding or removing repositories so I didn't add the replacement for that (POST or DELETE to/store/repositoriesfor reference, adds/removes a single repository).I'm not sure what the deprecation policy is here. For
bashio::supervisor.addonsandbashio::supervisor.addons_repositorieswould you like me to add deprecation logging, remove them immediately as a breaking change or leave them as is silently redirecting?Related Issues
Summary by CodeRabbit
New Features
Improvements
Chores