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

@ -92,6 +92,10 @@ This format follows Keep a Changelog principles and aims for Semantic Versioning
- Optimized linting rules for development workflow
### Fixed
- **Card Data Auto-Refresh**: Fixed stale data issue when new sets are released
- Auto-refresh now deletes cached raw parquet file before downloading fresh data
- Ensures new sets are included instead of reprocessing old cached data
- Resolves issue where Docker volumes would retain outdated raw files
- **Template Quality**: Resolved HTML structure issues found by validation tests
- Fixed duplicate ID attributes in build wizard and theme picker templates
- Removed erroneous block tags from component documentation

View file

@ -89,6 +89,9 @@ Web UI improvements with Tailwind CSS migration, TypeScript conversion, componen
_None_
### Fixed
- **Card Data Auto-Refresh**: Fixed stale data issue when new sets are released
- Auto-refresh now deletes cached raw parquet file before downloading fresh data
- Ensures new sets are included instead of reprocessing old cached data
- **Template Quality**: Resolved HTML structure issues
- Fixed duplicate ID attributes in templates
- Removed erroneous template block tags

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: