CultLib/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Meta Vens 5e33d81e25 R-Q3, R-R: v0 lowering preserves v0's pre-cut answers exactly
CultNetV0SelectionLowering.Lower collapsed a non-null-but-empty filter list to
null ("no filter"). That corrupted two pre-cut v0 behaviours the same
function feeds:

- CultNetDatabase.CreateShardSnapshotResponse and
  CultNetDocumentRegistry.CreateRawSnapshotResponse (b3d9cf7) both test
  `filter?.RecordKeys != null`, not a length, so `recordKeys: []` always
  answered empty. Lowering the empty list to null made it answer every row
  instead. This corrects the ruling from the commit-2 fix batch that lowered
  an empty v0 list to "no filter".
- CultMesh.ResolveDefaultSelection used the same collapse to decide whether an
  explicit empty recordKeys should still fall back to the document type's own
  schema default; under the corrected Lower it must not.

Lower(null) still means "no filter"; Lower(non-null) is always a real
(possibly empty) array. The evaluator already treats a non-null empty Keys
array as "match nothing" (CultNetSelectionEvaluator.MatchesSchemaKeysFields);
only the v0 lowering was erasing that signal before selections reached it.

Also restores the pre-cut requested-key order for
CultNetDocumentRegistry.CreateRawSnapshotResponse: pre-cut, requested record
keys were iterated in the order the caller sent them (a HashSet<string> built
from the array, which enumerates in insertion order); the new shared
evaluator's constant ordinal fell back to schema-and-key sort order instead.
ordinalOf now ranks rows by their position in the requested key list when one
was given.

Rewrote CultMeshStreamingTests.FetchDocumentsAsync_WithExplicitEmptyRecordKeys
(renamed ...AnswersEmpty) to assert the corrected behaviour instead of the
ruling it used to pin. Added
CultNetDocumentRegistry_RawSnapshot_ExplicitEmptyRecordKeys_AnswersEmpty,
CultNetDocumentRegistry_RawSnapshot_KeepsRequestedRecordKeyOrder and
CultNetV0SelectionLowering_Lower_DistinguishesNullFromExplicitEmpty to
NetworkingTests.cs.

Not done in this commit: CultNetDatabase.CreateShardSnapshotResponse (the
shard-replication snapshot path) still orders by the evaluator's default
schema-and-key tiebreak. Its own pre-cut order was raw cache iteration order,
which the new evaluator has no equivalent for and shard replication does not
appear to depend on row order; flagged as a discrepancy rather than changed
without a test that would pin the "right" order. The side-by-side b3d9cf7 vs
HEAD comparison run the spec asks for was not executed in this pass; the
pre-cut behaviour above comes from reading CultNetDatabase.cs and
CultNetDocumentRegistry.cs at b3d9cf7 directly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 19:13:31 +02:00
..
GameCult.Caching.ConsumerBuild Delete the CultCache MessagePack source generator 2026-09-13 23:38:08 +02:00
GameCult.Caching.InteropPeer Delete the CultCache MessagePack source generator 2026-09-13 23:38:08 +02:00
GameCult.Caching.Tests CultNet selection cut1 fix batch: R-I/K/D tests and R-A/R-M reflection fix 2026-09-22 09:39:36 +02:00
GameCult.Geometry.Tests Make CultMath normalize follow dxc and release 0.2.2 2026-09-14 18:04:04 +02:00
GameCult.Mesh.Quic.Native.Tests Bind CultMesh authority identity to physical routes 2026-08-18 17:21:58 +02:00
GameCult.Mesh.Quic.Tests Recover authority-bound CultMesh and atomic generations 2026-08-26 19:01:24 +02:00
GameCult.Mesh.Tests R-Q3, R-R: v0 lowering preserves v0's pre-cut answers exactly 2026-09-22 19:13:31 +02:00
GameCult.Networking.InteropPeer Merge the CultCache store-routing cuts into main 2026-09-14 15:16:29 +02:00
GameCult.Networking.Tests R-Q3, R-R: v0 lowering preserves v0's pre-cut answers exactly 2026-09-22 19:13:31 +02:00
GameCult.Networking.WebSockets.Tests Add real browser CultMesh transport proof 2026-08-18 00:05:57 +02:00