feat(repairs): persistent-notification repairs platform (Phase 8 PR-8)#93
Merged
Merged
Conversation
PR-8 — HA's issue registry now shows two PriceHawk-raised issues when the integration is in a degraded state: - grid_sensor_unavailable: configured grid power sensor returned None for 10+ consecutive coordinator ticks (= 5 min @ 30s). - ranking_stale: nightly CDR plan ranking job hasn't completed successfully in over 36 hours. Each issue auto-clears on recovery (grid sensor returns a value; ranking job runs). Multi-entry safe: issue ids are prefixed with the entry_id so two PriceHawk entries don't collide. - coordinator.py: new _set_repair / _check_repairs helpers using homeassistant.helpers.issue_registry. _active_repair_ids set dedups to avoid spamming the registry every tick. - strings + translations: top-level "issues" block with title + description + placeholders (entity_id, hours). - conftest stubs homeassistant.helpers.issue_registry with create / delete recorders for tests. - 19 new tests; 956 total pass. Deferred per D-P8-4: wholesale_source_unreachable. Needs cross-source success tracking; follow-up PR. Decisions: DECISIONS.md > D-P8-4. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 23, 2026
Artic0din
added a commit
that referenced
this pull request
May 23, 2026
… Jinja (#145) Two real bugs surfaced by a Copilot-CLI retro-review of the 22 merged PRs that the prior @claude batch couldn't reach (OIDC workflow-validation against stale main). statistics.py — external_statistic_id now sanitizes via regex: CDR-derived provider_ids carry the plan id verbatim (e.g. ``agl_AGL-CDR-N0001`` for AGL via CDR), so `.lower()` alone left hyphens that the recorder's ``[a-z0-9_]+`` regex silently rejected. Every CDR user's dual-write would fail and the Energy Dashboard would never receive their cost data — same silent-failure class #107 fixed for uppercase ULIDs. Added ``_STATISTIC_ID_OBJECT_SAFE`` compiled regex that coerces ANY character outside ``[a-z0-9_]`` to underscore. New regression test ``test_cdr_plan_id_with_hyphens_is_sanitized`` + adjusted ``test_entry_id_sliced_to_8_chars`` for the post-sanitization shape. Surfaced by retro-review of PRs #93, #95. blueprints — variables block replaces !input inside Jinja: ``daily_7pm_summary.yaml`` and ``wholesale_spike_alert.yaml`` had templates like ``{{ states(!input today_cost_sensor) }}``. ``!input`` is a YAML tag (resolved at YAML parse time) and is invalid inside Jinja ``{{ }}`` — Jinja parses ``!`` as an invalid operator and the template never renders. Replaced with the standard HA pattern: a ``variables:`` block at action level that binds blueprint inputs as Jinja identifiers (``today_cost_entity: !input today_cost_sensor`` etc.), then ``{{ states(today_cost_entity) }}`` in the message. Surfaced by retro-review of PRs #99, #100. 22 Copilot reviews ran (PRs #85, #87-#101, #104, #105, #108-#111). Most findings were false positives — Copilot flagged ``ServiceValidationError`` and ``async_items`` as broken HA APIs (they're both fine), and several findings duplicated bugs already fixed by codex P0/P1 work (token-in-URL #109, DWT reset #109). Findings library + triage notes archived in ``.planning/copilot-retro/``. Full test suite: 1120 passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fourth plank of Silver. Two issues: grid_sensor_unavailable (10 None ticks = 5 min), ranking_stale (> 36h since last run). Auto-clear on recovery; multi-entry safe via entry_id-prefixed issue ids. wholesale_source_unreachable deferred per D-P8-4. 19 new tests; 956 total. Stacked on PR #92.