Skip to content

Stop using a private Home Assistant helper for Bouncie tokens (v0.8.1) - #12

Merged
aniceberg merged 1 commit into
mainfrom
claude/own-token-error-mapping
Nov 5, 2026
Merged

aniceberg merged 1 commit into
mainfrom
claude/own-token-error-mapping

Conversation

@aniceberg

Copy link
Copy Markdown
Owner

Addresses the HACS reviewer's note on hacs/default#13369: the Bouncie token request called Home Assistant's private config_entry_oauth2_flow._raise_mapped_token_error, which could change in any release and break token refresh.

The mapping now lives in application_credentials.py, with the same outcomes as before:

Token endpoint result Error raised What happens
Other 4xx OAuth2TokenRequestReauthError Asks you to sign in again
429 or 5xx OAuth2TokenRequestTransientError Retries
No response OAuth2TokenRequestConnectionError Retries

Differs from the note: it suggested raising ConfigEntryAuthFailed and ConfigEntryNotReady. I used Home Assistant's public OAuth2TokenRequest* errors, which inherit from those two. Raising the plain ones would skip the ClientResponseError handling in BouncieClient and the error handling in Home Assistant's sign-in flow, so a failed sign-in would show an unknown error rather than a clear abort.

A search found no other private Home Assistant helpers in the integration. The version is bumped to 0.8.1, and nothing is tagged yet.

Tested: 220 tests pass and ruff is clean, with new tests for 400, 401, 429, 503 and no response against a mocked token endpoint.

Not tested: a real Bouncie token refresh.

🤖 Generated with Claude Code

Map token endpoint failures with Home Assistant's public OAuth2TokenRequest errors, as the
HACS reviewer asked, so a change to its internals can't break Bouncie token refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T13:13:50.762170Z b45e776 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@aniceberg
aniceberg merged commit 70d5f21 into main Nov 5, 2026
6 checks passed
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