fix: delete stale raw parquet before auto-refresh (#53)

* fix: delete stale raw parquet before auto-refresh

When auto-refresh triggers, remove cached raw file to ensure fresh
MTGJSON download instead of reprocessing old data.

* docs: update changelog and release notes for stale data fix
This commit is contained in:
mwisnowski 2026-02-20 12:22:47 -08:00 committed by GitHub
parent 65680fb920
commit fa8f60035b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View file

@ -1417,6 +1417,16 @@ def _ensure_setup_ready(out, force: bool = False) -> None:
try:
from file_setup.setup import initial_setup
from path_util import card_files_raw_dir
# Delete stale raw file to force fresh download from MTGJSON
# This ensures we get the latest card data (e.g., new sets like ECL)
raw_cards_path = os.path.join(card_files_raw_dir(), "cards.parquet")
if os.path.exists(raw_cards_path):
try:
os.remove(raw_cards_path)
out(f"Removed stale raw file: {raw_cards_path}")
except Exception as e:
out(f"Warning: Could not remove stale raw file: {e}")
# Always run initial_setup when forced or when cards are missing/stale
initial_setup()
except Exception as e: