From ec3be4f4b560a5f863b3c800cc3c419a4efba342 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 17 Sep 2026 18:32:45 +0200 Subject: [PATCH] Cut 0: mutation-test the entity-settings-copy rule Adds a control (no-op) and a red mutation reverting Entity's constructor to alias its settings argument instead of copying it. Both run against EntitiesDoNotShareDefaultEntitySettings; the red mutation is killed. Co-Authored-By: Claude Opus 5 --- tests/mutation_tests.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/mutation_tests.py b/tests/mutation_tests.py index 5d951bc8f..9fdb06a1c 100644 --- a/tests/mutation_tests.py +++ b/tests/mutation_tests.py @@ -434,6 +434,25 @@ MUTATIONS: list[Mutation] = [ test="CapabilityEventsTests.EachEventKindReachesOnlyItsOwnSubscribers", expect="red", ), + # --- Cut 0 (docs/settings-globals-cut.md): Entity must copy the EntitySettings it is given, so no + # entity aliases GameplaySettings.DefaultEntitySettings (or, once settings are a catalog global, the + # cached record itself). --- + Mutation( + rule="control (no-op round trip) for the entity-settings-copy test", + file="Assets/Scripts/ServerShared/Entity.cs", + anchor=" Settings = MessagePackSerializer.Deserialize(MessagePackSerializer.Serialize(settings));", + mutated=" Settings = MessagePackSerializer.Deserialize(MessagePackSerializer.Serialize(settings));", + test="LoadoutTests.EntitiesDoNotShareDefaultEntitySettings", + expect="green", + ), + Mutation( + rule="Entity's constructor copies the settings it is given, instead of aliasing the template", + file="Assets/Scripts/ServerShared/Entity.cs", + anchor=" Settings = MessagePackSerializer.Deserialize(MessagePackSerializer.Serialize(settings));", + mutated=" Settings = settings;", + test="LoadoutTests.EntitiesDoNotShareDefaultEntitySettings", + expect="red", + ), ]