From 40cbec55cd16b04ffb257cda25fa573bc9065a08 Mon Sep 17 00:00:00 2001 From: grom Date: Thu, 29 Oct 2026 15:35:15 -0600 Subject: [PATCH] The hardcoded-sentence gate failed on its own corpus read, not on a violation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `reference_strings` demanded a sentence from each of the four string sources, because the two `Localize()` files wrap their assignments in a function and that shape has to be proven to parse. This realm's `GlueXML\GlueLocalization.lua` has its whole `Localize()` body commented out and tweaks frames instead, so the assertion fired on a chain where nothing is wrong — and took the policy half of the test, the part that actually reads every Rust source for a sentence the reference ships, down with it. Asserted over the pair now: a base table can never be empty, and at least one `Localize()` file must yield, which `FrameXML\Localization.lua`'s enGB overrides do. The policy half runs again and passes, so nothing is hardcoded. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01SgstFWtn1RxEJ5kVrpgYwn --- crates/benilla-app/tests/reference_strings.rs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/crates/benilla-app/tests/reference_strings.rs b/crates/benilla-app/tests/reference_strings.rs index f122e015..38b16487 100644 --- a/crates/benilla-app/tests/reference_strings.rs +++ b/crates/benilla-app/tests/reference_strings.rs @@ -144,6 +144,13 @@ fn no_user_facing_sentence_is_written_in_rust_when_the_reference_ships_one() { let mut shipped: HashMap> = HashMap::new(); // The base tables and the locale patches: where `Localize()` redefines a key, its wording is // the one the player reads. + // Whether either `Localize()` file yielded anything, which is what proves the wrapper shape + // still parses. Asserted over the pair rather than per file: this realm's + // `GlueXML\GlueLocalization.lua` has its whole `Localize()` body commented out and tweaks + // frames instead, so demanding a sentence of *that* file failed the gate on a chain where + // nothing is wrong. `FrameXML\Localization.lua` carries the enGB overrides and still proves + // the shape. + let mut wrapped_yielded = false; for file in [ "Interface\\FrameXML\\GlobalStrings.lua", "Interface\\FrameXML\\Localization.lua", @@ -165,10 +172,19 @@ fn no_user_facing_sentence_is_written_in_rust_when_the_reference_ships_one() { taken += 1; } } - // Every source must contribute: the `Localize()` files wrap their assignments in a - // function, a shape the base tables never have. - assert!(taken > 0, "{file} contributed no sentences"); + // A base table can never be empty; a `Localize()` patch can be, and this chain's Glue one + // is. + if file.ends_with("Localization.lua") { + wrapped_yielded |= taken > 0; + } else { + assert!(taken > 0, "{file} contributed no sentences"); + } } + assert!( + wrapped_yielded, + "neither Localize() file contributed a sentence — the wrapper shape stopped parsing, and \ + a locale override is the wording the player actually reads" + ); let mut sources = Vec::new(); walk(Path::new("src"), &mut sources);