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>
164 lines
10 KiB
PowerShell
164 lines
10 KiB
PowerShell
# Entries for scripts/mutate-dotnet.ps1: CultNet typed selection, Cut 1, commits 1-2 - the evaluator
|
|
# and D4's schema-identity collapse. Targets:
|
|
# src/GameCult.Networking/CultNetSelectionEvaluator.cs (S3/S5/S7/S16/S18) and
|
|
# src/GameCult.Networking/CultNetDatabase.cs (D4's fourth matcher). Every entry below carries its own
|
|
# File now, so this runs as one invocation with both -Target paths. Test project:
|
|
# tests/GameCult.Networking.Tests.
|
|
#
|
|
# Not exhaustive of S1-S23: this covers order, cursor freshness, the one negation, numeric boundaries
|
|
# and the reference_outside_target refusal. S1/S2/S6/S23 are pinned by tests but not yet mutation-run
|
|
# here; S9/S10-S15 (subscription reconcile, v0 lowering, cross-runtime) and S19/S21/S22 (cache layer)
|
|
# are covered elsewhere or not yet (see the Hands report for commit 1).
|
|
|
|
@(
|
|
@{
|
|
Id = 'NET-S3-Revert'
|
|
Rule = 'S3: order reverses under descending.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelectionEvaluator.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetSelectionEvaluatorTests.EvaluatorOrdersByOrdinalThenIdentityAndReverses'
|
|
Old = 'var ordered = (selection.Descending'
|
|
New = 'var ordered = (false'
|
|
},
|
|
@{
|
|
Id = 'NET-S5-Stale-Revert'
|
|
Rule = 'S5: a cursor from a moved asOf is refused cursor_stale.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelectionEvaluator.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetSelectionEvaluatorTests.EvaluatorRefusesAStaleCursorAndAMismatchedSelection'
|
|
Old = 'if (cursor.AsOf != asOf)'
|
|
New = 'if (false)'
|
|
},
|
|
@{
|
|
Id = 'NET-S5-Stale-Loosening'
|
|
Rule = 'S5: staleness compares equality, not only "cursor is newer than the current asOf".'
|
|
Mutant = 'loosening'
|
|
File = 'src/GameCult.Networking/CultNetSelectionEvaluator.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetSelectionEvaluatorTests.EvaluatorRefusesAStaleCursorAndAMismatchedSelection'
|
|
Old = 'if (cursor.AsOf != asOf)'
|
|
New = 'if (cursor.AsOf > asOf)'
|
|
},
|
|
@{
|
|
Id = 'NET-S5-Invalid-Revert'
|
|
Rule = 'S5: a cursor whose digest does not match this selection is refused cursor_invalid.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelectionEvaluator.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetSelectionEvaluatorTests.EvaluatorRefusesAStaleCursorAndAMismatchedSelection'
|
|
Old = "if (cursor.Digest != CultNetSelectionCursor.ComputeDigest(selection))`n throw new CultNetSelectionCursorException(`"cursor_invalid`", `"The cursor's selection digest does not match this selection.`");"
|
|
New = ''
|
|
},
|
|
@{
|
|
Id = 'NET-S7-Revert'
|
|
Rule = 'S7: cited { exists } is honoured, not ignored.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelectionEvaluator.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetSelectionEvaluatorTests.EvaluatorNegatedIncomingEdgeIsTheOnlyNegation'
|
|
Old = 'candidates = candidates.Where(row => incoming.Contains(row.Key.Value) == exists);'
|
|
New = 'candidates = candidates.Where(row => incoming.Contains(row.Key.Value) || true);'
|
|
},
|
|
@{
|
|
Id = 'NET-S7-Loosening'
|
|
Rule = 'S7: exists:true and exists:false must answer opposite sets, not the same test inverted twice.'
|
|
Mutant = 'loosening'
|
|
File = 'src/GameCult.Networking/CultNetSelectionEvaluator.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetSelectionEvaluatorTests.EvaluatorNegatedIncomingEdgeIsTheOnlyNegation'
|
|
Old = 'candidates = candidates.Where(row => incoming.Contains(row.Key.Value) == exists);'
|
|
New = 'candidates = candidates.Where(row => incoming.Contains(row.Key.Value) != exists);'
|
|
},
|
|
@{
|
|
Id = 'NET-S16-Le-Revert'
|
|
Rule = 'S16: le includes the equal boundary.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelectionEvaluator.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetSelectionEvaluatorTests.EvaluatorComparesNumbersAtTheBoundaryForEachOfTheFourOperators'
|
|
Old = 'CultNetSelectionOperator.Le => cmp <= 0,'
|
|
New = 'CultNetSelectionOperator.Le => cmp < 0,'
|
|
},
|
|
@{
|
|
Id = 'NET-S16-Ge-Revert'
|
|
Rule = 'S16: ge includes the equal boundary.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelectionEvaluator.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetSelectionEvaluatorTests.EvaluatorComparesNumbersAtTheBoundaryForEachOfTheFourOperators'
|
|
Old = 'CultNetSelectionOperator.Ge => cmp >= 0,'
|
|
New = 'CultNetSelectionOperator.Ge => cmp > 0,'
|
|
},
|
|
@{
|
|
Id = 'NET-S18-Revert'
|
|
Rule = 'D9/S18: an edge naming a row outside its reference''s declared target refuses the selection.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelectionEvaluator.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetSelectionEvaluatorTests.EvaluatorRefusesAnEdgeOutsideItsDeclaredTarget'
|
|
Old = 'throw new CultNetSelectionReferenceOutsideTargetException(from.Descriptor.SchemaId, from.Key.Value, role, to.Descriptor.SchemaId, to.Key.Value);'
|
|
New = 'return;'
|
|
},
|
|
@{
|
|
# S2-3 (docs/cultnet-selection-cut.md, Self's rulings 2026-09-22, commit 2 fix batch):
|
|
# CreateShardSnapshotResponse no longer carries its own schema/key filter at all - it went
|
|
# through CultNetSelectionEvaluator.SelectPage, with the shard's own row filter as the only
|
|
# thing this method still owns. NET-D4-FourthMatcher-Revert's original anchor
|
|
# ("requestedSchemaIds != null && !CultNetSchemaAliasMatching.MatchesAny(...)") was the private
|
|
# loop this fix batch deleted, not merely refactored; the schema-matching mutants it proved are
|
|
# now covered by this file's CultNetSelectionEvaluator.cs entries (NET-S1/S2 etc.) plus
|
|
# tests/GameCult.Networking.Tests.NetworkingTests.CultNetDatabase_ShardAndNonShardSnapshot_*.
|
|
# This entry now proves the one thing CreateShardSnapshotResponse still owns: the shard
|
|
# membership check.
|
|
Id = 'NET-D4-ShardMembership-Revert'
|
|
Rule = 'CreateShardSnapshotResponse''s row filter still enforces shard membership (shard.Matches), even though schema/key filtering is now entirely the evaluator''s.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetDatabase.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.NetworkingTests.CultNetDatabase_ShardAndNonShardSnapshot_AgreeOnUnfilteredRequest'
|
|
Old = '!string.IsNullOrWhiteSpace(key.Value) && shard.Matches(descriptor.SchemaId, key);'
|
|
New = '!string.IsNullOrWhiteSpace(key.Value);'
|
|
}
|
|
#
|
|
# Q-J (docs/cultnet-selection-cut.md section 2 "Numbers", 2026-09-22): the door's canonical-decimal
|
|
# grammar (CultNetSelection.cs) and the comparator that reads it (CultNetSelectionEvaluator.cs's
|
|
# CompareNumber, via CultNetCanonicalNumber.Compare). CultNetCanonicalNumberTests pins Compare
|
|
# directly with more cases than the entries below exercise; every entry here is one the map named.
|
|
@{
|
|
Id = 'NET-QJ-Door-Regex-Revert'
|
|
Rule = 'Q-J: the door refuses a non-canonical number spelling (+1, 1.0, 01, 1e3) rather than accepting it.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelection.cs'
|
|
Killer = 'FullyQualifiedName~CultNetSelectionEvaluatorTests.ValidationRefusesNonCanonicalNumberSpellings'
|
|
Old = 'if (!CultNetCanonicalNumber.IsCanonical(field.Number))'
|
|
New = 'if (false)'
|
|
},
|
|
@{
|
|
Id = 'NET-QJ-Door-NegativeZero-Revert'
|
|
Rule = 'Q-J: "-0" is excluded even though the regex alone matches it - IsCanonical checks it explicitly.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelection.cs'
|
|
Killer = 'FullyQualifiedName~CultNetSelectionEvaluatorTests.ValidationRefusesNonCanonicalNumberSpellings'
|
|
Old = 'value != null && value != "-0" && CanonicalRegex.IsMatch(value);'
|
|
New = 'value != null && CanonicalRegex.IsMatch(value);'
|
|
},
|
|
@{
|
|
Id = 'NET-QJ-Compare-IntegerLength-Revert'
|
|
Rule = 'Q-J: the comparator checks the integer part''s length before its digits - "100" > "99" even though ''1'' < ''9'' as a bare character.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelection.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetCanonicalNumberTests.CompareOrdersByIntegerPartLengthBeforeDigits'
|
|
Old = " if (integerLeft.Length != integerRight.Length)`n return sign * (integerLeft.Length < integerRight.Length ? -1 : 1);`n`n"
|
|
New = ''
|
|
},
|
|
@{
|
|
Id = 'NET-QJ-Compare-Lexicographic-Revert'
|
|
Rule = 'Q-J: the comparator is not a lexicographic compare of the whole string ("10" must not be less than "9").'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelection.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetCanonicalNumberTests.CompareOrdersByMagnitudeNotLexicographically'
|
|
Old = 'var (negativeLeft, integerLeft, fractionLeft) = Decompose(left);'
|
|
New = 'return string.CompareOrdinal(left, right); var (negativeLeft, integerLeft, fractionLeft) = Decompose(left);'
|
|
},
|
|
@{
|
|
Id = 'NET-QJ-Compare-Sign-Revert'
|
|
Rule = 'Q-J: the comparator orders a negative value below a positive one of the same magnitude.'
|
|
Mutant = 'revert'
|
|
File = 'src/GameCult.Networking/CultNetSelection.cs'
|
|
Killer = 'FullyQualifiedName=GameCult.Networking.Tests.CultNetCanonicalNumberTests.CompareOrdersNegativeBelowPositive'
|
|
Old = 'if (negativeLeft != negativeRight)'
|
|
New = 'if (false)'
|
|
}
|
|
)
|