Comments in benilla-ui: one line of fact each, no history, no record numbers (#143)

Part of #41: the comments of `benilla-ui` (the Lua UI engine, its FrameXML loader and its widgets) are rewritten to the rule in `docs/METHOD.md`, which is what the code does and the reference fact behind it, in a line. 43,140 comment lines become 15,161.

- **The mechanical strip.** The citations that were only a private record number go first, and each edit is shown to be a pure removal.
- **Wrong facts corrected.** The rewrite corrects the comments that stated wrong facts. Among them:
  - `0x64a480` is the case-sensitive compare (a byte `repz cmpsb`), and `0x64a4c0` the case-insensitive one.
  - A frame's id sits at `+0xb0`, not `+0xb4`. `EnableKeyboard`/`IsKeyboardEnabled` are `0x776ec0`/`0x776f90`.
  - A region's unpinned edge has no fallback to its owner's rect: the owner supplies only the scale.
  - `$parent` expands to the nearest named ancestor, or "Top" when none is named (`0x76c5b0`), not simply to the parent.
  - A StatusBar fills from its internal normalised fraction, not from `GetValue()`.
  - The addresses of `StartDuel` and `StartDuelUnit` were swapped.
  - Many "untraced" notes now give the traced reference fact: the drag threshold, the per-grip sizing edges, the empty-`autoFocus` skip, and `SetTexCoordModifiesRect`'s default.
  - Stock FrameXML line citations are checked against the stock 1.12 files and corrected. `ref-` file names become the stock file names.
- **Deviation labels.** "Deviation:" now marks only a choice with a reason. A surface that exists only for the retired Era addon target says so plainly: it is not 1.12.
- **Verification.** Every file strips to identical code, and `cargo fmt --check` is clean. Nine second readers compared every file old against new, restored the facts the rewrite had dropped, and checked each new citation against the code, the stock files, vmangos and the reference.

Behaviour differences the rewrite surfaced are filed as their own issues (#131–#142), and more are being validated. The comments here state what the code does. String literals are untouched; they are #92.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sam Sung
2026-09-25 01:58:49 +07:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 8505187668
commit fd386e75ae
233 changed files with 14108 additions and 42094 deletions
@@ -1,32 +1,9 @@
//! **Shape C, closed as a CLASS**: every shape-C numeric position must take a `nil` — or a
//! table, or a string — as **0.0** and complete, because the reference reads it with a bare
//! `lua_tonumber 0x6f3620` and no `lua_isnumber` gate at all.
//!
//! This is one test and not six because which shape a given argument takes is per binding, not a
//! global law: the reference's 408 widget-registrar positions (110 gated, 64 ungated) are a table a
//! re-implementation is checked against, not an instinct. Our half of that table had drifted: 1973
//! closed `SetTextColor` and left every sibling strict, so mlua's converter went on being the gate
//! for five more years' worth of call sites.
//!
//! The live symptom that forced the audit: stock `QuestLogFrame.lua:337` does
//! `QuestLogSkillHighlight:SetVertexColor(titleButton.r, titleButton.g, titleButton.b)`, and those
//! three fields are only ever assigned in `QuestLog_Update` — so **any** path that selects a
//! quest-log entry before the window has painted hands `SetVertexColor` three nils. Questie's
//! `syncQuestWatch` (`QuestieTracker.lua:1160`) is exactly such a path: it calls
//! `QuestLog_SetSelection` first. On the reference that is a no-op that stores black; for us it
//! raised, and because the raise happened inside Questie's own event-queue drain — which nils an
//! entry only *after* its handler returns — the queue jammed at that entry permanently. Every
//! later entry (`SYNCLOG`, `DRAWNOTES`, `TRACKER`) was stranded for the rest of the session, which
//! is why the minimap button's right-click could turn the quest icons OFF (a direct call) but
//! never back ON (a `DRAWNOTES` enqueue).
//!
//! **Shape B is not shape C and is not tested here.** The alpha slot of every colour setter is B —
//! a pre-staged default, `1.0f` at `0x778220` — so its absence is a *default*, not a zero, and
//! `SetVertexColor`'s own B-slot carries a separate, deliberately-open divergence (1782).
//! Shape C: a numeric position the reference reads with a bare `lua_tonumber` (`0x6f3620`) and no
//! `lua_isnumber` gate, so nil, a table or a string is 0.0 and the call completes. Shape B, not
//! tested here, is a pre-staged default, such as every colour setter's alpha (1.0 at `0x778220`).
use super::common::script;
/// Each row: the Lua that must not raise, and what a reader must say afterwards.
#[test]
fn every_shape_c_colour_position_takes_nil_as_zero_and_never_raises() {
let s = script();
@@ -41,7 +18,7 @@ fn every_shape_c_colour_position_takes_nil_as_zero_and_never_raises() {
)
.unwrap();
// `Texture:SetVertexColor 0x79abd0` — `2=C 3=C 4=C`. The QuestLogFrame.lua:337 shape verbatim.
// `Texture:SetVertexColor 0x79abd0` (`2=C 3=C 4=C`), as stock `QuestLogFrame.lua:337` calls it.
s.run("T:SetVertexColor(nil, nil, nil)")
.expect("SetVertexColor(nil,nil,nil) is three bare lua_tonumbers, not a raise");
s.run(
@@ -51,11 +28,11 @@ fn every_shape_c_colour_position_takes_nil_as_zero_and_never_raises() {
"#,
)
.unwrap();
// A table and a string are the same 0.0 — `lua_tonumber` tests nothing.
// A table and a string are 0.0 too: `lua_tonumber` tests nothing.
s.run("T:SetVertexColor({}, \"abc\", true)")
.expect("no tag is rejected at a shape-C position");
// `Texture:SetTexCoord 0x79beb0` — every coordinate C; only the ARITY raises.
// `Texture:SetTexCoord 0x79beb0`: every coordinate C; only the arity raises.
s.run("T:SetTexCoord(nil, nil, nil, nil)")
.expect("four nil coordinates are four zeroes");
s.run("T:SetTexCoord(0, 1, 0, 1, 0, 1, 0, 1)")
@@ -76,18 +53,17 @@ fn every_shape_c_colour_position_takes_nil_as_zero_and_never_raises() {
)
.unwrap();
// `ColorSelect:SetColorRGB 0x78eae0` — C on all three, and it fires OnColorSelect either way.
// `ColorSelect:SetColorRGB 0x78eae0`: C on all three; it fires OnColorSelect either way.
s.run("CS:SetColorRGB(nil, nil, nil)")
.expect("ColorSelect:SetColorRGB is shape C on r/g/b");
// `Texture:SetGradient 0x79ae30` / `SetGradientAlpha 0x79b180` — already C before this pass;
// pinned so they cannot regress into the family's old strictness.
// `Texture:SetGradient 0x79ae30` and `SetGradientAlpha 0x79b180`.
s.run("T:SetGradient(\"HORIZONTAL\", nil, nil, nil, nil, nil, nil)")
.expect("SetGradient's six stops are all C");
s.run("T:SetGradientAlpha(\"VERTICAL\", nil, nil, nil, nil, nil, nil, nil, nil)")
.expect("SetGradientAlpha's eight are C/B");
// `FontString:SetTextColor 0x79d9c0` — closed by 1973; pinned here so the class stays closed.
// `FontString:SetTextColor 0x79d9c0`.
s.run("FS:SetTextColor(nil, nil, nil)")
.expect("the sibling 1973 already fixed");
}