fix #363: route plugin system text to the chat window, not SpewBox
Owner direction 2026-09-07 (same instruction as the sibling unknown- command fix, previous commit): plugin-originated text must land in the chat window instead of retail's ClientLocal (0x1A) SpewBox-only channel. AppAutomationSurface.PostSystemMessage -- the production implementation of IPluginChat.PostSystemMessage that MossTank/VTank- style plugins call -- now passes RetailLogTextType.Default instead of ClientLocal to RuntimeCommunicationState.AddText, so the text reaches the chat transcript via Chat.OnSystemMessage instead of the SpewBox. This matches Decal's own AddChatText behavior for plugin output. IPluginChat.PostSystemMessage's doc comment is updated to describe the new destination instead of the old one. Register row AD-124 (previous commit) already covers this site alongside the sibling unknown-command change. Mutation check: temporarily reverted PostSystemMessage's AddText call back to ClientLocal and confirmed the new AppAutomationSurfaceTests.PostSystemMessage_RoutesToChatLog_NeverSpewBox test fails (Assert.Single() on an empty chat log) before restoring the fix. Also adds ChatVMTests.RecentLines_ShowsPluginSystemMessage_TaggedDefault pinning that a ChatVM bound to the same ChatLog surfaces the line. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
6b7b4bb213
commit
2b65217d29
4 changed files with 77 additions and 7 deletions
|
|
@ -146,6 +146,31 @@ public sealed class AppAutomationSurfaceTests
|
|||
Assert.Equal(0, second.CommunicationOwner.SubscriberCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Owner-directed override 2026-09-07 (register row AD-124): plugin
|
||||
/// output ("Unknown commands like /vt or stuff from plugins ... should
|
||||
/// go to the chatbox") must land in the chat log, never the transient
|
||||
/// SpewBox overlay retail's own ClientLocal (0x1A) typing used to send
|
||||
/// it to — the same VTank-faithful destination Decal's own
|
||||
/// <c>AddChatText</c> uses.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void PostSystemMessage_RoutesToChatLog_NeverSpewBox()
|
||||
{
|
||||
using var runtime = GameRuntimeTestFactory.Create();
|
||||
using var surface = new AppAutomationSurface();
|
||||
surface.Bind(runtime, runtime.CharacterOwner, runtime.ActionOwner.SpellCast);
|
||||
|
||||
surface.PostSystemMessage("MossTank: buffs applied.");
|
||||
|
||||
var entry = Assert.Single(runtime.CommunicationOwner.Chat.Snapshot());
|
||||
Assert.Equal("MossTank: buffs applied.", entry.Text);
|
||||
Assert.Equal((uint)RetailLogTextType.Default, entry.LogTextType);
|
||||
|
||||
runtime.CommunicationOwner.SpewBox.Tick(0d);
|
||||
Assert.Equal(0, runtime.CommunicationOwner.SpewBox.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InventoryCompletionProjectsTheCanonicalRequestReceipt()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -194,4 +194,36 @@ public sealed class ChatVMTests
|
|||
// The stored body never carries the stamp in either state.
|
||||
Assert.Equal("hi", log.Snapshot()[0].Text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Owner-directed override 2026-09-07 (register row AD-124): plugin
|
||||
/// output (<c>AppAutomationSurface.PostSystemMessage</c>, the
|
||||
/// production implementation of <c>IPluginChat.PostSystemMessage</c>)
|
||||
/// now funnels into <c>RuntimeCommunicationState.AddText(text,
|
||||
/// RetailLogTextType.Default)</c>, which calls
|
||||
/// <c>Chat.OnSystemMessage(text, (uint)Default)</c> — the exact call
|
||||
/// this test performs directly on the shared <see cref="ChatLog"/>,
|
||||
/// matching Decal's own <c>AddChatText</c> behavior for plugin text.
|
||||
/// Any <see cref="ChatVM"/> bound to that log (the production chat
|
||||
/// window) must show the line; it must never depend on the
|
||||
/// <see cref="ChatVM.OnInterfaceText"/> SpewBox seam, which this call
|
||||
/// never touches.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void RecentLines_ShowsPluginSystemMessage_TaggedDefault()
|
||||
{
|
||||
var log = new ChatLog();
|
||||
var vm = new ChatVM(log, displayLimit: 50);
|
||||
|
||||
log.OnSystemMessage(
|
||||
"MossTank: buffs applied.",
|
||||
chatType: (uint)RetailLogTextType.Default);
|
||||
|
||||
Assert.Equal(
|
||||
"MossTank: buffs applied.",
|
||||
Assert.Single(vm.RecentLines()));
|
||||
Assert.Equal(
|
||||
(uint)RetailLogTextType.Default,
|
||||
Assert.Single(log.Snapshot()).LogTextType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue