Repository navigation
[tfluna] Recover from transient runtime reconfiguration failures - #20992
J. Nick Koston (bdraco) merged 3 commits into
Conversation
Keep setup failures permanent, but retry runtime configuration after a transient I2C failure. Add regression coverage and use one shared Application lifetime in combined host tests. Prepared with Claude Code; independently checked and integrated with Codex.
|
To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file: external_components:
- source: github://pr#20992
components: [tfluna]
refresh: 1h(Added by the PR bot) |
|
👋 Hi there! This PR modifies 2 file(s) with codeowners. Craig Andrews (@candrews) - As codeowner(s) of the affected files, your review would be appreciated! 🙏 Note: Automatic review request may have failed, but you're still welcome to review. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #20992 +/- ##
=======================================
Coverage 93.95% 93.95%
=======================================
Files 90 90
Lines 20465 20465
Branches 3176 3176
=======================================
Hits 19227 19227
Misses 947 947
Partials 291 291 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance
|
Memory Impact AnalysisComponents:
📊 Component Memory Breakdown
🔍 Symbol-Level Changes (click to expand)Changed Symbols
New Symbols (top 15)
Removed Symbols (top 15)
This analysis runs automatically when components change. Memory usage is measured from a representative test configuration. |
|
|
ESPHome Bot (esphbot)
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
There was a problem hiding this comment.
🔵 Needs a closer look
Shared Application lifetime changes affect all host suites, and reported suite failures lack a clean matching-base comparison.
No open issues 🎉
What changed in this PR
Improves TF-Luna recovery from transient runtime reconfiguration failures while preserving permanent setup failures.
Changes:
- Retries runtime configuration and retains warnings until a new measurement arrives.
- Adds 16 host tests covering recovery and failure handling.
- Centralizes shared
Applicationconstruction and updates affected test fixtures.
| File | Description |
|---|---|
| tests/components/xiaomi_body_scale/common.h | Removes fixture-local Application construction. |
| tests/components/tmp102/test_tmp102.cpp | Pairs Application destruction and reconstruction. |
| tests/components/tfluna/test_tfluna.cpp | Adds runtime recovery regression tests. |
| tests/components/snapshot/snapshot_test.cpp | Uses centrally constructed Application. |
| tests/components/pd_pioneer_ir/pd_pioneer_ir_tests.cpp | Removes duplicate Application construction. |
| tests/components/mistral_ir/mistral_ir_tests.cpp | Removes duplicate Application construction. |
| tests/components/main.cpp | Constructs Application before tests run. |
| tests/components/i2c/test_i2c_chip_id.cpp | Destroys Application before replacing it. |
| tests/components/haier_water_heater/water_heater/test_hon_controller.cpp | Removes local construction and unused include. |
| tests/components/filter_lifetime/test_filter_lifetime.cpp | Preserves Application lifetime between tests. |
| tests/components/emontx/common.h | Makes the legacy construction helper a no-op. |
| tests/components/display/test_test_card.cpp | Removes redundant fixture setup. |
| tests/components/daikin/daikin_tests.cpp | Removes local construction and unused include. |
| tests/components/daikin/daikin_regression_tests.cpp | Removes local construction and unused include. |
| esphome/components/tfluna/tfluna.h | Declares reconfiguration helpers and retry state. |
| esphome/components/tfluna/tfluna.cpp | Separates setup failures from recoverable runtime failures. |
Review effort: Balanced
Please split this PR |
|
This pull request has merge conflicts. Please merge the latest dev branch into your branch to resolve them. |
Split done. Harness landed in #21001. Diff now three TF-Luna paths. |
PR Review — [tfluna] Recover from transient runtime reconfiguration failuresMergeable. Two non-blocking suggestions remain. The PR is now split as J. Nick Koston (@bdraco) asked: the shared
Suggestions:
✅ Resolved since last review (1)Previously-flagged issues verified fixed
Checklist
ℹ️ Triage summary2 pre-existing finding(s) on unchanged code suppressed (freeze). Automated review by Kōan (Claude) |
ESPHome Bot (esphbot)
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
J. Nick Koston (bdraco)
left a comment
There was a problem hiding this comment.
Thanks Igor Stadnyk (@fallenmi)
What does this implement/fix?
Keep TF-Luna usable after a transient I2C failure while reconfiguring after a factory reset. Runtime configuration failures now leave a warning and retry on the next update instead of permanently marking the component failed. Initial setup failures remain permanent.
Also check reset/restart writes before following them up, skip runtime writes on failed components, and clear the warning only after receiving a new measurement. The existing 100 ms factory-reset delay is retained. This does not guarantee persistence to flash after a failed save.
The shared Application lifecycle/test-harness changes were split into #21001 and merged separately, as requested. This PR now changes only the two TF-Luna production files and adds its 16 host tests. Existing maintainer merge history is preserved with a normal merge, without rebasing or force-pushing.
The three LOG_STR conversions overlap the existing cleanup in #20864; they are not claimed as a separate new fix.
Verification and limitations
AI assistance: prepared and refined with Claude Code; independently reviewed, tested and integrated with Codex. No claim of manual hardware validation.
Types of changes
Related issue or feature (if applicable):
Pull request in esphome.io with documentation (if applicable):
Pull request in developers.esphome.io with developer documentation (if applicable):
Test Environment
Native macOS host with ASAN/UBSAN; platform configuration/source-generation checks only. The hardware boxes below are intentionally unchecked.
Example entry for
config.yaml:Existing configuration is unchanged; the existing test fixture includes these controls:
Checklist:
tests/folder).If user exposed functionality or configuration variables are added/changed:
Not applicable: no user-facing configuration changes.