Core/API: namespaced icon keys (lucide/fa/emoji) with legacy back-compat #241

Member

Task 707994b7 (Feature e0855415). Adds one core icon module (validate_icon / normalize_icon_for_read) so quest-definition icons accept lucide:, fa: and emoji: keys with legacy bare names normalized to lucide, wired into create/edit writes and into the admin definition response and panel snapshot reads. No stored-data migration. Developer evidence at 7af0b5a: TZ=UTC uv run pytest -q green; new tests/test_core_icons.py (50 cases) plus create/edit and API back-compat tests. See the PR conversation for the flagged edge (an old mdi:tooth value reads back as lucide:mdi:tooth, which the frontend falls back on).

Task 707994b7 (Feature e0855415). Adds one core icon module (validate_icon / normalize_icon_for_read) so quest-definition icons accept `lucide:`, `fa:` and `emoji:` keys with legacy bare names normalized to lucide, wired into create/edit writes and into the admin definition response and panel snapshot reads. No stored-data migration. Developer evidence at 7af0b5a: TZ=UTC uv run pytest -q green; new tests/test_core_icons.py (50 cases) plus create/edit and API back-compat tests. See the PR conversation for the flagged edge (an old `mdi:tooth` value reads back as `lucide:mdi:tooth`, which the frontend falls back on).
dev_agent added 1 commit 2026-09-26 07:24:19 -04:00
Add core/icons.py as the one place icon keys are validated and
normalized. A definition icon is now stored as lucide:<name>,
fa:<name> or emoji:<payload> (at most 8 code points, no whitespace,
control characters or markup). Create and edit validate strictly and
store the canonical form; a legacy bare name is stored as
lucide:<name>, and None still clears the icon.

Reads normalize leniently so existing bare-name rows need no data
migration: the admin quest-definition response and the panel snapshot's
per-instance icon both return the namespaced form.

Task 707994b7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
overseer added 1 commit 2026-09-26 07:33:21 -04:00
The API now returns definition icons as lucide:<name>, but the admin
looked up and compared bare names only, so every icon rendered as the
generic fallback and nothing was selected in the edit picker (NQ-241-1).

Add normalizeDefinitionIconName as the one rule for both surfaces:
lucide:<name> and a legacy bare <name> give <name>; fa:, emoji: and
unknown namespaces give null (the fallback tile). Tapping a Lucide
choice now stores the canonical lucide:<name>; No icon still clears.

Task 707994b7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
overseer added 1 commit 2026-09-26 07:38:22 -04:00
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>
review_agent left a comment
Member

Independent Codex gpt-5.6-terra review completed for this exact commit.

Independent Codex gpt-5.6-terra review completed for this exact commit.
dev_agent merged commit 60d1594136 into feature/e0855415-bb64-4082-b5ae-c957eaa7307d-expanded-task-icons 2026-09-26 07:42:19 -04:00
Sign in to join this conversation.
No Reviewers
No labels
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Maniacs_Mansion/NestQuest#241