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,22 +1,16 @@
//! Per-handler cost attribution (decision 1395) — the instrument that answers *which* handler.
//!
//! These assert on **names, call counts, and the self/total relation**, never on a duration
//! (0735): "this handler cost 2 ms" is not a fact a test can own. The one relational assertion
//! (`self < total` under nesting) carries its own exact control — the same shape with nothing
//! nested inside it must report `self == total` to the last nanosecond, which is what proves the
//! difference came from the subtraction rather than from the clock.
//! Per-handler cost attribution. The tests assert names, call counts and the self/total relation,
//! never a duration; `self == total` with nothing nested is the control for `self < total`.
use super::common::script;
use crate::script::{HandlerRow, ScriptValue, UiScript};
/// The row for `frame:script`, or `None`.
fn row(rows: &[HandlerRow], frame: &str, script: &str) -> Option<HandlerRow> {
rows.iter()
.find(|r| r.frame == frame && r.script == script)
.cloned()
}
/// Recording, with no periodic report — the tests read the window directly.
/// Recording, with no periodic report: the tests read the window directly.
fn armed() -> UiScript {
let s = script();
s.profile_handlers(true, 0.0);
@@ -69,8 +63,7 @@ fn every_fired_handler_is_attributed_to_its_own_frame_and_script() {
#[test]
fn a_handler_with_nothing_nested_inside_it_is_all_self_time() {
// The control for the nesting test below: with no nested fire, the subtraction is by zero and
// the two numbers must be *identical*, not merely close.
// The control for the nesting test: nothing nested subtracts zero, so the two are identical.
let mut s = armed();
s.run(
r#"
@@ -122,14 +115,13 @@ fn a_handler_that_fires_another_is_not_charged_for_its_child() {
outer.self_us < outer.total_us,
"the child's cost must come off the parent's self time: {outer:#?}"
);
// And the nested row must be the one holding it — the whole point is naming Inner, not Outer.
assert!(
inner.self_us > 0.0,
"the child's own cost lands on the child: {inner:#?}"
);
// A second tick must behave like the first: a leaked stack level would start charging Outer's
// child time to a phantom parent and the relation above would quietly stop holding.
// A second tick behaves like the first: a leaked stack level would charge the child's time to
// a phantom parent.
s.tick(0.016);
let rows = s.handler_profile();
let outer = row(&rows, "Outer", "OnUpdate").expect("outer");
@@ -140,8 +132,7 @@ fn a_handler_that_fires_another_is_not_charged_for_its_child() {
#[test]
fn an_anonymous_frames_handler_is_labelled_by_where_it_was_written() {
// `CreateFrame("Frame")` + OnUpdate with no name is the addon timer idiom, so this is the
// common case, not the exotic one — and `#4127` would be an unusable row.
// An unnamed frame's OnUpdate is the addon timer idiom, and `#4127` would be a useless label.
let mut s = armed();
s.run(
r#"
@@ -164,9 +155,8 @@ fn an_anonymous_frames_handler_is_labelled_by_where_it_was_written() {
#[test]
fn an_unarmed_vm_records_nothing() {
// The off-state is the shipped state, so it gets a guard of its own: a VM that was never armed
// must report an empty profile even while another VM in this process is recording (the gate is
// process-wide, the state is per-VM — see `handler_prof::ARMED`).
// An unarmed VM records nothing while another records: the gate (`handler_prof::ARMED`) is
// process-wide, the state per VM.
let _recording = armed();
let mut s = script();
s.run(