Skip to content

fix #25: [16] print() debugging statements bypass structured logging - #50

Merged
CuriosityQuantified merged 1 commit into
mainfrom
feat/issue-25-print-logging-guard
Aug 10, 2026
Merged

CuriosityQuantified merged 1 commit into
mainfrom
feat/issue-25-print-logging-guard

Conversation

@CuriosityQuantified

Copy link
Copy Markdown
Owner

Closes #25

Summary

Issue #25 reported seven print() calls in services/media_service.py inside generate_media_for_turn, which bypass the configured logging system (invisible to log levels and log aggregation).

Verified current state: that entire method — and all seven print() calls — was already removed by fix #18 (commit 1b7a376 / PR #40). Current services/media_service.py (614 lines) has zero print( calls and configures logger = 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: parses services/media_service.py and asserts zero print(...) calls by walking ast.Call nodes whose func is the builtin name print (so "print" inside strings/comments and identifiers like pprint never false-positive). Failure message lists offending line numbers. Includes a positive control that the module configures a logging.getLogger(__name__) logger and that media_service.logger is a real logging.Logger. Fails the moment any print() is reintroduced.
  • .github/workflows/ci.yml — adds a named Run print/logging regression step in the unit-tests job, matching the sibling per-issue regression steps.

services/media_service.py is 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.parse does not execute code, no pull_request_target).

Local gates

  • Python unit suite (exact CI deselects): 248 passed, 1 skipped, 6 deselected (245 baseline + 3 new tests).
  • Next.js production build (npm run build): pass.
  • Playwright e2e: not impacted by this diff (no frontend/app code touched); runs in CI on this PR.
  • Graph refresh: N/A — repo has no graphify-out/ and no code-graph CI job.

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
save-the-world Ready Ready Preview Aug 10, 2026 6:44am
sim-local Ready Ready Preview Aug 10, 2026 6:44am

@CuriosityQuantified
CuriosityQuantified merged commit 6b7fd6e into main Aug 10, 2026
6 checks passed
@CuriosityQuantified
CuriosityQuantified deleted the feat/issue-25-print-logging-guard branch August 10, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[16] print() debugging statements bypass structured logging [9] generate_media_for_turn is dead code with three undefined attributes

1 participant