capture: a shot taken of a player's config must not write it back

`$WOW_CAPTURE_SAVED` points the saved-variable READS at a real player's
configuration so a capture reproduces their interface. The writes went to
the same place, so taking the shot overwrote the configuration it was
taken to study -- with a fixture character's state, since a capture logs
in as nobody. Three of grom's files came back changed from one run, his
pfUI chat scrollback among them.

The shutdown tail returns before all four writes under $WOW_CAPTURE.
Verified by md5 across a run: zero files touched, zero "wrote" lines.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SgstFWtn1RxEJ5kVrpgYwn
This commit is contained in:
2026-11-03 14:34:31 -07:00
co-authored by Claude Opus 5
parent abb4dc1dd3
commit 07dd5ba7e1
2 changed files with 16 additions and 3 deletions
@@ -1044,6 +1044,16 @@ pub(crate) fn shutdown_ui_state(
script.fire_event("PLAYER_LEAVING_WORLD", vec![]);
}
script.fire_event("PLAYER_LOGOUT", vec![]);
// A capture never writes any of it back. `$WOW_CAPTURE_SAVED` points the *reads* at a real
// player's configuration so a shot reproduces their interface, and the writes have to stay
// pointed at nothing, or taking that shot overwrites the configuration it was taken to study
// — with a fixture character's state, since a capture logs in as nobody. Measured the hard
// way: three of grom's files came back changed from one run, his pfUI chat scrollback among
// them. Reads and writes share `local_state`'s path helpers, so the gate belongs here, at
// the one place that writes.
if std::env::var_os("WOW_CAPTURE").is_some() {
return;
}
crate::ui_layout::save_now(script, identity);
crate::ui_saved::save(script);
addons::save_addon_variables(script, identity);
+6 -3
View File
@@ -2611,9 +2611,12 @@ and the bug cannot appear. `saved_variables_path` now goes through `saved_home`,
files and the enable state, and `WOW_CAPTURE_SAVED=<Realm>-<Character>` reproduces
`detail 1431x954 scale 0.70` exactly as his log recorded it.
A hazard that comes with it: a capture run with `$WOW_CAPTURE_SAVED` **writes saved variables back
at exit**, over the player's own files. Copy `benilla-config/saved` and `saved-variables.lua` aside
before a run and diff them after; one FishingBuddy counter moved on each of the runs above.
A hazard came with it, since fixed: a capture run with `$WOW_CAPTURE_SAVED` **wrote saved
variables back at exit**, over the player's own files, with a fixture character's state — a
capture logs in as nobody. Three of grom's files came back changed from one run, his pfUI chat
scrollback among them. The shutdown tail now returns before any of the four writes when
`$WOW_CAPTURE` is set (`ui_script::lifecycle`): `$WOW_CAPTURE_SAVED` points the *reads* at a real
configuration and the writes stay pointed at nothing. Verified by md5 across a run.
### Still open, measured rather than guessed