fix(api): guard get_user against non-dict session#32
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
|
3f1ba2f to
ab73ddb
Compare
|
Claude finished @olivermeyer's task in 1m 56s —— View job Code Review Complete ✓SummaryThe PR successfully guards Review FeedbackSuggestions1. Add logging for non-dict session caseLocation: Issue: When Current code: raw_user: dict | None = session.get("user") if isinstance(session, dict) else None # type: ignore[reportUnknownVariableType]Suggestion: Add logging when session is not a dict: if not isinstance(session, dict):
msg = f"Session is not a dict (got {type(session).__name__})"
logger.critical(msg)
raw_user = None
else:
raw_user = session.get("user")Why: This improves observability and helps diagnose Auth0 integration issues. The existing code already logs at What Works Well✅ Defensive programming: The Technical AnalysisChanged LogicThe PR modifies Before: Assumed Test CoverageThe new test (
Security & Performance
VerdictRecommendation: Approve with the logging suggestion implemented. The core fix is correct and well-tested. Adding logging for the non-dict case would improve observability without changing the behavior. Since this is a suggestion rather than a blocking issue, the PR could be merged as-is if you prefer, though I strongly recommend adding the logging. |
|



get_usershould returnNonewhen the Auth0 session is not a dict.