fix: ContextualLogger crashes when callers pass exc_info=True #14

Merged
cal merged 3 commits from fix/contextual-logger-exc-info into main 2026-02-20 03:26:41 +00:00
Owner

Summary

  • ContextualLogger forwarded all **kwargs as extra={} to Python's standard logger. When callers passed exc_info=True, it landed in the extra dict and Python's LogRecord raised KeyError("Attempt to overwrite 'exc_info' in LogRecord") since exc_info is a reserved attribute.
  • This caused /submit-scorecard to crash after game data was already posted, masking the original error and preventing proper rollback. Two users were affected today.
  • Added _extract_logging_params() to safely pop exc_info and stack_info from kwargs before passing as extra, forwarding them as proper logging parameters instead. Fixes ~25 call sites across the codebase.
  • Fixed weather test that expected 4 embed fields instead of 5 (Stadium Image field was added but test not updated).

Test plan

  • All 901 tests pass, 0 failures
  • Weather test specifically verified (20/20 pass)
  • Deploy to production and monitor /submit-scorecard logs for proper error capture

🤖 Generated with Claude Code

## Summary - **ContextualLogger** forwarded all `**kwargs` as `extra={}` to Python's standard logger. When callers passed `exc_info=True`, it landed in the extra dict and Python's LogRecord raised `KeyError("Attempt to overwrite 'exc_info' in LogRecord")` since `exc_info` is a reserved attribute. - This caused `/submit-scorecard` to crash after game data was already posted, masking the original error and preventing proper rollback. Two users were affected today. - Added `_extract_logging_params()` to safely pop `exc_info` and `stack_info` from kwargs before passing as `extra`, forwarding them as proper logging parameters instead. Fixes ~25 call sites across the codebase. - Fixed weather test that expected 4 embed fields instead of 5 (Stadium Image field was added but test not updated). ## Test plan - [x] All 901 tests pass, 0 failures - [x] Weather test specifically verified (20/20 pass) - [ ] Deploy to production and monitor `/submit-scorecard` logs for proper error capture 🤖 Generated with [Claude Code](https://claude.com/claude-code)
cal added 2 commits 2026-02-20 03:21:26 +00:00
ContextualLogger methods forwarded all **kwargs as extra={} to Python's
standard logger. When callers passed exc_info=True, it landed in the
extra dict and Python's LogRecord raised KeyError("Attempt to overwrite
'exc_info' in LogRecord") since exc_info is a reserved attribute.

This caused /submit-scorecard to crash after game data was already
posted, masking the original error and preventing proper rollback.

Fix: Extract exc_info and stack_info from kwargs before passing as extra,
forwarding them as proper logging parameters instead. Also fix direct
callers in submit_scorecard.py and views/players.py to use error=e.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
test: fix weather test expecting 4 embed fields instead of 5
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m30s
62b058bddf
The Stadium Image field was added to the weather embed but the
test_full_weather_workflow assertion wasn't updated to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cal added 1 commit 2026-02-20 03:25:35 +00:00
Merge branch 'main' into fix/contextual-logger-exc-info
All checks were successful
Build Docker Image / build (pull_request) Successful in 46s
9db128bd27
cal merged commit eaaa9496a3 into main 2026-02-20 03:26:41 +00:00
cal deleted branch fix/contextual-logger-exc-info 2026-02-20 03:26:41 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-v2#14
No description provided.