cultnet-py: schema catalog describes cultnet.error.v0 as the contract does
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 one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest reactive semantics and leases (pull_request) Has been cancelled
CultNet cross-runtime interop / C# / TypeScript / Rust / Python / Kotlin (pull_request) Has been cancelled
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
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 one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest reactive semantics and leases (pull_request) Has been cancelled
CultNet cross-runtime interop / C# / TypeScript / Rust / Python / Kotlin (pull_request) Has been cancelled
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
Required is the contract's five keys (schemaVersion, error, routingHint, code, details), code is the closed enum (or null), details and routingHint are object-or-null, and the catalog has no messageId property, as cultnet.error.schema.json is closed. The test compares required, property names and the code enum to the contract file instead of pinning the stale two-key form. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b88beddecb
commit
81aeb60c57
2 changed files with 20 additions and 7 deletions
|
|
@ -12,6 +12,17 @@ PEER_EXCHANGE_REQUEST = "cultmesh.peer_exchange_request.v0"
|
|||
TRANSPORT_PROFILE_SCHEMA_VERSION = "cultnet.transport_profile.v0"
|
||||
TRANSPORT_PROFILE_SCHEMA_ID = f"{CULTNET_SCHEMA_BASE}/cultnet.transport-profile.schema.json"
|
||||
|
||||
# The closed code set of contracts/cultnet/cultnet.error.schema.json; a code outside it is one coordinated change across every runtime.
|
||||
CULTNET_ERROR_CODES = (
|
||||
"selection_invalid",
|
||||
"cursor_stale",
|
||||
"cursor_invalid",
|
||||
"reference_outside_target",
|
||||
"variant_unsupported",
|
||||
"unowned_schema",
|
||||
"write_not_authorized",
|
||||
)
|
||||
|
||||
WIRE_MESSAGE_SCHEMA_VERSIONS = (
|
||||
("cultnet.hello.v0", "CultNet Hello Message", f"{CULTNET_SCHEMA_BASE}/cultnet.hello.schema.json"),
|
||||
("cultnet.error.v0", "CultNet Error Message", f"{CULTNET_SCHEMA_BASE}/cultnet.error.schema.json"),
|
||||
|
|
@ -269,7 +280,7 @@ def shared_contract_schema_json(schema_id: str, title: str, schema_version: str)
|
|||
def wire_message_required_fields(schema_version: str) -> list[str]:
|
||||
required = {
|
||||
"cultnet.hello.v0": ["schemaVersion", "runtimeId"],
|
||||
"cultnet.error.v0": ["schemaVersion", "error"],
|
||||
"cultnet.error.v0": ["schemaVersion", "error", "routingHint", "code", "details"],
|
||||
"cultnet.login.v0": ["schemaVersion", "nonce", "auth", "password"],
|
||||
"cultnet.register.v0": ["schemaVersion", "nonce", "email", "password", "name"],
|
||||
"cultnet.verify.v0": ["schemaVersion", "nonce", "session"],
|
||||
|
|
@ -355,10 +366,10 @@ def wire_message_schema_properties(schema_version: str) -> dict[str, Any]:
|
|||
"supportsSchemaCatalog": {"type": "boolean"},
|
||||
},
|
||||
"cultnet.error.v0": {
|
||||
"messageId": common["messageId"],
|
||||
"error": {"type": "string"},
|
||||
"code": {"type": "string"},
|
||||
"details": {"type": "object", "additionalProperties": True},
|
||||
"error": {"type": "string", "minLength": 1},
|
||||
"routingHint": {"type": ["object", "null"]},
|
||||
"code": {"type": ["string", "null"], "enum": [None, *CULTNET_ERROR_CODES]},
|
||||
"details": {"type": ["object", "null"]},
|
||||
},
|
||||
"cultnet.login.v0": {
|
||||
"nonce": {"type": "string", "minLength": 1},
|
||||
|
|
|
|||
|
|
@ -2235,9 +2235,11 @@ class CultNetTests(unittest.TestCase):
|
|||
self.assertEqual(delete_schema["properties"]["recordKey"]["type"], "string")
|
||||
|
||||
error_schema = json.loads(by_version["cultnet.error.v0"]["schemaJson"])
|
||||
self.assertEqual(error_schema["required"], ["schemaVersion", "error"])
|
||||
contract = json.loads((Path(__file__).resolve().parents[3] / "contracts" / "cultnet" / "cultnet.error.schema.json").read_text(encoding="utf-8"))
|
||||
self.assertEqual(error_schema["required"], contract["required"])
|
||||
self.assertEqual(sorted(error_schema["properties"]), sorted(contract["properties"]))
|
||||
self.assertEqual(error_schema["properties"]["error"]["type"], "string")
|
||||
self.assertIn("details", error_schema["properties"])
|
||||
self.assertEqual(error_schema["properties"]["code"]["enum"], contract["properties"]["code"]["enum"])
|
||||
|
||||
login_schema = json.loads(by_version["cultnet.login.v0"]["schemaJson"])
|
||||
self.assertEqual(login_schema["required"], ["schemaVersion", "nonce", "auth", "password"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue