• exec/load/syncretro_lobby.js exec/tests/syncretro_config_test.js

    From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Sun Aug 2 22:35:14 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/f4e613cd3894b5495887e665
    Modified Files:
    exec/load/syncretro_lobby.js exec/tests/syncretro_config_test.js
    Log Message:
    syncretro: fix save_state falsy-default bug and sweep data loss

    Two Important review findings on the suspend/resume lobby decision
    (7bb468efd5, 2026-08-02).

    syncretro_lobby_state_key()'s capability check had the same falsy-default
    `||` trap already fixed for auto_resume in that commit: `String(ini.console.save_state || "false")` only read correctly because
    `false || "false"` happens to still evaluate to "false" -- an explicit `save_state = false` auto-types to the JS boolean false via
    iniGetObject(), which is falsy, and the fallback string coincided with the wanted answer by luck rather than by design. Compare String(ini.console.save_state) directly, matching auto_resume's fix. The auto_resume check itself is pulled into its own
    syncretro_lobby_auto_resume(), reused by the fix below.

    syncretro_lobby_mark_resumable()'s sweep keyed "is this snapshot still
    current" off syncretro_lobby_state_key(), which answers "is a snapshot PERMITTED" -- gated on the sysop's auto_resume switch, the console/romset save_state capability, and the player's cabinet. The moment any of those toggled off, every ROM's permitted key became "", and the sweep -- which
    treats a key mismatch as a dead snapshot -- deleted every valid snapshot
    on the console on the next lobby entry. A policy toggle a sysop might flip
    back a minute later destroyed every player's saved game.

    A snapshot is dead only when its cartridge is gone or its core/ROM/options changed, never merely because permission is currently withheld, so the
    sweep now keys off the raw, ungated syncretro_state_key() instead. The
    sweep call is also skipped outright while auto_resume is off, so a
    disabled console performs no file operations on anyone's snapshots at
    all.

    exec/tests/syncretro_config_test.js gains the regression coverage: a
    snapshot whose raw key still matches its cartridge survives the sweep
    with auto_resume off and, separately, with save_state off, while a
    snapshot with a genuinely wrong key (a stand-in for a core upgrade) is
    still swept once permission is restored.

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net