Skip to content

fix: address review findings on the 2.1.3b2 changes - #322

Merged
cayossarian merged 1 commit into
mainfrom
fix/review-2.1.3b2-findings
Oct 9, 2026
Merged

cayossarian merged 1 commit into
mainfrom
fix/review-2.1.3b2-findings

Conversation

@cayossarian

@cayossarian cayossarian commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Follow-up fixes from a code review of the 2.1.3b2 changes since v2.1.2.

Fixes

  • Threshold services can reach a circuit that has left the panel. resolve_entity_to_circuit_id matched only the coordinator's live circuit ids, so clearing a threshold through an orphaned entity fell through to the entity id. That cleared nothing and left the real override stored. It now also matches against the monitor's stored override ids, the same way favorites removal uses stored favorites. Only this integration's entities are matched, so another integration's unique_id can't hit a short opaque circuit id.
  • An unreadable hardware status no longer clears the Repair. A failed /api/v2/status read still proceeds (fail-open), but it no longer takes down a standing unvalidated-hardware Repair: an unread status is no evidence the hardware changed. httpx.InvalidURL is caught as well.
  • Hardware version spelling. The verdict ignores surrounding whitespace and the case of UNKNOWN, so a spelling alone can't trigger the terminal refusal.
  • Clearer error when the entity's panel isn't loaded. Threshold services now raise favorite_panel_not_loaded instead of monitoring_not_enabled. The key already exists in every language, so no translation changes.
  • Battery power docstring now says an unpublished value reads unknown where 2.0.8 reported 0 W. The behaviour change itself was intended in b3549cd.
  • Circuit sensor name fallbacks use construct_circuit_identifier_from_tabs. The output is unchanged.

Not changed

  • The hardware read stays before connect (test_the_status_is_read_before_connecting_...). The REST version alone can't settle a refusal, because MAIN_32 always proceeds, so it can't move into the config flow either.
  • Favorites removal still loads stored favorites up front. Matching live and stored ids together is what keeps the longest-id-wins rule correct.

Testing

  • New tests in tests/test_current_monitor.py, tests/test_setup_entry.py and tests/test_hardware_guard.py.
  • 2207 tests pass. The two FQDN reconfigure tests in tests/test_v2_config_flow_tls.py also fail on unmodified main in the environment I ran them in.
  • mypy is clean, and ruff reports nothing new in the changed files.

- Threshold services resolve an entity against the monitor's stored
  overrides as well as the live circuits, so the override of a circuit
  that has left the panel can still be cleared through its orphaned
  entity. Only this integration's entities are matched.
- A hardware status that cannot be read proceeds without clearing a
  standing unvalidated-hardware Repair; httpx.InvalidURL is caught too.
- The hardware verdict ignores surrounding whitespace and the case of
  UNKNOWN, so a spelling alone cannot make the terminal refusal.
- A threshold call whose entity's own panel is not loaded says so
  instead of reporting monitoring as disabled.
- Correct the battery power docstring: an unpublished value now reads
  unknown where 2.0.8 reported 0 W.
- Circuit sensor name fallbacks use construct_circuit_identifier_from_tabs.
@cayossarian
cayossarian merged commit 3ccf4de into main Oct 9, 2026
7 checks passed
@cayossarian
cayossarian deleted the fix/review-2.1.3b2-findings branch October 9, 2026 23:57
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