fix(chat): CH3 review fixes — phantom UN-9, allegiance-broadcast echo, /a legacy fallback
Applies the Opus review of Campaign CH slice CH3 (614a1e05):
- B1: UN-9 was a phantom divergence — ACE's CharacterOptions1.cs:47
OR-sum is 0x50C4A54A (its own comment confirms 1355064650), identical
to acdream's literal. The wrong 0x50C48D4A existed only in the research
doc. Row deleted, register §5 reverted to 4 rows, research doc corrected
with dated notes.
- S1/S4: AllegianceBroadcast (0x02000000) is a server-echoing channel —
ACE's GameActionChatChannel handler includes the sender in its real-name
Allegiance.Members broadcast (retail's DoAllegianceBroadcast has no
AddTextToScroll), so the client must skip its local optimistic echo, not
keep it. ChatChannelInfo.Legacy.IsSelfEchoChannel() now returns true for
it; RouteLegacyChannel's comment corrected; Turbine.IsSelfEchoChannel()'s
backwards comment rewritten truthfully.
- S3: retail's /a stays on the legacy AllegianceBroadcast bitflag until
StartupTurbineChatSystem successfully starts Turbine chat — "never
started" (TurbineChatState.Enabled == false) now falls back to legacy in
both LiveSessionCommandRouter.RouteChat and
DirectGameRuntimeCommandAdapter.TrySendChannel, while "enabled but no
allegiance room" still correctly refuses locally.
- S5: added a LiveSessionEventRouter test proving the Options.Replace ->
OnCharacterOptionsChanged seeding order, and RuntimeSettingsTargets /
GameWindowLiveSessionOwnershipTests tests proving the concrete
ICommandBus.Publish wiring and the single LiveSessionCommandSurface
construction site.
- S6: AP-181 rewritten to name both of retail's omitted pre-send checks
(IsMessageSafe silent-drop, then IsMessageSpam) and stop misattributing
either to RouteLegacyChannel, which has no such gates.
- N1-N7: CharacterOptionId moved below SocialActions so its doc comment
re-attaches; TurbineChatMembershipGate reuses TurbineChatDisplayNames
instead of a duplicate table; the gate-to-refusal-text mapping is now
shared via TurbineChatMembershipGate.ResolveRefusalText instead of
duplicated in both hosts; ChatSettings.Default now matches ACE's real
CharacterOptions2.Default (Roleplay/Society start off); a doc-comment
clarifies only the five Hear toggles are server-backed; the register's
§3 header recounted 129 -> 128.
Suite: 11,964 passed / 4 skipped / 0 failed (baseline 11,957/4/0 + 7 new
tests). Campaign ledger CH3 review column updated to APPROVE-WITH-FIXES.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
d3f1c21835
commit
e07fba5731
21 changed files with 582 additions and 153 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using AcDream.App.Diagnostics;
|
||||
using AcDream.App.Net;
|
||||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Settings;
|
||||
using AcDream.Core.Net.Messages;
|
||||
|
|
@ -243,6 +244,33 @@ public sealed class RuntimeSettingsControllerTests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ConcreteRuntimeTargetPublishesSetSingleCharacterOptionOntoTheBus()
|
||||
{
|
||||
// CH3 review S5(b): SaveChatPublishesSetSingleCharacterOption... above
|
||||
// only proves RuntimeSettingsController calls the IRuntimeSettingsTargets
|
||||
// INTERFACE (via the FakeRuntimeTargets test double) — nothing exercised
|
||||
// the CONCRETE RuntimeSettingsTargets.SetSingleCharacterOption, which is
|
||||
// the code that actually reaches the wire via ICommandBus.Publish. A
|
||||
// silent unwiring there (wrong record, wrong bus, dropped call) would
|
||||
// pass every test that only goes through the fake.
|
||||
var bus = new CaptureCommandBus();
|
||||
var target = new RuntimeSettingsTargets(
|
||||
new InspectingDisplayWindowTarget(static _ => { }),
|
||||
new RecordingQualityApplicationTarget([]),
|
||||
new RecordingUiLockTarget([]),
|
||||
bus,
|
||||
static _ => { });
|
||||
|
||||
target.SetSingleCharacterOption(
|
||||
(uint)CharacterOptionId.ListenToRoleplayChat, value: false);
|
||||
|
||||
var cmd = Assert.IsType<SetSingleCharacterOptionRuntimeCmd>(
|
||||
Assert.Single(bus.Published));
|
||||
Assert.Equal((uint)CharacterOptionId.ListenToRoleplayChat, cmd.OptionId);
|
||||
Assert.False(cmd.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SettingsViewModelSavePreservesSectionAndTargetOrder()
|
||||
{
|
||||
|
|
@ -314,28 +342,30 @@ public sealed class RuntimeSettingsControllerTests
|
|||
dispatcher,
|
||||
static _ => { });
|
||||
|
||||
// ChatSettings.Default starts every Hear*Chat bit true — flip one
|
||||
// off first so the second edit below can flip it back on.
|
||||
Assert.True(viewModel.ChatDraft.HearRoleplayChat);
|
||||
viewModel.SetChat(viewModel.ChatDraft with { HearRoleplayChat = false });
|
||||
// N4 (CH3 Opus review): ChatSettings.Default now matches ACE's real
|
||||
// CharacterOptions2.Default — Roleplay/Society start FALSE (only
|
||||
// General/Trade/LFG start true). Flip Roleplay ON first so the
|
||||
// second edit below can flip it back off.
|
||||
Assert.False(viewModel.ChatDraft.HearRoleplayChat);
|
||||
viewModel.SetChat(viewModel.ChatDraft with { HearRoleplayChat = true });
|
||||
viewModel.Save();
|
||||
|
||||
Assert.Equal(
|
||||
[((uint)CharacterOptionId.ListenToRoleplayChat, false)],
|
||||
[((uint)CharacterOptionId.ListenToRoleplayChat, true)],
|
||||
targets.SingleOptionCalls);
|
||||
|
||||
targets.SingleOptionCalls.Clear();
|
||||
viewModel.SetChat(viewModel.ChatDraft with
|
||||
{
|
||||
HearRoleplayChat = true,
|
||||
HearSocietyChat = false,
|
||||
HearRoleplayChat = false,
|
||||
HearSocietyChat = true,
|
||||
});
|
||||
viewModel.Save();
|
||||
|
||||
Assert.Equal(
|
||||
[
|
||||
((uint)CharacterOptionId.ListenToRoleplayChat, true),
|
||||
((uint)CharacterOptionId.ListenToSocietyChat, false),
|
||||
((uint)CharacterOptionId.ListenToRoleplayChat, false),
|
||||
((uint)CharacterOptionId.ListenToSocietyChat, true),
|
||||
],
|
||||
targets.SingleOptionCalls);
|
||||
}
|
||||
|
|
@ -363,9 +393,20 @@ public sealed class RuntimeSettingsControllerTests
|
|||
public void SyncChatFromServerOptionsReseedsPersistedAndDraft()
|
||||
{
|
||||
// Research doc §5.2: ACE's CharacterOptions2.Default omits
|
||||
// HearRoleplayChat/HearSocietyChat even though acdream's local
|
||||
// ChatSettings.Default claims both are on.
|
||||
var storage = new FakeStorage();
|
||||
// HearRoleplayChat/HearSocietyChat. N4 (CH3 Opus review) aligned
|
||||
// ChatSettings.Default to that same stance, so this test now seeds
|
||||
// storage with an explicitly stale PERSISTED value (both on — e.g.
|
||||
// a save from before N4, or a user who had enabled them) to prove
|
||||
// the server sync corrects local state to the server's truth,
|
||||
// rather than merely observing the two already agree.
|
||||
var storage = new FakeStorage
|
||||
{
|
||||
ChatValue = ChatSettings.Default with
|
||||
{
|
||||
HearRoleplayChat = true,
|
||||
HearSocietyChat = true,
|
||||
},
|
||||
};
|
||||
var controller = new RuntimeSettingsController(
|
||||
storage,
|
||||
static preset => QualitySettings.From(preset),
|
||||
|
|
@ -417,17 +458,16 @@ public sealed class RuntimeSettingsControllerTests
|
|||
static _ => { });
|
||||
storage.ClearEvents();
|
||||
|
||||
// ChatSettings.Default already has all five Hear*Chat bits on —
|
||||
// options2 with only those five bits set (any other bits are
|
||||
// irrelevant, the sync only masks these) reproduces exactly that,
|
||||
// so the sync must be a true no-op.
|
||||
const uint allFiveHearBitsOn =
|
||||
// N4 (CH3 Opus review): ChatSettings.Default now matches ACE's real
|
||||
// CharacterOptions2.Default exactly — General/Trade/LFG on,
|
||||
// Roleplay/Society off. Syncing with that SAME bit pattern (any
|
||||
// other bits are irrelevant, the sync only masks these five) must
|
||||
// be a true no-op.
|
||||
const uint aceDefaultHearBits =
|
||||
(uint)PlayerDescriptionParser.CharacterOptions2.HearGeneralChat
|
||||
| (uint)PlayerDescriptionParser.CharacterOptions2.HearTradeChat
|
||||
| (uint)PlayerDescriptionParser.CharacterOptions2.HearLFGChat
|
||||
| (uint)PlayerDescriptionParser.CharacterOptions2.HearRoleplayChat
|
||||
| (uint)PlayerDescriptionParser.CharacterOptions2.HearSocietyChat;
|
||||
controller.SyncChatFromServerOptions(allFiveHearBitsOn);
|
||||
| (uint)PlayerDescriptionParser.CharacterOptions2.HearLFGChat;
|
||||
controller.SyncChatFromServerOptions(aceDefaultHearBits);
|
||||
|
||||
Assert.Equal(0, storage.ChatSaves);
|
||||
}
|
||||
|
|
@ -1061,6 +1101,17 @@ public sealed class RuntimeSettingsControllerTests
|
|||
}
|
||||
}
|
||||
|
||||
// CH3 review S5(b): records every ICommandBus.Publish call so a test can
|
||||
// assert what the CONCRETE RuntimeSettingsTargets actually put on the
|
||||
// bus, rather than only what the IRuntimeSettingsTargets fake recorded.
|
||||
private sealed class CaptureCommandBus : ICommandBus
|
||||
{
|
||||
public readonly List<object> Published = new();
|
||||
|
||||
public void Publish<T>(T command) where T : notnull =>
|
||||
Published.Add(command!);
|
||||
}
|
||||
|
||||
private sealed class InspectingDisplayWindowTarget(
|
||||
Action<DisplaySettings> apply)
|
||||
: IRuntimeDisplayWindowTarget
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue