fix: replace print(req.scope) with logger.debug in /api/docs (#21) #54

Merged
cal merged 1 commits from ai/major-domo-database-21 into next-release 2026-03-10 14:38:59 +00:00
Owner

Summary

  • Replaces print(req.scope) on app/main.py:78 with logger.debug(req.scope) so request scope data is routed through the structured rotating-file logger instead of stdout.

Files Changed

  • app/main.py — single functional change: printlogger.debug

Notes

  • The module-level logger = logging.getLogger('discord_app') (line 22) is already in scope at the call site.
  • Debug-level is appropriate: this is diagnostic data, not an error or warning.
  • ruff/black auto-reformatted the file on save (quote style, import wrapping) — this is expected per project setup and was observed in prior PRs.

Other observations

  • import datetime and import Depends on lines 1 and 6 are unused (pre-existing, out of scope).

Test plan

  • No test suite. Verified fix by reading back the modified file.
## Summary - Replaces `print(req.scope)` on `app/main.py:78` with `logger.debug(req.scope)` so request scope data is routed through the structured rotating-file logger instead of stdout. ## Files Changed - `app/main.py` — single functional change: `print` → `logger.debug` ## Notes - The module-level `logger = logging.getLogger('discord_app')` (line 22) is already in scope at the call site. - Debug-level is appropriate: this is diagnostic data, not an error or warning. - ruff/black auto-reformatted the file on save (quote style, import wrapping) — this is expected per project setup and was observed in prior PRs. ## Other observations - `import datetime` and `import Depends` on lines 1 and 6 are unused (pre-existing, out of scope). ## Test plan - No test suite. Verified fix by reading back the modified file.
cal added 1 commit 2026-03-06 01:02:25 +00:00
fix: replace print(req.scope) with logger.debug in /api/docs (#21)
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m12s
b035ba4f58
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cal added the
ai-reviewing
label 2026-03-06 01:15:35 +00:00
cal reviewed 2026-03-06 01:16:24 +00:00
cal left a comment
Author
Owner

AI Code Review

Files Reviewed

  • app/main.py (modified)

Findings

Correctness

  • Functional change is correct: print(req.scope)logger.debug(req.scope) at get_docs (line 78 in base).
  • Module-level logger = logging.getLogger('discord_app') (line 22) is in scope at the call site. No issues.
  • req.scope is an ASGI scope dict — logger.debug() will call str() on it implicitly, same behaviour as print() but routed through the structured logger.
  • DEBUG level is appropriate: this is diagnostic/introspective data, not an error or warning.

Security

  • No new risk introduced. req.scope may contain path, headers, and query data, but logging it at DEBUG level (only active when LOG_LEVEL=DEBUG) into the rotating file logger is acceptable and an improvement over printing to stdout.

Style & Conventions

  • ruff/black reformatting throughout (single → double quotes, import block expansion, trailing comma in FastAPI(...)) is expected per project setup and consistent with prior PRs.
  • No conventions violated.

Suggestions

  • Pre-existing: import datetime (line 1) and import Depends (line 6) are unused. PR author noted these are out of scope — agree, no action needed here.

Verdict: APPROVED

Clean, minimal fix. Correct logger reference, appropriate log level, no regressions. Cosmetic reformatting is expected and benign.


Automated review by Claude PR Reviewer

## AI Code Review ### Files Reviewed - `app/main.py` (modified) ### Findings #### Correctness - Functional change is correct: `print(req.scope)` → `logger.debug(req.scope)` at `get_docs` (line 78 in base). - Module-level `logger = logging.getLogger('discord_app')` (line 22) is in scope at the call site. No issues. - `req.scope` is an ASGI scope dict — `logger.debug()` will call `str()` on it implicitly, same behaviour as `print()` but routed through the structured logger. - `DEBUG` level is appropriate: this is diagnostic/introspective data, not an error or warning. #### Security - No new risk introduced. `req.scope` may contain path, headers, and query data, but logging it at DEBUG level (only active when `LOG_LEVEL=DEBUG`) into the rotating file logger is acceptable and an improvement over printing to stdout. #### Style & Conventions - ruff/black reformatting throughout (single → double quotes, import block expansion, trailing comma in `FastAPI(...)`) is expected per project setup and consistent with prior PRs. - No conventions violated. #### Suggestions - Pre-existing: `import datetime` (line 1) and `import Depends` (line 6) are unused. PR author noted these are out of scope — agree, no action needed here. ### Verdict: APPROVED Clean, minimal fix. Correct logger reference, appropriate log level, no regressions. Cosmetic reformatting is expected and benign. --- *Automated review by Claude PR Reviewer*
cal added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-06 01:17:08 +00:00
cal changed target branch from main to next-release 2026-03-07 07:32:45 +00:00
cal merged commit 5c57a30637 into next-release 2026-03-10 14:38:59 +00:00
cal deleted branch ai/major-domo-database-21 2026-03-10 14:38:59 +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-database#54
No description provided.