Skip to content

Conversation

@mdegat01
Copy link

@mdegat01 mdegat01 commented Oct 16, 2025

Proposed Changes

Supervisor is removing several long-deprecated fields from its API including:

  • wait_boot - from supervisor/info and supervisor/options
  • addons - from supervisor/info
  • addons_repositories - from supervisor/info and supervisor/options

wait_boot is 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 /addons and info on all addons (installed or uninstalled) is available at /store. I refactored the core bashio::addons in light of this to use /store as its core cache and then get info for individual addons from either /addons/{slug}/info or /store/{slug}/info depending on whether it was installed or not.

After that I added the missing bashio::addons.repositories and directed bashio::supervisor.addons to bashio::addons.installed and bashio::supervisor.addons_repositories to bashio::addons.repositories. This way the only breaking change is the removal of bashio::supervisor.wait_boot and 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/repositories for reference, adds/removes a single repository).

I'm not sure what the deprecation policy is here. For bashio::supervisor.addons and bashio::supervisor.addons_repositories would you like me to add deprecation logging, remove them immediately as a breaking change or leave them as is silently redirecting?

Related Issues

home-assistant/supervisor#6226

Summary by CodeRabbit

  • New Features

    • Added repository retrieval capability for addon management.
  • Improvements

    • Enhanced addon data fetching with improved caching for both installed and store addons.
    • Streamlined addon data source handling and retrieval paths.
  • Chores

    • Removed obsolete boot-wait functionality.

@coderabbitai
Copy link

coderabbitai bot commented Oct 16, 2025

Walkthrough

Refactors addon info retrieval to choose between installed and store endpoints, introduces per-addon info caching and a new bashio::addons.repositories() function, and updates supervisor helper functions to delegate to the refactored addon functions; also removes wait_boot().

Changes

Cohort / File(s) Summary
Addon info retrieval refactoring
lib/addons.sh
Reworks bashio::addons() to determine installed vs store info_source, fetch from /addons/${slug}/info or /store/${slug}/info, cache per-addon under addons.${slug}.info, add locals installed and info_source, and add public bashio::addons.repositories().
Supervisor function consolidation
lib/supervisor.sh
Removes wait_boot(); updates bashio::supervisor.addons() to use bashio::addons.installed and bashio::supervisor.addons_repositories() to use bashio::addons.repositories() instead of direct supervisor API queries.

Sequence Diagram

sequenceDiagram
    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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

bugfix

Suggested reviewers

  • frenck

Poem

🐰 I hopped through code to find the source,
Installed or store — I set the course.
I cached each slug with tidy care,
Repos now call with proper flair.
Hooray for hops and cleaner air! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Use store for uninstalled addons and remove deprecated fields" accurately reflects the two primary objectives of this changeset. The first part aligns with the major refactoring in lib/addons.sh that implements fetching addon info from the store for uninstalled addons, while the second part captures the removal of the wait_boot function and the updates to supervisor-related addon functions in lib/supervisor.sh. The title is concise, specific, and avoids vague terminology, providing clear information about what a teammate scanning the history would encounter.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0570ac and e22a34f.

📒 Files selected for processing (1)
  • lib/addons.sh (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-27T21:45:12.814Z
Learnt from: PaulSD
PR: hassio-addons/bashio#175
File: lib/addons.sh:199-204
Timestamp: 2025-09-27T21:45:12.814Z
Learning: In the bashio::addons() function in lib/addons.sh, empty cache_key values are automatically converted to the string "false" by the parameter expansion ${2:-false} on line 154, so additional empty checks are unnecessary when guarding cache operations.

Applied to files:

  • lib/addons.sh
🧬 Code graph analysis (1)
lib/addons.sh (4)
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/var.sh (1)
  • bashio::var.false (34-44)
lib/jq.sh (1)
  • bashio::jq (17-28)
🔇 Additional comments (1)
lib/addons.sh (1)

176-205: Store.info caching strategy and addon endpoint selection logic looks good.

The refactor appropriately:

  • Caches store.info globally to avoid repeated API calls (lines 176–185)
  • Determines whether each queried addon is installed by checking its presence in the store (lines 191–196)
  • Selects the correct endpoint: /addons/{slug}/info for installed addons and /store/{slug}/info for uninstalled ones (line 198)
  • Caches per-addon info separately under addons.${slug}.info (line 203)

The fallback behavior when an addon is not found in the store (defaulting to /addons/{slug}/info) is reasonable, as it handles custom/user-installed addons. Error handling is consistent with the existing API call pattern.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between f788a0b and b0570ac.

📒 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() and bashio::addons.repositories() is correct. However, the implementation of bashio::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/info returns 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/info endpoint actually provides this structure and that .installed correctly differentiates installed from non-installed addons.

You can verify this by:

  1. Checking the Supervisor API documentation or source code (see home-assistant/supervisor#6226 referenced in PR objectives).
  2. Confirming that the /store/info response includes an .addons[] array with .installed field present for all addons.
  3. Testing the logic locally to ensure uninstalled addons correctly resolve to the /store/${slug}/info endpoint and installed ones to /addons/${slug}/info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant