Soul found commit 2 didn't pass (docs/cultnet-selection-cut.md, 2026-09-22):
empty/blank schemas-keys still reached the evaluator, the shard snapshot ran
its own loop instead of the evaluator, Mesh's v0 wire silently dropped v1-only
selection terms, the Mesh one-pass read could return the wrong schema's
record at a shared key, two decode rules for a foreign schema id disagreed,
dead identity-comparison code from the _projectRecord removal was still live,
and a disposed-socket race could abort a mutation run instead of recording
NO VERDICT. This is Self's fix batch for all of it.
- CultNetSelection.Validate now refuses a blank/whitespace entry inside
schemas or keys, not just an empty array. CultNetSelectionEvaluator no
longer treats [] as "no filter" (the door already refuses it before
evaluation). CultNetV0SelectionLowering is the one place that lowers an
empty or all-blank v0 list to null; CreateRawSnapshotResponse and
CreateShardSnapshotResponse both route through it, and CultMesh's own
Clean() now delegates to it instead of duplicating the rule.
- CreateShardSnapshotResponse no longer carries a private loop or its own
schema/key matching: it builds a CultNetSelection and answers through
CultNetDocumentRegistry.SelectPage (the same evaluator path as the
non-shard snapshot), with the shard's own membership check as a row
filter. Binding-alias expansion now runs on both paths identically.
- ResolveDefaultSelection decides "no schema filter" from the cleaned
recordKeys, not the raw array length. OverlaySelection stops deciding what
a missing override means: any explicit schemaIds/recordKeys override
replaces the default selection wholesale; no override keeps the default
untouched.
- CultMeshSnapshotRequestOptions.Selection is now checked by
EnsureV0Compatible before every send: fields, cites, cited, limit, cursor,
descending, and any non-default projection are refused typed
(CultNetSelectionInvalidException), never silently dropped from the v0
wire message. Mesh sending v1 is FU-Mesh-v1, not this cut.
- CultMeshHotBodySubscription.Selection returns a defensive copy on every
read so its arrays can't be mutated out from under the stored selection.
- ReadDocumentFromSnapshotResponse now searches candidates at one recordKey
in one order - exact schema, then alias, then a foreign schema id decoded
from the payload - instead of one OR'd condition where a case-insensitive
or structurally-lucky candidate could win first. The foreign-id decode
reads the payload's embedded schema version with the registry's shared
CultNetDocumentRegistry.TryReadSchemaVersion and alias-matches it against
the caller's own descriptor directly, rather than resolving to "whichever
registered type owns this schema string" - that resolution is ambiguous
when two document types alias the same schema id (MeshNoteDocument and
MeshNoteAliasDocument in the existing fixtures), which is what broke on
the first pass; TryResolveDescriptorByPayloadSchema stays for its existing
caller (ResolveDescriptorForRawDocument) with a note on when not to use it.
DecodeSnapshotDocuments and the Mesh copy of the payload-schema decode
(RawSnapshotPayloadMatchesSchema/TryReadSchemaVersion) are deleted in
favour of the shared one.
- CultNetDatabaseSubscriptionServer: the dead RecordKey/SchemaId identity
comparisons in Reconcile and ApplyProjectedChange, and the duplicate-key
throw in CreateProjectedSnapshot, are deleted - they can no longer fire
now that a projection's dictionary key is always the record's own key.
A new test flips authorizeRecord per key while the whole request stays
authorized (so DemandActive never toggles) and proves both halves of the
remaining diff: the removal of a now-unauthorized key and the add loop
picking up a newly-authorized one.
- Every NetworkingTests.cs test that starts an IsBackground poll thread now
joins it before its server disposes (about 20 tests; one already did).
- scripts/mutate-dotnet.ps1: a dotnet-test-host crash writing to stderr no
longer throws the whole run away under PowerShell 5.1's
$ErrorActionPreference = 'Stop' (2>&1 on a native command wraps stderr in
a terminating NativeCommandError); Run-Tests catches it and the entry loop
records NO VERDICT instead of aborting every remaining entry.
- Two probe tests: CultNetDatabase_ShardAndNonShardSnapshot_Agree{On
UnfilteredRequest,OnBindingSchemaIdOverride} prove the shard and non-shard
snapshot paths agree, including shard-membership exclusion of a document
outside the shard's key prefix and a binding schema-id override matching
on both paths.
- Mutation entries updated/added to match: the stale NET-D4-FourthMatcher
entry (its anchor was the private loop this batch deleted, not refactored)
is replaced by NET-D4-ShardMembership-Revert; the Mesh entries file's
header miscount ("two of three" loosening entries when there are only
two) is corrected and both previously-surviving loosening mutants
(MESH-DEFAULT-Loosening, MESH-KEY-Loosening) now have killing fixtures;
scripts/mutate-cultnet-selection-fixbatch2.entries.ps1 is new, covering
Reconcile's remaining two mutants.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
72 lines
4.6 KiB
PowerShell
72 lines
4.6 KiB
PowerShell
# Entries for scripts/mutate-dotnet.ps1: CultNet typed selection, Cut 1, commit 2 fix batch
|
|
# (docs/cultnet-selection-cut.md, sections 4/7/11). Targets: src/GameCult.Mesh/CultMesh.cs
|
|
# (ReadDocumentFromSnapshotResponse's one exact read) and src/GameCult.Mesh/CultMeshSnapshots.cs
|
|
# (ResolveDefaultSelection's "no schema filter when keys are given" rule). Test project:
|
|
# tests/GameCult.Mesh.Tests.
|
|
#
|
|
# Every entry below carries its own File, so this runs as one invocation with both -Target paths.
|
|
#
|
|
# There are two loosening entries here (MESH-DEFAULT-Loosening and MESH-KEY-Loosening); the header
|
|
# above this line previously miscounted them as "two of three" (S2-9/S2-10). Both were genuine
|
|
# weaker readings of the rule they sit beside and both SURVIVED against the pre-fix-batch fixtures,
|
|
# because nothing in tests/GameCult.Mesh.Tests exercised an explicit empty (non-null) recordKeys
|
|
# array or a record-key case variation. CultMeshStreamingTests.cs now carries
|
|
# FetchDocumentsAsync_WithExplicitEmptyRecordKeys_StillDefaultsToOwnSchema (MESH-DEFAULT) and the
|
|
# case-variant-key block appended to DocumentHandle_ReadsRemotePeerSnapshotsAsTypedDocuments
|
|
# (MESH-KEY); both mutants below now die.
|
|
|
|
@(
|
|
@{
|
|
Id = 'MESH-DEFAULT-Revert'
|
|
Rule = 'ResolveDefaultSelection: an explicit non-empty recordKeys with no schemaIds means no schema filter, not the document type''s own schema.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Mesh/CultMeshSnapshots.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Mesh.Tests.CultMeshStreamingTests.SnapshotEndpoint_ProvidesTypedHandlesAndSchemaAliases'
|
|
Old = 'var cleanedKeys = Clean(recordKeys);
|
|
var schemas = schemaIds != null
|
|
? Clean(schemaIds)
|
|
: (cleanedKeys != null ? null : new[] { descriptor.SchemaId });'
|
|
New = 'var cleanedKeys = Clean(recordKeys);
|
|
var schemas = schemaIds != null ? Clean(schemaIds) : new[] { descriptor.SchemaId };'
|
|
},
|
|
@{
|
|
Id = 'MESH-DEFAULT-Loosening'
|
|
Rule = 'ResolveDefaultSelection: the no-schema-filter branch triggers on a non-empty (post-cleaning) recordKeys, not merely a non-null one - an explicit empty recordKeys array still defaults to the document type''s own schema (docs/cultnet-selection-cut.md, S2-7/rule 1''s v0 lowering).'
|
|
Mutant = 'loosening'
|
|
File = 'src/GameCult.Mesh/CultMeshSnapshots.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Mesh.Tests.CultMeshStreamingTests.FetchDocumentsAsync_WithExplicitEmptyRecordKeys_StillDefaultsToOwnSchema'
|
|
Old = 'cleanedKeys != null ? null : new[] { descriptor.SchemaId }'
|
|
New = 'recordKeys != null ? null : new[] { descriptor.SchemaId }'
|
|
},
|
|
@{
|
|
Id = 'MESH-KEY-Revert'
|
|
Rule = 'ReadDocumentFromSnapshotResponse: a candidate must name this recordKey - the one exact read never returns a record under the wrong key.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Mesh/CultMesh.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Mesh.Tests.CultMeshStreamingTests.DocumentHandle_ReadsRemotePeerSnapshotsAsTypedDocuments'
|
|
Old = 'if (!string.Equals(candidate.RecordKey, recordKey, StringComparison.Ordinal))
|
|
continue;'
|
|
New = ''
|
|
},
|
|
@{
|
|
Id = 'MESH-KEY-Loosening'
|
|
Rule = 'ReadDocumentFromSnapshotResponse: the recordKey match is exact (ordinal), not case-insensitive.'
|
|
Mutant = 'loosening'
|
|
File = 'src/GameCult.Mesh/CultMesh.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Mesh.Tests.CultMeshStreamingTests.DocumentHandle_ReadsRemotePeerSnapshotsAsTypedDocuments'
|
|
Old = 'if (!string.Equals(candidate.RecordKey, recordKey, StringComparison.Ordinal))'
|
|
New = 'if (!string.Equals(candidate.RecordKey, recordKey, StringComparison.OrdinalIgnoreCase))'
|
|
},
|
|
@{
|
|
Id = 'MESH-FOREIGN-Revert'
|
|
Rule = 'ReadDocumentFromSnapshotResponse: a foreign/runtime-generated schema id at the right recordKey still matches when its payload''s embedded schema (read by the registry''s shared TryReadSchemaVersion) alias-matches the caller''s own descriptor.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Mesh/CultMesh.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Mesh.Tests.CultMeshStreamingTests.DocumentHandle_ReadsRemotePeerSnapshotsAsTypedDocuments'
|
|
Old = 'else if (byPayload == null &&
|
|
CultNetDocumentRegistry.TryReadSchemaVersion(candidate.Payload) is { } payloadSchemaVersion &&
|
|
CultNetSchemaAliasMatching.Matches(payloadSchemaVersion, descriptor))
|
|
byPayload = candidate;'
|
|
New = ''
|
|
}
|
|
)
|