feat(master): UPDATE_STATUS from the dashboard, logged when it changes

Appended message ID 50 (dashboard -> master): the update check's state and a
one-line summary. Master logs it whenever the summary changes, so the first
one after master starts says when an update is out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-30 10:47:50 -05:00
parent a2cc0d5a82
commit 4fe3b41be2
5 changed files with 75 additions and 0 deletions

View File

@@ -1816,6 +1816,7 @@ static_assert(static_cast<int64_t>(MessageType::Master::CDCLIENT_RELOAD) == 46);
static_assert(static_cast<int64_t>(MessageType::Master::WORLD_FILES) == 47);
static_assert(static_cast<int64_t>(MessageType::Master::WORLD_RELOAD) == 48);
static_assert(static_cast<int64_t>(MessageType::Master::WORLD_FILES_STATUS) == 49);
static_assert(static_cast<int64_t>(MessageType::Master::UPDATE_STATUS) == 50);
// MessageType::Server: 3 enumerators
static_assert(static_cast<int64_t>(MessageType::Server::VERSION_CONFIRM) == 0);

View File

@@ -6,6 +6,7 @@
#include "master/WorldFiles.h"
#include "master/MessageCapture.h"
#include "master/PlayerAction.h"
#include "master/UpdateStatus.h"
#include "PacketDispatcher.h"
#include "PacketTestUtils.h"
#include "Game.h"
@@ -672,6 +673,31 @@ TEST(MasterPacketsTests, WorldFilesStatus) {
EXPECT_EQ(read.zones, status.zones);
}
TEST(MasterPacketsTests, UpdateStatus) {
UpdateStatus status;
status.state = 2;
status.summary = "Update available: release v3.1.0 (this server is running release v3.0.0)";
ExpectHeaderThenSerialize(status, MessageType::Master::UPDATE_STATUS);
RakNet::BitStream stream;
status.Serialize(stream);
UpdateStatus read;
ASSERT_TRUE(read.Deserialize(stream));
EXPECT_EQ(read.state, 2);
EXPECT_EQ(read.summary, status.summary);
// Longer than the cap: cut on the way out, refused on the way in
status.summary.assign(UpdateStatus::MAX_SUMMARY + 10, 'x');
RakNet::BitStream cut;
status.Serialize(cut);
ASSERT_TRUE(read.Deserialize(cut));
EXPECT_EQ(read.summary.size(), UpdateStatus::MAX_SUMMARY);
RakNet::BitStream tooLong;
tooLong.Write<uint8_t>(1);
tooLong.Write<uint16_t>(UpdateStatus::MAX_SUMMARY + 1);
EXPECT_FALSE(read.Deserialize(tooLong));
}
// A master without the outdated flags (written after the endpoints) still reads: nothing is outdated
TEST(MasterPacketsTests, ServerListWithoutOutdatedFlags) {
MasterPackets::ServerListResponse response;