fix: remove hardcoded master_debug flag from api_calls.py (#28) #58
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
ai-working
bug
enhancement
feature
in-queue
performance
security
tech-debt
todo
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-discord#58
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-discord-28"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Removes the hardcoded
master_debug = Trueflag that was forcing all API request/response logging to INFO level regardless of the configuredLOG_LEVEL.Changes
master_debug = True(line 20)logger.info(...) if master_debug else logger.debug(...)calls with unconditionallogger.debug(...)log_return_value()to uselogger.debuginstead oflogger.info(was logging up to 300,000 chars per response at INFO level)log_return_valuethat referencedmaster_debugFiles Changed
api_calls.pyImpact
In production with
LOG_LEVEL=INFO(default), API request/response details will no longer flood the logs. They will only appear whenLOG_LEVEL=DEBUGis explicitly set.Other observations
PLAYER_CACHE = {}(line 20 post-fix) is still an unused dead variable — tracked in issue #37.AI Code Review
Files Reviewed
api_calls.py(modified)Findings
Correctness
logger.info(...) if master_debug else logger.debug(...)calls correctly replaced with unconditionallogger.debug(...). Sincemaster_debugwas hardcodedTrue, these were always taking the INFO branch — the fix is accurate.log_return_value()correctly updated tologger.debug— previously this could log up to 300,000 chars of API response data at INFO level in production.logger.warning("[ S N I P P E D ]")sentinel at the end oflog_return_valueis intentionally kept at WARNING level to signal truncation. This is appropriate.# if master_debug:block inlog_return_value) cleanly removed.Security
Style & Conventions
Suggestions
Verdict: APPROVED
Straightforward, correct fix. Removes a hardcoded debug flag that was causing verbose API logging at INFO level in production. All 6 log-level changes (5 inline +
log_return_value) are correct, dead code is cleaned up, and the behavioral change is exactly as described.Automated review by Claude PR Reviewer
56fe8a6099to9d1993bf49