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
|
|
@ -1170,9 +1170,12 @@ internal sealed class AppAutomationSurface
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Routed to retail's ClientLocal log type (0x1A) — the channel the client
|
||||
/// uses for its own notices. Nothing reaches the server, so a plugin cannot
|
||||
/// accidentally speak in the player's name.
|
||||
/// Owner direction 2026-09-07 (register row AD-124): plugin-originated
|
||||
/// text now lands in the chat window (retail <c>Default</c>/0x00),
|
||||
/// matching Decal's own <c>AddChatText</c> behavior — not retail's
|
||||
/// ClientLocal (0x1A) SpewBox-only channel this previously used.
|
||||
/// Nothing reaches the server, so a plugin cannot accidentally speak in
|
||||
/// the player's name.
|
||||
/// </summary>
|
||||
public void PostSystemMessage(string text)
|
||||
{
|
||||
|
|
@ -1181,7 +1184,7 @@ internal sealed class AppAutomationSurface
|
|||
RuntimeCommunicationState? communication;
|
||||
lock (_gate)
|
||||
communication = _communication;
|
||||
communication?.AddText(text, RetailLogTextType.ClientLocal);
|
||||
communication?.AddText(text, RetailLogTextType.Default);
|
||||
}
|
||||
|
||||
public bool Submit(string text)
|
||||
|
|
|
|||
|
|
@ -302,10 +302,20 @@ public interface IPluginChat
|
|||
Array.Empty<PluginChatMessage>();
|
||||
|
||||
/// <summary>
|
||||
/// Post a client-local system line, the channel retail uses for the
|
||||
/// client's own notices. It is local to this client: nothing is sent to the
|
||||
/// server and no other player sees it.
|
||||
/// Post a plugin-originated system line into the chat window. It is
|
||||
/// local to this client: nothing is sent to the server and no other
|
||||
/// player sees it.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Owner direction 2026-09-07 (register row AD-124): this used to route
|
||||
/// through retail's <c>ClientLocal</c> (0x1A) channel — the SpewBox
|
||||
/// overlay every <c>ChatInterface</c> window's default filter excludes.
|
||||
/// The owner explicitly overrode that for plugin text, matching Decal's
|
||||
/// own <c>AddChatText</c> behavior: plugin output now lands in the chat
|
||||
/// transcript (retail <c>Default</c>/0x00) so it is actually visible and
|
||||
/// scrolls back, never the transient overlay. See
|
||||
/// <c>AppAutomationSurface.PostSystemMessage</c> for the implementation.
|
||||
/// </remarks>
|
||||
void PostSystemMessage(string text);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -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