From d9359a2d167bcfd83cfd62639c25c27b0108fcc7 Mon Sep 17 00:00:00 2001 From: Sam Sung <51686767+samwhosung@users.noreply.github.com> Date: Fri, 25 Sep 2026 15:07:45 +0700 Subject: [PATCH] Record numbers out of the headers benilla writes into players' files (#285) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of #92. The headers benilla writes at the top of a player's saved-variables files and chat cache carried a private record number, so every player's own files held one. They now say only what the file is. - The chat cache's repair marker is now `# benilla-writer 2`. The check is `contains`, so a file stamped with the longer marker still counts as repaired and is not re-seeded. - The other record numbers in these four files' literals go too: one log line and five assert messages. So does one test name, now `one_line_rows_without_addedversion_still_parse`. - Every change is to string-literal text, proven with comments stripped and every literal masked, except the renamed test. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 (1M context) --- crates/benilla-app/src/ui_chat/channels.rs | 2 +- crates/benilla-app/src/ui_chat/settings.rs | 13 +++++++------ crates/benilla-app/src/ui_saved.rs | 2 +- crates/benilla-app/src/ui_script/addons.rs | 12 ++++++------ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/crates/benilla-app/src/ui_chat/channels.rs b/crates/benilla-app/src/ui_chat/channels.rs index edb7388a..2e4f631c 100644 --- a/crates/benilla-app/src/ui_chat/channels.rs +++ b/crates/benilla-app/src/ui_chat/channels.rs @@ -620,7 +620,7 @@ mod tests { assert_eq!( channels.zone_mask, Some(SEED), - "the mask is the character's file, not the session's (2120)" + "the mask is the character's file, not the session's" ); assert!( cascade.observe_guild_id(7), diff --git a/crates/benilla-app/src/ui_chat/settings.rs b/crates/benilla-app/src/ui_chat/settings.rs index de620ed4..9286ae72 100644 --- a/crates/benilla-app/src/ui_chat/settings.rs +++ b/crates/benilla-app/src/ui_chat/settings.rs @@ -54,7 +54,7 @@ const SAVE_QUIET: std::time::Duration = std::time::Duration::from_secs(1); /// The file's header, as comment lines: the reference's reader has no comments, ours skips them. const HEADER: &str = "\ -# benilla chat cache (decisions 1589, 1948) — the reference's chat-cache.txt grammar (written by +# benilla chat cache, in the reference's chat-cache.txt grammar (written by # 0x499a80, read by 0x498a60): the custom channels to re-join, the joined zone channels as bits, the # per-type COLORS table, then one WINDOW block per chat frame — NAME (when one was set), SIZE, # COLOR r g b a as bytes, LOCKED, DOCKED, SHOWN, the MESSAGES … END list of the groups the window @@ -64,8 +64,9 @@ const HEADER: &str = "\ /// benilla's repair marker, a header comment line, not the reference's grammar. A file without it /// may hold `ZONECHANNELS 0` words from an empty roster, which strip window 1 of its channels; -/// [`restore_chat_looks`] re-seeds such a file once, and the next save stamps the marker. -const WRITER_GENERATION: &str = "# benilla-writer 2 (decision 2120)"; +/// [`restore_chat_looks`] re-seeds such a file once, and the next save stamps the marker. It is +/// matched with `contains`, so a marker line with more text after it still counts. +const WRITER_GENERATION: &str = "# benilla-writer 2"; /// Which character's file we are on, where it lives, and whether it is owed a write. #[derive(Resource, Default)] @@ -475,7 +476,7 @@ pub(crate) fn restore_chat_looks(world: &mut World, script: &mut UiScript) { parsed.zone_mask = Some(parsed.zone_mask.unwrap_or(0) | seed_mask); // Owed a write, which stamps the marker; it saves next frame (`last_change` is `None`). *file.dirty.get(script) = true; - info!("chat cache: repaired a pre-2120 file's zone channels for {who}"); + info!("chat cache: repaired an unmarked file's zone channels for {who}"); } } // The durable mask: the file's word, else the DBC seed; confirmed joins OR into it after. @@ -771,7 +772,7 @@ mod tests { assert_eq!( parsed.looks[0].1.channels, vec![("General".to_string(), 1), ("Trade".to_string(), 2)], - "window 1 keeps both channels — pre-2120 this came back empty and stayed empty" + "window 1 keeps both channels, where an unmarked file's came back empty" ); } @@ -883,7 +884,7 @@ mod tests { /// benilla's older one-line rows (no `ADDEDVERSION`), with the back-fill into window 2. #[test] - fn the_pre_1948_one_line_rows_still_parse() { + fn one_line_rows_without_addedversion_still_parse() { let got = parse( "window 1 size 16 color 10 20 30 40\n\ WINDOW 2 SHOWN 0 COLOR 1 2 3 4 DOCKED 2 BOGUS 9\n\ diff --git a/crates/benilla-app/src/ui_saved.rs b/crates/benilla-app/src/ui_saved.rs index dcf5c1bd..d5388072 100644 --- a/crates/benilla-app/src/ui_saved.rs +++ b/crates/benilla-app/src/ui_saved.rs @@ -95,7 +95,7 @@ pub(crate) fn save(script: &mut UiScript) { /// Deviation: a header saying what the file is, because the folder is in plain view; the /// reference's file opens with a bare blank line. const HEADER: &str = "\ --- benilla saved variables (decision 1128) — the UI's own remembered settings. +-- benilla saved variables: the UI's own remembered settings. -- Written at logout/exit from the live values; executed as a Lua chunk at UI load. "; diff --git a/crates/benilla-app/src/ui_script/addons.rs b/crates/benilla-app/src/ui_script/addons.rs index 318952d4..e0c94cfa 100644 --- a/crates/benilla-app/src/ui_script/addons.rs +++ b/crates/benilla-app/src/ui_script/addons.rs @@ -697,7 +697,7 @@ pub(super) fn save_addon_variables(script: &mut UiScript, identity: Option<&(Str /// The per-addon file's header. Deviation: the reference writes none (its file opens with a blank /// line); ours names the file, because players open this folder. const SAVED_HEADER: &str = "\ --- benilla per-addon saved variables (decision 1188 phase 3). +-- benilla per-addon saved variables. -- Written at logout/exit from the live globals; executed as a Lua chunk at addon load. "; @@ -1163,7 +1163,7 @@ mod tests { .read(&join_ref(src, "..\\..\\ProbeLib\\core\\lib.xml")) .as_deref(), Some(&b"sibling"[..]), - "a shared library addon must be reachable — this is what 1184 wrongly blocked" + "a shared library addon must be reachable from the addon that includes it" ); // Above the AddOns root touches no file: the collapsed path leaves `Interface/AddOns/` and @@ -1381,14 +1381,14 @@ mod tests { assert_eq!( script.eval::("return ProbeAddonInclude == true").ok(), Some(true), - "a bare-name resolved against the INCLUDING FILE's directory (src/), not \ - the addon root — Bagnon's `templates.xml` missed entirely before 1186" + "a bare-name resolves against the including file's directory (src/), not \ + the addon root, which is where Bagnon's `templates.xml` is found" ); assert_eq!( script.eval::("return ProbeLibLoaded == true").ok(), Some(true), - "`..\\..\\ProbeLib\\core\\lib.xml` reached a SIBLING addon — the shared-library \ - pattern 1184's per-addon sandbox blocked" + "`..\\..\\ProbeLib\\core\\lib.xml` reaches a sibling addon, the shared-library \ + pattern a per-addon sandbox would block" ); assert_eq!( script.eval::("return ProbeLibDeep == true").ok(),