fix #25: [16] print() debugging statements bypass structured logging - #50
Merged
Merged
Conversation
Issue #25 reported seven print() calls in services/media_service.py inside generate_media_for_turn, which bypass the configured logging system. That entire method (and all seven print() calls) was already deleted by fix #18 (commit 1b7a376 / PR #40), so the module already satisfies #25. The #18 regression only asserts the dead method is absent; nothing guards #25's own acceptance criterion (no print() bypassing structured logging). Add that missing recurrence guard: - tests/unit/test_no_print_media_service_regression.py: AST-based test asserting zero print() calls in services/media_service.py (walks ast.Call nodes whose func is the builtin name "print", so string / comment / pprint occurrences never false-positive), plus a positive control confirming the module configures a logging.getLogger(__name__) logger. Fails the moment any print() is reintroduced. - .github/workflows/ci.yml: named "Run print/logging regression" step in the unit-tests job, matching the sibling per-issue regression steps. media_service.py is unchanged (already correct). No app behavior changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #25
Summary
Issue #25 reported seven
print()calls inservices/media_service.pyinsidegenerate_media_for_turn, which bypass the configuredloggingsystem (invisible to log levels and log aggregation).Verified current state: that entire method — and all seven
print()calls — was already removed by fix #18 (commit1b7a376/ PR #40). Currentservices/media_service.py(614 lines) has zeroprint(calls and configureslogger = logging.getLogger(__name__). The module already satisfies #25, so no logging change is invented here.The gap that remained: the #18 regression only asserts the dead method is absent — nothing guarded #25's own acceptance criterion (no
print()bypassing structured logging). This PR adds that missing recurrence guard.Changes
tests/unit/test_no_print_media_service_regression.py(new) — AST-based regression: parsesservices/media_service.pyand asserts zeroprint(...)calls by walkingast.Callnodes whosefuncis the builtin nameprint(so"print"inside strings/comments and identifiers likepprintnever false-positive). Failure message lists offending line numbers. Includes a positive control that the module configures alogging.getLogger(__name__)logger and thatmedia_service.loggeris a reallogging.Logger. Fails the moment anyprint()is reintroduced..github/workflows/ci.yml— adds a namedRun print/logging regressionstep in theunit-testsjob, matching the sibling per-issue regression steps.services/media_service.pyis intentionally unchanged (already correct). No application behavior changes.Pipeline
Four fresh subagents ran sequentially in this checkout: implementation+CI, code-review (APPROVE), code-simplifier (no changes — already minimal), security-review (CLEAN — test-only/CI-only, no new trust boundary,
ast.parsedoes not execute code, nopull_request_target).Local gates
npm run build): pass.graphify-out/and no code-graph CI job.🤖 Generated with Claude Code