fix(ui,runtime): OP4 re-review residuals R1-R4 (coordinator pass) — OP4 CLOSED

R1: the timestamp prefix moves from ChatLog.Append (which stamped the
stored BODY, rendering 'Alice says, "13:05:09 hi"') to ChatVM's display
composition — FormatTimestampPrefix(entry.Received) prepends the COMPOSED
line, matching retail's separate-leading-string model (fprintf("%ls%ls",
ts, text) @0x00563e5b; AddTextToScroll receives composed lines). The
prefix renders entry.Received in LOCAL time (retail strftime), invariant
literal colons. The ten defect-pinning test cases across
ChatLogTests/RuntimeCommunicationStateTests are rewritten to pin the
corrected contract (stored bodies stay clean; the composed line carries
the stamp outside the quotes — ChatVMTests).

R2: open option-bearing panels converge on every PlayerDescription seed:
OptionPage.ReloadFromLive (per-row live re-read + gating re-eval, NO
AfterApply flush — the seed just cleared the dirty module),
OptionsPanelController.OnServerOptionsSeeded (active page),
CombatUiController.OnServerOptionsSeeded (SyncControls), wired through
RuntimeSettingsController.ServerOptionsSeeded from the same factory hook
LockUI already uses. Retail cannot reach this state (its panels close
across login); the adaptation exists because retained panels survive the
session boundary — documented at the seam.

R3: tests drive the refresh widget push (model AND checkbox converge) and
ReloadFromLive's no-flush contract. R4: AP-196 addendum names the
headless AutoRepeatAttack false->true effective-default flip and the
characterOptions escape hatch.

Full Release suite: 13,083 passed / 4 skipped / 0 failed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-11 06:36:14 +02:00
parent e71e5a9614
commit ac0304dcf0
13 changed files with 216 additions and 114 deletions

View file

@ -267,65 +267,36 @@ public sealed class RuntimeCommunicationStateTests
}
[Fact]
public void AddText_TimestampsTrue_PrefixesTranscriptLine()
public void AddText_TimestampsTrue_StoredBodyStaysClean()
{
// OP4 re-review R1 (2026-08-11): the prefix belongs to the DISPLAY
// composition (ChatVM prepends FormatTimestampPrefix(entry.Received)
// to the COMPOSED line — retail fprintf("%ls%ls", ts, text)
// @0x00563e5b), never to the stored body. The earlier fix round
// prefixed entry.Text here, which put the stamp INSIDE the quotes of
// composed kinds ('Alice says, "13:05:09 hi"').
using var state = new RuntimeCommunicationState { DisplayTimestampsSource = () => true };
state.AddText("Your spell fizzled.", RetailLogTextType.Default);
string text = state.Chat.Snapshot()[0].Text;
Assert.EndsWith("Your spell fizzled.", text);
Assert.NotEqual("Your spell fizzled.", text);
// Retail ctor default format "%#H:%M:%S " (non-zero-padded 24h
// hour, zero-padded minute:second, trailing space before the
// text) — .NET "H\:mm\:ss " (colons ESCAPED, not the
// culture-dependent TimeSeparator placeholder) is the exact
// equivalent (SF-1/S4, OP4 review-fix round, 2026-08-11).
Assert.Matches(@"^\d{1,2}:\d{2}:\d{2} Your spell fizzled\.$", text);
Assert.Equal("Your spell fizzled.", state.Chat.Snapshot()[0].Text);
}
[Fact]
public void AddText_TimestampsTrue_UsesLiteralColons_RegardlessOfCurrentCulture()
public void DisplayTimestampsSource_ForwardsToChat_SoTheDisplaySeamSeesOneSource()
{
// SF-1/S4 (OP4 review-fix round, 2026-08-11): an unescaped "H:mm:ss"
// format string renders ':' as CurrentCulture.DateTimeFormat.
// TimeSeparator, which is NOT ':' on cultures like fi-FI ("."). The
// fix escapes the colons and forces InvariantCulture — prove the
// output stays colon-separated even under a culture that would
// otherwise substitute a different separator.
CultureInfo original = Thread.CurrentThread.CurrentCulture;
try
{
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fi-FI");
using var state = new RuntimeCommunicationState { DisplayTimestampsSource = () => true };
state.AddText("Your spell fizzled.", RetailLogTextType.Default);
string text = state.Chat.Snapshot()[0].Text;
Assert.Matches(@"^\d{1,2}:\d{2}:\d{2} Your spell fizzled\.$", text);
}
finally
{
Thread.CurrentThread.CurrentCulture = original;
}
}
[Fact]
public void DisplayTimestampsSource_ForwardsToChat_TimestampingEveryProducer_NotJustAddText()
{
// S1 (OP4 review-fix round, 2026-08-11, blast lens): AddText's own
// callers (ServerMessage/WeenieError) were a strict SUBSET of
// every chat producer — heard speech, emotes, Turbine channels,
// and combat text all bypassed it by calling ChatLog's own OnXxx
// methods directly. Setting DisplayTimestampsSource on this class
// must timestamp lines that never go through AddText at all.
// R1: this class still owns the ONE forwarding seam — ChatVM reads
// ChatLog.DisplayTimestampsSource at display composition, so setting
// it HERE must reach the log's property (every producer's entries
// then render prefixed, ChatVMTests pins the composed-line shape).
using var state = new RuntimeCommunicationState { DisplayTimestampsSource = () => true };
state.Chat.OnLocalSpeech("Alice", "hi", 0xAAu, isRanged: false, logTextType: 0x02u);
Assert.NotNull(state.Chat.DisplayTimestampsSource);
Assert.True(state.Chat.DisplayTimestampsSource!());
string text = state.Chat.Snapshot()[0].Text;
Assert.EndsWith("hi", text);
Assert.Matches(@"^\d{1,2}:\d{2}:\d{2} hi$", text);
// And the stored body of a non-AddText producer stays clean too.
state.Chat.OnLocalSpeech("Alice", "hi", 0xAAu, isRanged: false, logTextType: 0x02u);
Assert.Equal("hi", state.Chat.Snapshot()[0].Text);
}
[Fact]