testbed: stop destroying the player's save

The documented way to run the testbed began with

    rm -rf ~/AppData/Roaming/LOVE/Alchemist

which is the player's actual playthrough. It was written down as the
official procedure in four places, so every run of the test suite ate a
real save -- including twice in the session that produced the previous
commit. Reported by Talon.

The testbed does genuinely need an empty save directory: it drives a new
game from the main menu through the prologue, which has already happened
in any real save. So tests/run-testbed.sh MOVES the save aside (never
deletes it), runs, discards the test run's directory and moves the real
one back. Restore is on an EXIT trap plus INT/TERM, so it also happens on
a failed run, a crash and Ctrl-C. If the restore itself fails it says so
loudly and leaves the backup on disk rather than pressing on.

This cannot live inside the mod: love.load calls config.initialize,
keybindings.initialize and user.initialize long before main.lua reaches
require("accessibility").initialize(), so by the time any of our Lua runs
the save directory has already been read. The swap has to happen around
the process.

The rm -rf is removed from all four docs that carried it, each replaced
with the script and the reason not to clear that directory by hand --
being written down as procedure is what made it recur.

accessibility/.gitattributes forces LF on *.sh, or a Windows checkout
hands bash a \r and the script dies. It sits inside accessibility/ on
purpose: a top-level one would show up in the game-file footprint check,
which still reads `main.lua | 1 +`.

Verified with a marker file in a populated save directory: 38 checks, 0
failures, marker intact, no leftover backup directories.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Accessibility Mod
2026-08-02 02:59:34 +02:00
co-authored by Claude Opus 5
parent 0df3842bf1
commit c841bcc68d
5 changed files with 180 additions and 17 deletions
+6 -2
View File
@@ -65,10 +65,14 @@ worth knowing before you write a line.
```
lua accessibility/tests/test_history.lua # pure Lua, instant
rm -rf ~/AppData/Roaming/LOVE/Alchemist # clean save
"C:/Program Files/LOVE/lovec.exe" . --a11y-test # ~4 min
bash accessibility/tests/run-testbed.sh # ~4 min
```
**Always use that script — never call `lovec . --a11y-test` directly, and never
`rm -rf` the save directory.** The testbed needs an empty save to drive a fresh
playthrough; the script parks the player's real save, runs, and puts it back.
Deleting the save by hand destroys a real playthrough.
The testbed drives the real game by code and navigates by *reading focus* rather
than counting keypresses. It has caught essentially every bug in this project, so
run it — a change that looks obviously correct is exactly the kind that fails.