R-AL: restore ReferenceMembers' IsReference guard and fix D10's blind spot
CultNetSelectionEvaluator.ReferenceMembers dropped the `!member.IsReference` guard on the premise that a data member's role string could never coincide with a reference member's alias - false. CultCache's D10 only rejects a collision between two *aliased* members; an unaliased data member's bare name was never checked against another member's alias. A data member named `Owner` plus a reference member aliased `Owner` registered fine, then faulted every hop through it: ReferenceMembers yielded the data member, ReferencesOf matched it to the reference member's edges by role string, and `member.TargetType!` was null. Two independent fixes, both regression-tested: - Restore the guard, delete the false comment. Pinned directly by hand- building the colliding descriptor via reflection (bypassing the registry, since D10b below now refuses that shape at the only production door). - D10b: registration now refuses a plain member whose bare name collides with a reference member's alias in the reference-role namespace (IndexAlias ?? MemberName), not just alias-vs-alias. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
fc51e9a408
commit
375b6177ae
2 changed files with 46 additions and 6 deletions
|
|
@ -448,16 +448,20 @@ namespace GameCult.Networking
|
|||
return incoming;
|
||||
}
|
||||
|
||||
// R-AK: no `!member.IsReference` guard here - CultCache.ReferencesOf (CultCache.cs:262-278)
|
||||
// already searches only its own RichMembers' reference members for a role match and
|
||||
// returns empty for anything else, including a data member's own alias (index aliases are
|
||||
// unique per descriptor, so a data member's role string can never coincide with a
|
||||
// reference member's). A second copy of the same exclusion here was duplicate authority,
|
||||
// not a second decision - CultCache owns "is this member a reference" once.
|
||||
// R-AL: the `!member.IsReference` guard is restored. R-AK's removal argued a data member's
|
||||
// role string could never coincide with a reference member's because index aliases are
|
||||
// unique per descriptor - false. CultCache's D10 only rejects a collision between two
|
||||
// *aliased* members (CultCache.cs:1085-1097); a plain data member with no [CultIndex]
|
||||
// contributes its bare MemberName to the same role namespace unchecked (fixed for new
|
||||
// registrations by D10b, CultCache.cs ~1099, but this guard is the caller-side backstop for
|
||||
// whatever is already registered). Without it, a data member sharing a reference member's
|
||||
// role is yielded here, ReferencesOf then matches it to the *reference* member's edges by
|
||||
// role string, and `member.TargetType!` is null - ArgumentNullException on every hop.
|
||||
private static IEnumerable<CultDocumentMemberView> ReferenceMembers(CultDocumentDescriptor descriptor, string? role)
|
||||
{
|
||||
foreach (var member in descriptor.DeclaredMembers)
|
||||
{
|
||||
if (!member.IsReference) continue;
|
||||
if (role != null && (member.IndexAlias ?? member.MemberName) != role) continue;
|
||||
yield return member;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue