Repository navigation
Normalize username check for file-based mode - #187
Conversation
| username: If ``"use@file.com"``, switches the session to file-based mode. | ||
| """ | ||
| if username == "use@file.com": | ||
| if username.strip().lower() == "use@file.com": |
There was a problem hiding this comment.
🤖 Claude Code Review
Bug: username is typed str | None and defaults to None. Hive(username=None) is allowed (session/__init__.py:38), and start_session passes config.get("username", self.config.username) here (discovery.py:192). If the username is None, None.strip() raises AttributeError, so start_session() crashes. The same happens if config={"username": None}. Before this PR, the == comparison handled None.
Suggested fix:
| if username.strip().lower() == "use@file.com": | |
| if username and username.strip().lower() == "use@file.com": |
Also note that hive_auth_async.py:82 and hive_auth.py:114 still use the exact == "use@file.com" check, so the normalisation is inconsistent. No test was added for the new behaviour (mixed case, whitespace, None).
🤖 Claude Code ReviewVerdict: Request changes. The new check crashes when Bugs
Should fix
Home Assistant check: I tried to fetch Not reviewed: The PR is a one-line change, and I reviewed all of it. Automated review by Claude Code · workflow run |
No description provided.