v3.7.3 - DAT self-heal fires automatically on startup
๐ Bug Fixes
-
Stale DATs now repair themselves on server restart. v3.7.2 taught
DATSyncServiceto skip itsalready_syncedfast-path whenever any DAT hadfile_count=0, but the self-heal only ran whensync()was explicitly called โ via the UI sync button orPOST /api/dat/sync. Users who had never clicked sync stayed stuck with 67 empty DATs (the classic pre-#49 state: every CD/softlist<disk>DAT showing 0 entries while Nintendo GameCube + Wii โ the two<rom>-based ones โ were healthy). Startup auto-sync previously gated onMAMEREDUMP_AUTO_SYNC=trueAND an empty DAT store, so it never fired for someone who already had 69 DATs sitting in broken state.Startup now has a second trigger: whenever any DAT has
file_count=0, a background sync kicks off unconditionally (no env-var gate, no empty-store gate). The service's existing self-heal logic then rebuilds the DAT set in place using the current parser. Fresh-install behaviour (MAMEREDUMP_AUTO_SYNC=true+ empty store) is unchanged.
๐งช Tests
test_has_stale_dats_empty_store_returns_false/_all_healthy_returns_false/_detects_zero_countโ unit tests for the newDATStore.has_stale_dats()existence check.
๐ Files Changed
app/services/dat_store.pyโ newhas_stale_dats()method (single-row SQL existence check, cheap enough for startup).app/main.pyโ startup auto-sync split into two independent triggers; shared task-spawn helper extracted.tests/test_db_store_operations.pyโ three new tests forhas_stale_dats().
โ ๏ธ Upgrade Notes
- No action required. Restart the server once and stale DATs heal within ~60 s (given network access to the MAMERedump repo). If GitHub is unreachable the sync errors into the log and state is preserved โ identical to the existing manual-sync behaviour.