Reject edge whitespace and controls in icon keys instead of trimming

validate_icon stripped the whole value before validating, so
`emoji:🐕 `, `emoji:🐕\n` and `emoji:🐕\x1c` were silently accepted as
`emoji:🐕`. Validate the raw namespace, name and emoji payload; a
whitespace-only value still clears the icon. Padded keys such as
`lucide:dog ` are now rejected naming `icon` (NQ-241-3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-26 07:38:18 -04:00
co-authored by Claude Opus 5.5
parent a64b619bee
commit 430f8abc12
3 changed files with 18 additions and 11 deletions
+2 -2
View File
@@ -106,7 +106,7 @@ def test_create_one_child_one_window(tmp_path) -> None:
[child.id],
["morning"],
description=" Twice daily ",
icon=" lucide:tooth ",
icon="lucide:tooth",
)
assert isinstance(result, CreatedQuestDefinition)
definition = result.definition
@@ -625,7 +625,7 @@ def test_edit_title_description_icon(tmp_path) -> None:
created.definition.id,
title=" Floss ",
description=" New description ",
icon=" fa:new ",
icon="fa:new",
)
assert result.definition.title == "Floss"
assert result.definition.description == "New description"