From 07dd5ba7e183c06976cfda594818e8787e029a6e Mon Sep 17 00:00:00 2001 From: grom Date: Tue, 3 Nov 2026 14:34:31 -0700 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01SgstFWtn1RxEJ5kVrpgYwn --- crates/benilla-app/src/ui_script/lifecycle.rs | 10 ++++++++++ docs/ADDON_COMPAT.md | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/benilla-app/src/ui_script/lifecycle.rs b/crates/benilla-app/src/ui_script/lifecycle.rs index 9da3c2a9..b08f6cce 100644 --- a/crates/benilla-app/src/ui_script/lifecycle.rs +++ b/crates/benilla-app/src/ui_script/lifecycle.rs @@ -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); diff --git a/docs/ADDON_COMPAT.md b/docs/ADDON_COMPAT.md index a3cce568..97d5fe3b 100644 --- a/docs/ADDON_COMPAT.md +++ b/docs/ADDON_COMPAT.md @@ -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=-` 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