Skip to content

fix #18: [9] generate_media_for_turn is dead code with three undefined attributes - #40

Merged
CuriosityQuantified merged 4 commits into
mainfrom
feat/remove-dead-generate-media-for-turn
Aug 9, 2026
Merged

CuriosityQuantified merged 4 commits into
mainfrom
feat/remove-dead-generate-media-for-turn

Conversation

@CuriosityQuantified

Copy link
Copy Markdown
Owner

Closes #18

Summary

  • Deletes generate_media_for_turn (82 lines) from services/media_service.py — the method was never called from anywhere in the codebase, yet referenced self.tts_service, self.state_service, and self.notify_progress, none of which are defined in MediaService.__init__. Any invocation would have immediately raised AttributeError. It also used print() for debugging instead of the logger.
  • Adds tests/unit/test_dead_code_removal_regression.py with a regression test that asserts the dead method is absent and that the neighboring test_r2_upload_download method survived the deletion intact.

Test results

  • Unit tests: 155 passed / 1 skipped / 8 deselected (154 baseline + 1 new regression test)
  • Build: Next.js production build passes

Subagent pipeline

  1. Implementation + CI: test-first TDD — regression test written, confirmed failing, deletion performed, confirmed passing. Full suite: 155 passed.
  2. Code review: verified complete deletion, no scope creep, no missing requirements. Fixed a trailing-newline standards violation.
  3. Code simplification: consolidated 4 tests into 1 focused test, removed unused import pytest, moved import to module level per project conventions.
  4. Security review: GREEN — no findings requiring remediation. The deletion removes no reachable execution path and introduces no new attack surface.

Graph refresh

Not applicable — this repo has no graphify-out/ or code-graph CI job.

…ibutes

The method `generate_media_for_turn` in MediaService was never called
anywhere, yet referenced `self.tts_service`, `self.state_service`, and
`self.notify_progress` — none of which are defined in `__init__`. Any
call would immediately raise AttributeError. It also used `print()` for
debugging instead of the logger.

Delete the method (82 lines). Add a regression test that locks in its
absence and verifies the neighboring method survives the deletion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 9, 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 9, 2026 1:10am
sim-local Ready Ready Preview Aug 9, 2026 1:10am

@CuriosityQuantified
CuriosityQuantified merged commit 1b7a376 into main Aug 9, 2026
6 checks passed
@CuriosityQuantified
CuriosityQuantified deleted the feat/remove-dead-generate-media-for-turn branch August 9, 2026 01:11
CuriosityQuantified added a commit that referenced this pull request Aug 10, 2026
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>
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.

[9] generate_media_for_turn is dead code with three undefined attributes

1 participant