Merge branch 'main' into is_typing-3510

This commit is contained in:
Griatch
2026-07-04 08:00:05 +02:00
4 changed files with 43 additions and 3 deletions

View File

@ -46,6 +46,7 @@
- [Fix][pull3936]: Add -> bool return annotations to override-intended hook methods (Problematic)
- [Fix][pull3938]: Fix ReferenceError in notifications plugin when window unfocused (Problematic)
- [Fix][pull3942]: Add AMP_CONNECT_TIMEOUT for portal probe (jaborsh)
- Fix: Resolve UnhandledCommand race on server start (Griatch)
- Docs: Griatch, BigJMoney, dicnunz, pikammmmm
[pull3866]: https://github.com/evennia/evennia/pull/3866

View File

@ -434,9 +434,8 @@ The web client starts out having two panes - the input-pane for entering command
and the main window.
- Use |y<Return>|n (or click the arrow on the right) to send your input.
- Use |yCtrl + <up/down-arrow>|n to step back and forth in your command-history.
- Use |yCtrl + <Return>|n to add a new line to your input without sending.
(Cmd instead of Ctrl-key on Macs)
- Use |yShift + <up/down-arrow>|n to step back and forth in your command-history.
- Use |yShift + <Return>|n to add a new line to your input without sending.
There is also some |wextra|n info to learn about customizing the webclient.

View File

@ -520,11 +520,24 @@ class AMPMultiConnectionProtocol(amp.AMP):
Data will be sent across the wire pickled as a tuple
(sessid, kwargs).
The launcher connects to the Portal's AMP endpoint too, but its
protocol (`AMPLauncherProtocol`) only handles launcher-directed
commands. Broadcasting a server-directed command (e.g.
`AdminPortal2Server`) to it would raise an `UnhandledCommand` on
the launcher side, which is then logged as a spurious AMP error on
every startup. We therefore skip the launcher connection here. The
Server-side factory has no `launcher_connection`, hence the
`getattr` guard.
"""
deferreds = []
# print("broadcast: {} {}: {}".format(command, sessid, kwargs))
launcher_connection = getattr(self.factory, "launcher_connection", None)
for protcl in self.factory.broadcasts:
if protcl is launcher_connection:
continue
deferreds.append(
protcl.callRemote(command, **kwargs).addErrback(self.errback, command.key)
)

View File

@ -131,3 +131,30 @@ class TestAMPClientRecv(_TestAMP):
evennia.SERVER_SESSION_HANDLER.portal_disconnect_all = MagicMock()
self.amp_client.dataReceived(wire_data)
evennia.SERVER_SESSION_HANDLER.portal_disconnect_all.assert_called()
def test_broadcast_skips_launcher_connection(self, mocktransport):
"""
When no dedicated `server_connection` is set yet (a window during
startup), `data_to_server` falls back to `broadcast`. This must not
send the server-directed command to the launcher connection, whose
protocol cannot handle it. Regression test for the spurious
`UnhandledCommand: AdminPortal2Server` logged on every startup.
"""
from twisted.internet import defer
launcher_conn = MagicMock()
launcher_conn.callRemote.return_value = defer.succeed(None)
server_conn = MagicMock()
server_conn.callRemote.return_value = defer.succeed(None)
factory = self.amp_server.factory
factory.launcher_connection = launcher_conn
factory.server_connection = None
factory.broadcasts = [launcher_conn, server_conn]
self.amp_server.send_AdminPortal2Server(self.session, operation=amp.PSYNC)
# the real (server) connection is reached, the launcher is skipped
server_conn.callRemote.assert_called_once()
launcher_conn.callRemote.assert_not_called()