Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds a new Bashio backups library that implements Supervisor-backed backup management (list, query, create, delete, restore, freeze/thaw, caching, jq filtering, metadata accessors) and sources it into the main Changes
Sequence DiagramsequenceDiagram
actor Script as Bash Script
participant Bashio as Bashio Library
participant Cache as Local Cache
participant Supervisor as Supervisor API
participant Jq as jq Filter
Script->>Bashio: call bashio::backups* / bashio::backup.*
alt Cache hit
Bashio->>Cache: check cached backup info
Cache-->>Bashio: return cached JSON
else Cache miss or state-changing op
Bashio->>Supervisor: GET/POST /backups... endpoints
Supervisor-->>Bashio: return JSON response
Bashio->>Cache: store or flush cache
end
alt jq filter provided
Bashio->>Jq: apply jq filter
Jq-->>Bashio: filtered output or error
end
Bashio-->>Script: return JSON or string result
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@lib/backups.sh`:
- Around line 37-42: The docstring for the "Returns or sets the number of days
until a backup is considered stale." block incorrectly references parameter $2;
update the comment to reference $1 (the first and only argument) so the
docstring matches the implementation that reads the argument into
days_until_stale; specifically change the "$2 Set days_until_stale (Optional)"
line to "$1 Set days_until_stale (Optional)" in the docs for this block.
- Around line 376-382: In bashio::backup.restore_partial() the API path is
wrong; replace the POST call to "/backups/${slug}/partial/full" with the correct
Supervisor endpoint "/backups/${slug}/restore/partial" (keep using
bashio::api.supervisor POST with the same "${options}" argument) so the function
calls the same restore pattern as restore_full; leave the
bashio::cache.flush_all call as-is.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@lib/backups.sh`:
- Around line 37-58: The getter in bashio::backups.days_until_stale calls
bashio::backups with the cache key "backups.days_until_stale", which caches the
filtered result contrary to the intent; update the call inside
bashio::backups.days_until_stale (the branch where no argument is passed) to
pass false as the cache key (i.e., replace the second argument
"backups.days_until_stale" with false) so that when slug="false" the filtered
result is not cached.
- Around line 306-313: The function bashio::backup.homeassistant currently
passes a cache key ("backups.${slug}.homeassistant") when calling
bashio::backups which contradicts the "do not cache backups.info" rule; update
the call in bashio::backup.homeassistant to pass false as the cache key (i.e.,
call bashio::backups with false for the cache key parameter) so the filtered
content.homeassistant from /backups/info is not cached; locate the call inside
function bashio::backup.homeassistant and replace the cache key argument while
keeping the rest of the arguments (the query ".backups[] | select(.slug ==
\"${slug}\") | .content.homeassistant") unchanged.
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions. |
|
not stale |
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions. |
|
not stale |
There was a problem hiding this comment.
Pull request overview
Adds a new Bashio module that wraps the Home Assistant Supervisor Backups endpoints, making it possible for add-ons to inspect, create, delete, and restore backups via the existing bashio::api.supervisor helper.
Changes:
- Source a new
lib/backups.shmodule from the mainlib/bashio.shentrypoint. - Introduce
bashio::backups*andbashio::backup.*functions for backup listing/info access, freeze/thaw, create, delete, and restore operations. - Implement caching for per-backup info (
/backups/${slug}/info) while intentionally not caching the full list payload (/backups/info).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/bashio.sh | Sources the new backups module so its functions are available to add-ons. |
| lib/backups.sh | New module implementing Supervisor Backups API wrappers, with selective caching and helper accessors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Now it's ready for human review again. |
Proposed Changes
Implements the API as https://developers.home-assistant.io/docs/api/supervisor/endpoints/#backup
It caches only the individual backup data (from /backups/${slug}/info), but not the list (/backups/info).
Not implemented: upload(), download()
Related Issues
Summary by CodeRabbit