feat(master): the world file watch follows the override folder, and can hold a zone

For a file under maps/ master watches the file a world would read now: the override
when one is there, else the client's. An override that appears, changes or goes away
makes the instances that read another version stale, also for files from the packs.
The dashboard can hold a zone's automatic reloads (WORLD_RELOAD_HOLD, a new message
after the existing ones) until a reload of the zone is asked for. The status sent to
the dashboard counts what reloads did per zone.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 18:25:53 -06:00
parent d124372973
commit e714ff2f0a
8 changed files with 217 additions and 17 deletions

View File

@@ -250,3 +250,40 @@ TEST(WorldFileWatchTests, ChooseKeepsAnInstanceOfKeptZones) {
EXPECT_EQ(choices[1].action, eAction::STOP);
}
}
// A file a world read from the client's packs is watched once the caller says a folder can replace it: an override
// showing up for it makes the instances that read the pack's version stale
TEST(WorldFileWatchTests, PackedFilesAreWatchedWhenAnOverrideCanReplaceThem) {
Tracker tracker;
tracker.Report(1100, 1, 0, { File("maps/a.lvl", 7, Kind::SCENE, true) });
const auto inPack = At(0, 0);
Stamp now = inPack;
const auto poll = [&] {
return tracker.Poll([&](const std::string&) { return now; }, [](const std::string& path) { return path.starts_with("maps/"); });
};
// Not watched without the second argument
EXPECT_TRUE(tracker.Poll([&](const std::string&) { return now; }).empty());
// First read: what the pack holds
auto due = poll();
ASSERT_EQ(due.size(), 1u);
EXPECT_FALSE(tracker.Hashed(due[0], 7, 100));
EXPECT_TRUE(tracker.Stale().empty());
EXPECT_TRUE(poll().empty());
// An override appears and holds still for a poll
now = At(50, 9);
EXPECT_TRUE(poll().empty());
due = poll();
ASSERT_EQ(due.size(), 1u);
EXPECT_TRUE(tracker.Hashed(due[0], 8, 50));
EXPECT_EQ(tracker.Stale().size(), 1u);
// It is taken away again: the pack's version is what is read, and the instance matches it again
now = inPack;
EXPECT_TRUE(poll().empty());
due = poll();
ASSERT_EQ(due.size(), 1u);
EXPECT_TRUE(tracker.Hashed(due[0], 7, 100));
EXPECT_TRUE(tracker.Stale().empty());
}