From eae897ddd607fd3c1e39c2c162a0515f4dbcd9c5 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 19 Mar 2026 13:54:55 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20address=20PR=20review=20=E2=80=94=20wire?= =?UTF-8?q?=20up=20tier-up=20embeds,=20fix=20logger,=20clean=20up=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Import notify_tier_completion from helpers.evolution_notifs instead of using the local stub in logic_gameplay.py (WP-14 embeds were dead code) - Add module-level logger to helpers/main.py, replace bare logging.warning() - Remove duplicate @pytest.mark.asyncio decorator in test_card_embed_evolution.py - Fix progress='close' filter to use filtered count in pagination footer Co-Authored-By: Claude Opus 4.6 (1M context) --- cogs/players_new/evolution.py | 1 + command_logic/logic_gameplay.py | 19 +------------------ helpers/main.py | 4 +++- tests/test_card_embed_evolution.py | 1 - 4 files changed, 5 insertions(+), 20 deletions(-) diff --git a/cogs/players_new/evolution.py b/cogs/players_new/evolution.py index 902fd24..b831084 100644 --- a/cogs/players_new/evolution.py +++ b/cogs/players_new/evolution.py @@ -174,6 +174,7 @@ class Evolution(commands.Cog): # Apply "close" filter client-side if progress and progress.lower() == "close": items = [s for s in items if is_close_to_tierup(s)] + total_count = len(items) if not items: await interaction.followup.send( "No cards are close to a tier-up right now.", diff --git a/command_logic/logic_gameplay.py b/command_logic/logic_gameplay.py index 4b782e9..c7d4e67 100644 --- a/command_logic/logic_gameplay.py +++ b/command_logic/logic_gameplay.py @@ -23,6 +23,7 @@ from helpers import ( position_name_to_abbrev, team_role, ) +from helpers.evolution_notifs import notify_tier_completion from in_game.ai_manager import get_starting_lineup from in_game.game_helpers import PUBLIC_FIELDS_CATEGORY_NAME, legal_check from in_game.gameplay_models import ( @@ -4242,24 +4243,6 @@ async def get_game_summary_embed( return game_embed -async def notify_tier_completion(channel: discord.TextChannel, tier_up: dict) -> None: - """Stub for WP-14: log evolution tier-up events. - - WP-14 will replace this with a full Discord embed notification. For now we - only log the event so that the WP-13 hook has a callable target and the - tier-up data is visible in the application log. - - Args: - channel: The Discord channel where the game was played. - tier_up: Dict from the evolution API, expected to contain at minimum - 'player_id', 'old_tier', and 'new_tier' keys. - """ - logger.info( - f"[WP-14 stub] notify_tier_completion called for channel={channel.id if channel else 'N/A'} " - f"tier_up={tier_up}" - ) - - async def complete_game( session: Session, interaction: discord.Interaction, diff --git a/helpers/main.py b/helpers/main.py index b879ea1..9043e4b 100644 --- a/helpers/main.py +++ b/helpers/main.py @@ -2,6 +2,8 @@ import asyncio import datetime import logging import math + +logger = logging.getLogger("discord_app") import os import random import traceback @@ -132,7 +134,7 @@ async def get_card_embeds(card, include_stats=False) -> list: tier = evo_state["current_tier"] tier_badge = f"[{'EVO' if tier >= 4 else f'T{tier}'}] " except Exception: - logging.warning( + logger.warning( f"Could not fetch evolution state for card {card.get('id')}; " "displaying without tier badge.", exc_info=True, diff --git a/tests/test_card_embed_evolution.py b/tests/test_card_embed_evolution.py index 5a3b9e2..2aabb7e 100644 --- a/tests/test_card_embed_evolution.py +++ b/tests/test_card_embed_evolution.py @@ -158,7 +158,6 @@ class TestCardEmbedTierBadge: returns, then call get_card_embeds() and inspect the resulting embed title. """ - @pytest.mark.asyncio @pytest.mark.asyncio async def test_no_evolution_state_shows_plain_name(self): """