From dc59b21bee7a5cd52bb996463b132eca231e9aa8 Mon Sep 17 00:00:00 2001 From: rambros Date: Sun, 8 Mar 2026 02:46:10 +0530 Subject: [PATCH] simplify log level config --- src/core/configuration.py | 6 +----- src/ui/backup_ops.py | 8 ++++---- src/ui/shuttle_ops.py | 10 +++++----- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/core/configuration.py b/src/core/configuration.py index b2467af..727e1e8 100644 --- a/src/core/configuration.py +++ b/src/core/configuration.py @@ -3,10 +3,6 @@ import yaml from pathlib import Path from pydantic import BaseModel, Field -class MigrationSettings(BaseModel): - batch_size: int = Field(default=100) - log_level: str = Field(default="DEBUG") - class AppConfig(BaseModel): discord_bot_token: Optional[str] = Field(default=None) discord_server_id: Optional[str] = Field(default=None) @@ -15,7 +11,7 @@ class AppConfig(BaseModel): target_bot_token: Optional[str] = Field(default=None) target_server_id: Optional[str] = Field(default=None) target_api_url: Optional[str] = Field(default=None) - migration: MigrationSettings = Field(default_factory=MigrationSettings) + log_level: str = Field(default="DEBUG") # ── backward‑compat shims (read‑only) ──────────────────────────────── # The rest of the codebase (fluxer/stoat modules) still reads these. diff --git a/src/ui/backup_ops.py b/src/ui/backup_ops.py index 1e3902f..e216d9b 100644 --- a/src/ui/backup_ops.py +++ b/src/ui/backup_ops.py @@ -162,7 +162,7 @@ class BackupPane(Container): @work(exclusive=True) async def run_backup_profile(self) -> None: - modal = ProgressScreen(log_level=self.config.migration.log_level) + modal = ProgressScreen(log_level=self.config.log_level) self.app.push_screen(modal) await asyncio.sleep(0.1) modal.phase_progress() @@ -214,7 +214,7 @@ class BackupPane(Container): @work(exclusive=True) async def run_backup_messages(self) -> None: - modal_prog = ProgressScreen(log_level=self.config.migration.log_level) + modal_prog = ProgressScreen(log_level=self.config.log_level) self.app.push_screen(modal_prog) await asyncio.sleep(0.1) @@ -273,7 +273,7 @@ class BackupPane(Container): selected_channels = [c for c in eligible_channels if c.id in selected_ids] # Phase 2: Confirmation - modal_prog = ProgressScreen(log_level=self.config.migration.log_level) # Re-instantiate to avoid Textual re-push UI freeze + modal_prog = ProgressScreen(log_level=self.config.log_level) # Re-instantiate to avoid Textual re-push UI freeze self.app.push_screen(modal_prog) await asyncio.sleep(0.1) @@ -398,7 +398,7 @@ class BackupPane(Container): @work(exclusive=True) async def run_backup_sync(self) -> None: - modal_prog = ProgressScreen(log_level=self.config.migration.log_level) + modal_prog = ProgressScreen(log_level=self.config.log_level) self.app.push_screen(modal_prog) await asyncio.sleep(0.1) modal_prog.phase_progress() diff --git a/src/ui/shuttle_ops.py b/src/ui/shuttle_ops.py index 82ab680..5e5b218 100644 --- a/src/ui/shuttle_ops.py +++ b/src/ui/shuttle_ops.py @@ -375,7 +375,7 @@ class ShuttlePane(Container): @work(exclusive=True) async def run_batch_clone(self, selections: list[str]) -> None: - modal = ProgressScreen(log_level=self.config.migration.log_level) + modal = ProgressScreen(log_level=self.config.log_level) self.app.push_screen(modal) await asyncio.sleep(0.1) connections_started = False @@ -506,7 +506,7 @@ class ShuttlePane(Container): @work(exclusive=True) async def run_batch_sync(self, selections: list[str]) -> None: - modal = ProgressScreen(log_level=self.config.migration.log_level) + modal = ProgressScreen(log_level=self.config.log_level) self.app.push_screen(modal) await asyncio.sleep(0.1) try: @@ -766,7 +766,7 @@ class ShuttlePane(Container): migrate_mod = fluxer_migrate if self.target_platform == "fluxer" else stoat_migrate platform_name = self.target_platform.capitalize() - modal = ProgressScreen(log_level=self.config.migration.log_level) + modal = ProgressScreen(log_level=self.config.log_level) self.app.push_screen(modal) await asyncio.sleep(0.1) @@ -833,7 +833,7 @@ class ShuttlePane(Container): has_previous = bool(last_migrated) # Analyze - modal = ProgressScreen(log_level=self.config.migration.log_level) + modal = ProgressScreen(log_level=self.config.log_level) self.app.push_screen(modal) await asyncio.sleep(0.1) @@ -1041,7 +1041,7 @@ class ShuttlePane(Container): @work(exclusive=True) async def run_batch_danger(self, selections: list[str]) -> None: - modal = ProgressScreen(log_level=self.config.migration.log_level) + modal = ProgressScreen(log_level=self.config.log_level) self.app.push_screen(modal) await asyncio.sleep(0.1) target_started = False