Skip to content

feat(repairs): persistent-notification repairs platform (Phase 8 PR-8)#93

Merged
Artic0din merged 2 commits into
feat/diagnostics-platformfrom
feat/repairs-platform
May 22, 2026
Merged

feat(repairs): persistent-notification repairs platform (Phase 8 PR-8)#93
Artic0din merged 2 commits into
feat/diagnostics-platformfrom
feat/repairs-platform

Conversation

@Artic0din

Copy link
Copy Markdown
Owner

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.

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>
@Artic0din Artic0din merged commit 50531b2 into feat/diagnostics-platform May 22, 2026
2 of 4 checks passed
@Artic0din Artic0din deleted the feat/repairs-platform branch May 22, 2026 05:38
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.
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