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:
@@ -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}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user