C#: a blank declared compatible schema id is dropped, not refused

A type that failed to build a descriptor poisoned the shared registry's discovery of every
loaded document. A blank id is now filtered like the type's own id, and the test declares one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 11:31:28 +02:00
commit d589e61f67
2 changed files with 3 additions and 19 deletions

View file

@ -790,10 +790,8 @@ namespace GameCult.Caching
var contentHash = Sha256(schemaJson);
var semanticFingerprint = BuildSemanticFingerprint(attribute.SchemaName, attribute.SchemaVersion, descriptorMembers);
var schemaId = Sha256(semanticFingerprint);
if (attribute.CompatibleSchemaIds.Any(string.IsNullOrWhiteSpace))
throw new InvalidOperationException($"Type {type.FullName} declares an empty compatible schema id.");
var compatibleSchemaIds = attribute.CompatibleSchemaIds
.Where(id => !string.Equals(id, schemaId, StringComparison.Ordinal))
.Where(id => !string.IsNullOrWhiteSpace(id) && !string.Equals(id, schemaId, StringComparison.Ordinal))
.Distinct(StringComparer.Ordinal)
.ToArray();