fix(client): reject empty player name in NewGame.construct (contract minLength:1)

Whole-branch review flagged that NewGame.construct validated class and
origin refs but not player.name. The canon-log schema requires
player.name with minLength:1, so a missing/blank name previously
returned ok:true and produced a log the API would reject with 422.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-09 15:03:18 -05:00
parent 2d52d74963
commit 63ce3efb74
2 changed files with 15 additions and 0 deletions

View File

@@ -19,6 +19,9 @@ static func construct(origin: Dictionary, world: ContentDB, creation: Dictionary
if class_id not in allowed:
errors.append("class not allowed by origin: %s" % class_id)
if creation.get("name", "").strip_edges() == "":
errors.append("player name is required")
if not errors.is_empty():
return {"ok": false, "errors": errors, "log": null, "state": null}