Kill the Stryker survivors in the projection and observer cuts

Delete the dead removed-ancestor branch and the duplicated name-read in the
variant name rule (resolution already refuses a missing or removed base and a
variant shares its base type). Add tests for the index rule counting a record
the same commit removes, blank names not colliding, and Dispose rethrowing
escaped completions after every observer completed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-29 17:46:36 +02:00
commit 0a543c9fb2
3 changed files with 85 additions and 8 deletions

View file

@ -2551,7 +2551,7 @@ namespace GameCult.Caching
var descriptor = stored.Descriptor;
string? name = null;
if (descriptor.NameAccessor != null)
name = Read(stored, $"[CultName] member {descriptor.NameMember}", descriptor.NameAccessor) is { Length: > 0 } read ? read : null;
name = NameRead(stored) is { Length: > 0 } read ? read : null;
var indexes = new List<(string Alias, string Value)>();
foreach (var pair in descriptor.IndexAccessors)
{
@ -2565,6 +2565,9 @@ namespace GameCult.Caching
}
}
private static string? NameRead(CultStoredDocument stored) =>
Read(stored, $"[CultName] member {stored.Descriptor.NameMember}", stored.Descriptor.NameAccessor!);
private static string? Read(CultStoredDocument stored, string what, Func<object, string?> getter)
{
try
@ -2590,7 +2593,7 @@ namespace GameCult.Caching
// The variant rules are judged only when a variant is involved.
if (_variantKeys.Count != 0 || admitted.Any(stored => stored.Variant != null))
{
RefuseVariantNameSharing(plan, evicted);
RefuseVariantNameSharing(plan);
RefuseVariantIndexSharing(plan, evicted);
}
@ -2744,20 +2747,17 @@ namespace GameCult.Caching
// R6: the name index maps one name to one key, so a variant that kept its base's name would shadow it. A variant's
// name is its projection; an ancestor that lands is read from its projection, one that stays is read as held.
private void RefuseVariantNameSharing(VariantPlan plan, IReadOnlyList<CultStoredDocument> evicted)
private void RefuseVariantNameSharing(VariantPlan plan)
{
var gone = evicted.Select(stored => stored.Key.Value).ToHashSet(StringComparer.Ordinal);
var landing = plan.Admitted.Concat(plan.Dependents).ToDictionary(stored => stored.Key.Value, StringComparer.Ordinal);
// Resolution already refused a base that is missing or removed, so an ancestor is landing or held.
CultStoredDocument? Ancestor(string key) =>
landing.TryGetValue(key, out var landed) ? landed
: gone.Contains(key) ? null
: _entries.TryGetValue(key, out var held) ? held : null;
string? NameOf(CultStoredDocument stored) =>
plan.Projections.TryGetValue(stored.Key.Value, out var projection)
? projection.Name
: stored.Descriptor.NameAccessor == null ? null : Read(stored, $"[CultName] member {stored.Descriptor.NameMember}", stored.Descriptor.NameAccessor);
plan.Projections.TryGetValue(stored.Key.Value, out var projection) ? projection.Name : NameRead(stored);
foreach (var variant in landing.Values.Where(stored => stored.Variant != null))
{