C#: receipt writes need a reliable, non-sequenced channel; a refusal without a record key or schema id carries a null detail value

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Libby 2026-11-08 17:01:59 +00:00
commit 40b34295e3
4 changed files with 58 additions and 3 deletions

View file

@ -1205,5 +1205,25 @@ namespace GameCult.Networking.Tests
Assert.That(routedAgain.RoutingHint!.Reason, Is.EqualTo("not_primary"));
Assert.That(routedAgain.Error, Is.EqualTo(CultNetDatabaseServer.RoutingRefusalText));
}
// A write that carries no record key or schema id has none to echo: the detail value is null, not an empty string.
[Test]
public void AReplayedRefusalOfAWriteWithoutTheNamedFieldCarriesANullValue()
{
var session = new CultNetWriteReceiptSession();
var sent = new List<ICultNetSchemaMessage>();
CultNetReceiptedWrite Write() => new(session, sent.Add, "delete", "m1", null, null, null);
var first = Write();
Assert.That(first.Begin(), Is.True);
first.Refused(DeniedWith("ignored", "reason"));
Assert.That(Write().Begin(), Is.False);
foreach (var message in sent)
{
var error = (CultNetErrorV1Message)message;
Assert.That(error.Details!.Field, Is.EqualTo("recordKey"));
Assert.That(error.Details.Value, Is.Null);
}
}
}
}