fix(ui): OP5 review fixes — thumb sync, batched opacity writes, cull register row, tests

Fixes the OP5 (Chat tab) dual-lens review findings against e71e5a96:

- M1 (MUST-FIX): each opacity row's own apply closure now pushes its OWN
  slider's thumb from the post-link truth (bindings.Current*Opacity()),
  mirroring the OP4 binding pattern. Before this, a single-slider drag
  followed by Reset reverted the live value/link but left that slider's
  own thumb stuck at the dragged position.

- S1 (SHOULD-FIX): the Chat tab's two opacity sliders no longer round-trip
  the whole settings.json on every drag MouseMove tick. UiScrollbar gains
  IsDragging + a DragCompleted callback (fires once, at the MouseUp that
  ends an actual thumb drag); the opacity apply closures flush immediately
  when not mid-drag (Reset/Defaults/discrete edits, same as before) and
  defer to DragCompleted otherwise, collapsing dozens of per-tick writes
  into exactly one per drag gesture. Live opacity still applies every tick.

- S2 (SHOULD-FIX): filed register row AP-201 and issue #371 for the
  UiScrollablePanel whole-row-cull-vs-clip divergence the review found
  (predates OP5, made user-visible by OP5's 240-260px filter blocks). Not
  fixed in this round (a renderer-level scissor stack is out of scope
  here) — corrected the OP5 connected-gate script instead so a straddling
  block's disappear-then-reappear-whole is no longer reported as a
  self-sizing regression.

- S3 (SHOULD-FIX): the chatWindowMainFilter round-trip test already
  existed in e71e5a96 (the review missed it scrolling past line 330);
  added the genuinely missing coverage instead — a composed test pinning
  RetailUiRuntime.MountChat's window-0 SettingsStore -> ChatWindowState
  seed (MountChat itself needs live DAT access and isn't unit-testable
  directly).

- N11: ScrollbarLinkage_ModelPointsAtTheChatListBoxScroll now asserts
  through the scoped page-slot lookup (UiElement.FindDescendant) instead
  of the flat layout.FindElement, which passed for the wrong reason given
  the shared scrollbar id 0x10000201 — matches OP6's own scrollbar-linkage
  test pattern.

Also updated ConfigOptionsPageControllerTests' local ChatOptionsPageController
Bindings fake for the new FlushOpacity parameter.

Full Release suite: 13,117 passed / 4 skipped / 0 failed (baseline 13,107/4/0
post-OP6 — 10 tests added, zero skips added, zero failures).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-11 07:36:54 +02:00
parent e318e8628d
commit 6d0b0f9285
10 changed files with 501 additions and 20 deletions

View file

@ -701,9 +701,18 @@ public sealed class RetailUiRuntime : IDisposable
/// Campaign OP slice OP5: persists the Chat tab's two opacity-slider values —
/// the "worth tightening to auto-save-on-change" gap
/// <see cref="SaveChatWindowFilters"/>'s own doc flagged before a live options UI
/// existed to edit them. Called from the Chat tab's slider apply closures, so
/// every drag tick is captured (matching the filter blocks' own auto-save-on-
/// change wiring below, not the old "only on /saveautoui" schedule).
/// existed to edit them.
/// <para>
/// OP5 review fix S1 (2026-08-11): this is now the BATCHED settle point, not a
/// per-tick write. <see cref="Layout.ChatOptionsPageController.Bindings.SetDefaultOpacity"/>/
/// <c>SetActiveOpacity</c> below apply the value LIVE only; this method is wired as
/// <c>FlushOpacity</c> and is called by the controller exactly once per discrete
/// edit — a Reset/Defaults click, or a drag's own <c>MouseUp</c> — never once per
/// <c>MouseMove</c> tick. Previously this ran a full <c>settings.json</c> load +
/// rewrite on every drag tick (dozens-to-hundreds of synchronous whole-file round
/// trips on the UI thread for one drag); retail's own structure batches the
/// equivalent blob behind a dirty timer (research doc §3.5).
/// </para>
/// </summary>
private void SaveChatOpacity()
{
@ -2120,16 +2129,11 @@ public sealed class RetailUiRuntime : IDisposable
new Layout.ChatOptionsPageController.Bindings(
CurrentDefaultOpacity: () => WindowOpacity.DefaultOpacity,
CurrentActiveOpacity: () => WindowOpacity.ActiveOpacity,
SetDefaultOpacity: value =>
{
WindowOpacity.SetDefaultOpacity(value);
SaveChatOpacity();
},
SetActiveOpacity: value =>
{
WindowOpacity.SetActiveOpacity(value);
SaveChatOpacity();
},
// S1 fix: live apply ONLY — no disk write per call. The controller
// calls FlushOpacity (below) once per discrete edit, not once per tick.
SetDefaultOpacity: WindowOpacity.SetDefaultOpacity,
SetActiveOpacity: WindowOpacity.SetActiveOpacity,
FlushOpacity: SaveChatOpacity,
DefaultOpacityDatDefault: datDefaultOpacity,
ActiveOpacityDatDefault: datActiveOpacity,
CurrentFilter: windowId => _bindings.Chat.Windows.GetFilter(windowId),