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:
@@ -87,6 +87,18 @@ func test_unresolved_origin_is_rejected():
|
||||
assert_true("unresolved ref: location:nowhere" in res["errors"])
|
||||
|
||||
|
||||
func test_empty_name_is_rejected():
|
||||
var missing_name := _build({"class_id": "sellsword"})
|
||||
assert_false(missing_name["ok"])
|
||||
assert_true(missing_name["errors"].size() > 0)
|
||||
assert_null(missing_name["log"])
|
||||
|
||||
var whitespace_name := _build({"name": " ", "class_id": "sellsword"})
|
||||
assert_false(whitespace_name["ok"])
|
||||
assert_true(whitespace_name["errors"].size() > 0)
|
||||
assert_null(whitespace_name["log"])
|
||||
|
||||
|
||||
func test_non_companion_override_goes_to_state_not_log():
|
||||
world.npcs["oda_fenn"] = {"id": "oda_fenn", "name": "Oda Fenn", "role": "npc"}
|
||||
var o := _deserter()
|
||||
|
||||
Reference in New Issue
Block a user