Skip to content

Harden argument handling for addon.update() .documentation() and .changelog()#201

Open
lmagyar wants to merge 2 commits intohassio-addons:mainfrom
lmagyar:pr-harden-addons
Open

Harden argument handling for addon.update() .documentation() and .changelog()#201
lmagyar wants to merge 2 commits intohassio-addons:mainfrom
lmagyar:pr-harden-addons

Conversation

@lmagyar
Copy link
Copy Markdown
Contributor

@lmagyar lmagyar commented Apr 12, 2026

Proposed Changes

Based on Copilot's reviews (#187 (review)) to handle when callers pass self. It makes sense to implement.

Related Issues

Summary by CodeRabbit

  • Refactor
    • Improved handling of self-referential addon operations (update, documentation, changelog). The literal "self" is now resolved at call time to the current add-on, ensuring requests target the intended add-on consistently across contexts.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e2cfd2fe-4cc0-41a8-a37a-68acec7bce26

📥 Commits

Reviewing files that changed from the base of the PR and between 50badb3 and ba3fe94.

📒 Files selected for processing (1)
  • lib/addons.sh
✅ Files skipped from review due to trivial changes (1)
  • lib/addons.sh

Walkthrough

Updated three addon helper functions to default their slug parameter to the literal 'self' and resolve 'self' at call time to the current add-on slug via bashio::addon.slug; provided slugs remain unchanged.

Changes

Cohort / File(s) Summary
Addon slug resolution logic
lib/addons.sh
Defaulted slug parameter to 'self' for bashio::addon.update(), bashio::addon.documentation(), and bashio::addon.changelog() and added conditional logic to resolve 'self' to bashio::addon.slug at call time.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

bugfix

Suggested reviewers

  • frenck

Poem

🐇 I nibble code beneath the moon,
A tiny hop, a small fix soon,
'self' now points where it belongs,
Update, docs, changelog—three songs,
I twitch my nose and hum a tune.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: hardening argument handling for three specific addon methods (update, documentation, and changelog) by implementing logic to handle the 'self' slug parameter.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lib/addons.sh`:
- Line 102: Calls to the Bash function bashio::var.equals are using invalid
parentheses syntax (e.g., bashio::var.equals()) which breaks parsing; locate
each invocation of bashio::var.equals (the occurrences checking "${slug}"
against 'self' and the other two similar checks) and remove the trailing
parentheses so they are called as bashio::var.equals "${slug}" 'self' (and
similarly for the other two calls), preserving spacing/quoting and any
surrounding conditional structure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e1061338-858a-44a9-9c87-00be9e0decbf

📥 Commits

Reviewing files that changed from the base of the PR and between 494439e and 50badb3.

📒 Files selected for processing (1)
  • lib/addons.sh

Comment thread lib/addons.sh Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lmagyar
Copy link
Copy Markdown
Contributor Author

lmagyar commented Apr 13, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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