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
Closed
chore: retro-review PR #90 — feat(config_flow): per-provider reauth flows (Phase 8 PR-5)#122Artic0din wants to merge 2 commits into
Artic0din wants to merge 2 commits into
Conversation
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>
Owner
Author
|
@claude review |
|
Claude encountered an error after 7m 13s —— View job I'll analyze this and get back to you. |
|
Claude encountered an error after 8m 31s —— View job I'll analyze this and get back to you. |
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. |
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.
Synthetic retro-review of merged PR #90. Diff = original
8b8469f..73a3638(same as original PR). Do NOT merge; close after @claude review posts.