fix: correct inverted label on manual_refresh_only config option - #2196
fix: correct inverted label on manual_refresh_only config option#2196pacso wants to merge 2 commits into
Conversation
The manual_refresh_only checkbox was labelled "Automatically refresh the sensor" — the exact inverse of the field's stored meaning. Ticking it actually DISABLES automatic refresh, and async_step_user defaults it to True, so new installs silently got no periodic updates (issue robbrad#2193). Relabel the field to match its semantics across strings.json and all translations (proper native translations for cy/ga/gd/pt), add a data_description helper, and note the questionable default=True in a code comment (left unchanged for the maintainer to decide separately). Field name, stored data, and __init__.py refresh logic are unchanged. Adds a dependency-free regression test guarding against re-inversion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2196 +/- ##
=======================================
Coverage 80.04% 80.04%
=======================================
Files 12 12
Lines 1393 1393
=======================================
Hits 1115 1115
Misses 278 278 ☔ View full report in Codecov by Harness. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughThe configuration UI now explains manual refresh behavior and references the manual refresh service across English and localized translations. Comments document the unchanged default, while regression tests validate JSON files, label wording, step alignment, and descriptions. ChangesManual refresh messaging
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@custom_components/uk_bin_collection/translations/cy.json`:
- Line 10: Add data_description.manual_refresh_only under both the user and
reconfigure_confirm steps in
custom_components/uk_bin_collection/translations/cy.json (lines 10 and 44),
ga.json (lines 10 and 45), gd.json (lines 10 and 45), and pt.json (lines 10 and
44), using the corresponding source/English descriptions. Update
custom_components/uk_bin_collection/tests/test_translations.py (lines 74-83) to
assert these description keys exist in every locale.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a5bffa0c-024f-41df-9010-9af89b4f7b0f
📒 Files selected for processing (8)
custom_components/uk_bin_collection/config_flow.pycustom_components/uk_bin_collection/strings.jsoncustom_components/uk_bin_collection/tests/test_translations.pycustom_components/uk_bin_collection/translations/cy.jsoncustom_components/uk_bin_collection/translations/en.jsoncustom_components/uk_bin_collection/translations/ga.jsoncustom_components/uk_bin_collection/translations/gd.jsoncustom_components/uk_bin_collection/translations/pt.json
Add data_description.manual_refresh_only to the user and reconfigure_confirm steps in cy/ga/gd/pt so no locale falls back to the English helper text, using native translations (consistent with the translated labels rather than copying English in). Extend test_translations.py to assert every locale carries the data_description key in each step that labels the field. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@robbrad - Whilst this is the simplest fix for the problem, it seems like a counter-intuitive fix. I will submit an alternative PR which inverts the use of the checkbox, such that ticking the box enables the polling interval, and unticking it sets it to manual refresh only. |
|
The other PR is definitely the right option. Closing this one. |
Summary
The
manual_refresh_onlyconfig field was labelled "Automatically refresh the sensor" — the exact inverse of what it does. Ticking the box actually disables automatic refresh, andasync_step_userdefaults the field toTrue, so new installs silently got no periodic updates while showing a ticked "Automatically refresh" checkbox. This is the likely root cause of the recurring "entities only update on restart" reports.Fixes #2193
What this does
The field's name, stored value, and semantics are unchanged — no config migration, no inversion in code. This PR only fixes the misleading UI text:
uk_bin_collection.manual_refreshservice)" in both theuserandreconfigure_confirmsteps.strings.jsonand all translation files.en.jsonuses the new English label;cy,ga,gd, andptget proper native translations (the literal service name is preserved).data_descriptionhelper explaining: ticked = no automatic refresh; unticked = refresh everyupdate_intervalhours.default=Trueinasync_step_useris questionable given the symptom reports — left unchanged here so it can be decided separately.What this deliberately does NOT change
__init__.pyrefresh logic.default=Truevalue.Tests
json+pathlibonly) regression testtests/test_translations.pythat loadsstrings.jsonand everytranslations/*.json, asserts no label is the old inverted string (or an un-negated "automatic" claim), and checksstrings.json/en.jsonstay in sync.test_async_setup_entry_manual_refresh_only_disables_polling(True →update_interval is None, False →timedelta(hours=12)) left in place and still passing.Note for reviewers
I'm confident in the Portuguese translation and reasonably confident in the Welsh/Irish/Scottish Gaelic ones, but a native-speaker review on those three would be welcome.
🤖 Generated with Claude Code
Summary by CodeRabbit
uk_bin_collection.manual_refreshservice.