cultnet-py: pin commitCount 2, the count the C# server writes for a swap
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Failing after 19m24s
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Successful in 48s
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Failing after 19m24s
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Successful in 48s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
630b970e06
commit
8c81e718d0
1 changed files with 23 additions and 0 deletions
|
|
@ -1600,6 +1600,29 @@ class CultNetTests(unittest.TestCase):
|
|||
with self.subTest(field=field, bad=bad), self.assertRaisesRegex(ValueError, field):
|
||||
CultNetDatabaseChange.from_wire({**base, field: bad})
|
||||
|
||||
def test_a_two_change_commit_from_the_csharp_server_parses(self) -> None:
|
||||
# CultNetDatabaseServer.DeliverCommit (CultNetDatabaseServer.cs:791-797) tags every change of a commit with its
|
||||
# commitId and commitCount = the number of changes delivered, so a swap of two records arrives with commitCount 2.
|
||||
# Shaped as the C# [MessagePackObject] writes it: every key present, nil where unset.
|
||||
swap = [
|
||||
{
|
||||
"schemaVersion": "cultnet.database_change_raw.v0",
|
||||
"messageId": f"change-{index}",
|
||||
"subscriptionId": "sub-1",
|
||||
"changeKind": "updated",
|
||||
"document": None,
|
||||
"recordKey": key,
|
||||
"schemaId": "schema-note",
|
||||
"commitId": "9f1c0f0e4b7a4c1f9d2e",
|
||||
"commitCount": 2,
|
||||
}
|
||||
for index, key in enumerate(("note:a", "note:b"))
|
||||
]
|
||||
changes = [CultNetDatabaseChange.from_wire(message) for message in swap]
|
||||
self.assertEqual([change.commit_count for change in changes], [2, 2])
|
||||
self.assertEqual({change.commit_id for change in changes}, {"9f1c0f0e4b7a4c1f9d2e"})
|
||||
self.assertEqual([change.to_wire()["commitCount"] for change in changes], [2, 2])
|
||||
|
||||
def test_cultnet_raw_put_helper_carries_message_id(self) -> None:
|
||||
put = document_put_raw(
|
||||
message_id="put-1",
|
||||
|
|
|
|||
Loading…
Reference in a new issue