Skip to content

chore: retro-review PR #90 — feat(config_flow): per-provider reauth flows (Phase 8 PR-5)#122

Closed
Artic0din wants to merge 2 commits into
claude-retro/pr-90-basefrom
claude-retro/pr-90-head
Closed

chore: retro-review PR #90 — feat(config_flow): per-provider reauth flows (Phase 8 PR-5)#122
Artic0din wants to merge 2 commits into
claude-retro/pr-90-basefrom
claude-retro/pr-90-head

Conversation

@Artic0din

Copy link
Copy Markdown
Owner

Synthetic retro-review of merged PR #90. Diff = original 8b8469f..73a3638 (same as original PR). Do NOT merge; close after @claude review posts.

Artic0din and others added 2 commits May 22, 2026 06:16
PR-5 — When Amber, LocalVolts, or OpenElectricity (DWT-OE) rejects an
API key (HTTP 401/403), PriceHawk now raises ConfigEntryAuthFailed and
HA prompts the user to re-enter credentials via the integration UI.
First plank of HACS Silver compliance.

- coordinator.py: Amber _fetch_amber_with_retry raises on 401/403 (was
  silently returning None). LocalVolts _maybe_poll_localvolts translates
  LocalVoltsAPIError("auth failed") to ConfigEntryAuthFailed at the
  coordinator boundary; non-auth LocalVoltsAPIError re-raises as-is.
  DWT-OE _refresh_dwt_price tags the failed provider before re-raising
  the existing ConfigEntryAuthFailed from PR-2.
- New _reauth_provider_id instance attribute on the coordinator —
  single source of truth for "which provider failed last." Set BEFORE
  raising; read by the ConfigFlow dispatcher.
- config_flow.py: new async_step_reauth(entry_data) dispatcher reads
  the tag via entry.runtime_data.coordinator and routes to one of:
  async_step_reauth_amber, async_step_reauth_localvolts, or
  async_step_reauth_dwt_oe. Unknown tag aborts cleanly with
  reason=reauth_provider_unknown.
- Each sub-step pre-fills the existing entry's field(s), validates the
  new credential against a live probe (Amber /sites, LocalVolts
  fetch_recent_intervals, OpenElectricity SDK), and calls
  async_update_reload_and_abort on success. Entry id, options, and
  runtime_data accumulators (daily_cost_history, _saving_month_aud,
  _daily_wins) are preserved through the reauth.
- API keys NEVER appear in log messages, UI errors, or exception
  strings. Extends the PR-2 OpenElectricity scrubber pattern.
- strings + translations: new reauth_amber / reauth_localvolts /
  reauth_dwt_oe step descriptions + invalid_credentials error +
  reauth_provider_unknown / reauth_successful abort reasons.
  strings.json byte-identical to translations/en.json.
- 26 new tests covering raise sites, key redaction (with caplog),
  dispatcher source contracts, sub-step source contracts, strings
  parity, and history-preservation guard.
- 910 total pass (884 baseline + 26 new).

Decisions: DECISIONS.md > D-P8-1 (dispatcher-pattern reauth chosen over
ConfigEntryAuthFailed subclassing — HA strips the exception before
invoking reauth, only entry id survives the round-trip).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Artic0din

Copy link
Copy Markdown
Owner Author

@claude review

@claude

claude Bot commented May 23, 2026

Copy link
Copy Markdown

Claude encountered an error after 7m 13s —— View job


I'll analyze this and get back to you.

@claude

claude Bot commented May 23, 2026

Copy link
Copy Markdown

Claude encountered an error after 8m 31s —— View job


I'll analyze this and get back to you.

@Artic0din

Copy link
Copy Markdown
Owner Author

Retro-review complete. Findings (if any) tracked in fix/retro-review-batch (#143) or noted in .planning/retro-review-findings.md. Closing synthetic PR + cleaning branches.

@Artic0din Artic0din closed this May 23, 2026
@Artic0din Artic0din deleted the claude-retro/pr-90-head branch May 23, 2026 13:39
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