From 22d0722d5ab11d742472ac75212f5ff132d32e20 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 23 Sep 2026 08:38:27 +0200 Subject: [PATCH] R-AT: fix the C# self-citer fixture's naming so it actually defeats push-order luck The zebra/alpha pairing that kills Rust's drop-both-to-components mutant does not kill it in C#: EvaluateAll concatenates citesEdges before citedEdges (the opposite of cultnet_rs's single cited-then-cites Vec), so that pairing's push order already matched the correct sort order here too - just for the opposite reason. Swap to alpha (self) / zebra (target), the pairing that actually disagrees with this runtime's own push order. Co-Authored-By: Claude Sonnet 5 --- .../CultNetSelectionFixBatchTests.cs | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/tests/GameCult.Networking.Tests/CultNetSelectionFixBatchTests.cs b/tests/GameCult.Networking.Tests/CultNetSelectionFixBatchTests.cs index a6a03f81..9b6959c0 100644 --- a/tests/GameCult.Networking.Tests/CultNetSelectionFixBatchTests.cs +++ b/tests/GameCult.Networking.Tests/CultNetSelectionFixBatchTests.cs @@ -650,42 +650,48 @@ namespace GameCult.Networking.Tests public CultRecordRef[] Peers = Array.Empty>(); } - // Named "zebra"/"alpha", not the rig's "hub"/"other": CultNetSelectionEvaluator.Select runs - // the Cited hop before the Cites hop (line ~198 vs ~206), so the self edge is always pushed - // to CitedEdges before the peer edge is pushed to CitesEdges. With "hub" self-citing and - // "other" as the cites target, "hub" < "other" already matches that push order, so dropping - // the comparator's To component reproduces the right answer by coincidence and the mutation - // survives. Naming the self-citer "zebra" and the target "alpha" makes push order - // [zebra, alpha] disagree with the required sorted order [alpha, zebra], so only the - // comparator's own To component - not insertion order - can produce it. + // Named "alpha" (self-citer) / "zebra" (cites target) - the OPPOSITE pairing from the Rust + // mirror of this test. CultNetSelectionEvaluator.EvaluateAll builds `edges` as + // `citesEdges` THEN `citedEdges` (line ~215-216), unlike cultnet_rs::select's single Vec + // pushed cited-then-cites - so in C# the cites edge (anchored on From) is pushed before the + // self/cited edge (anchored on To). With the rig's "hub" self-citing and "other" as the + // cites target, push order is [other, hub] and "hub" < "other" is the wrong order anyway + // (masked by the assertion using different values) - the actual coincidence this runtime + // needs broken is push order agreeing with sort order when the *target* name sorts before + // the *self* name. Naming the self-citer "alpha" and the target "zebra" makes C#'s push + // order [zebra, alpha] disagree with the required sorted order [alpha, zebra], so only the + // comparator's own To component - not insertion order - can produce it. (The Rust test uses + // the reverse pairing because cultnet_rs's push order is cited-then-cites, the opposite of + // this runtime's citesEdges-then-citedEdges - each runtime needs its own naming to defeat + // its own coincidence.) [Test] public void Evaluator_EdgeOrderPinsToWhenFromAndRoleAreBothTiedByASelfCitingPeer() { var registry = CultDocumentRegistry.ForTypes(new[] { typeof(SoulSelfCiter) }); var descriptor = registry.GetRequired(); - var zebra = new SoulSelfCiter + var alpha = new SoulSelfCiter { - Name = "zebra", + Name = "alpha", Peers = new[] { - new CultRecordRef(new CultRecordKey("zebra")), - new CultRecordRef(new CultRecordKey("alpha")) + new CultRecordRef(new CultRecordKey("alpha")), + new CultRecordRef(new CultRecordKey("zebra")) } }; - var alpha = new SoulSelfCiter { Name = "alpha" }; + var zebra = new SoulSelfCiter { Name = "zebra" }; var rows = new[] { - new CultNetSelectionEvaluator.Row(descriptor, new CultRecordKey("zebra"), zebra, 1), - new CultNetSelectionEvaluator.Row(descriptor, new CultRecordKey("alpha"), alpha, 2) + new CultNetSelectionEvaluator.Row(descriptor, new CultRecordKey("alpha"), alpha, 1), + new CultNetSelectionEvaluator.Row(descriptor, new CultRecordKey("zebra"), zebra, 2) }; var selection = new CultNetSelection { Cites = new CultNetCitation { - Target = new CultNetRecordRef { SchemaId = descriptor.SchemaId, RecordKey = "alpha" }, + Target = new CultNetRecordRef { SchemaId = descriptor.SchemaId, RecordKey = "zebra" }, Role = "Peers" }, Cited = new CultNetIncoming { Role = "Peers", Exists = true }