PR4h fixup: restore strict 1:1 in master.py

Three drifts caught in line-by-line review against original — all reverted
so the lifted body is now byte-identical to the web_server.py original
(after deps.X → global X normalization):

1. `import traceback` was hoisted to module-level imports. Original imports
   it inline inside the except block. Moved back to inline (same behavior,
   but strict location parity).
2. Trailing whitespace on the blank line after analysis_results.append.
3. Trailing whitespace on the blank line inside the wishlist except handler.

Diff against original now produces ZERO differences. Tests still 21/21
passing, ruff clean.
This commit is contained in:
Broque Thomas 2026-04-28 10:39:52 -07:00
parent fa29ee2195
commit 1fb2f34955

View file

@ -29,7 +29,6 @@ import json
import logging
import re
import time
import traceback
import uuid
from dataclasses import dataclass
from typing import Any, Callable
@ -231,7 +230,7 @@ def run_full_missing_tracks_process(batch_id, playlist_id, tracks_json, deps: Ma
analysis_results.append({
'track_index': track_index, 'track': track_data, 'found': found, 'confidence': confidence
})
# WISHLIST REMOVAL: If track is found in database, check if it should be removed from wishlist
if found and confidence >= 0.7:
try:
@ -553,7 +552,7 @@ def run_full_missing_tracks_process(batch_id, playlist_id, tracks_json, deps: Ma
spotify_data = json.loads(spotify_data)
except:
spotify_data = {}
if not spotify_data:
spotify_data = {}
@ -626,6 +625,7 @@ def run_full_missing_tracks_process(batch_id, playlist_id, tracks_json, deps: Ma
except Exception as e:
logger.error(f"Master worker for batch {batch_id} failed: {e}")
import traceback
traceback.print_exc()
is_auto_batch = False