Skip to content

Feat/validate lucide icons#21

Merged
NeonDaniel merged 3 commits intoNeonGeckoCom:mainfrom
NeonCharlie-24:feat/validate-lucide-icons
Mar 23, 2026
Merged

Feat/validate lucide icons#21
NeonDaniel merged 3 commits intoNeonGeckoCom:mainfrom
NeonCharlie-24:feat/validate-lucide-icons

Conversation

@NeonCharlie-24
Copy link
Collaborator

Description

Adds Lucide icon name validation to Pydantic models. When a config file specifies an icon field, the value is now checked against the set of valid PascalCase Lucide icon names at load time. Invalid icons produce a ValidationError with a clear error message.

  • _IconValidatorMixin in config.py — a Pydantic model validator applied to FeatureConfig, ExampleCategory, and PersonaItemConfig
  • lucide_icons.py — reads a pre-generated JSON registry of 1,861 valid icon names
  • _lucide_icon_names.json — static registry generated from the installed lucide-react package
  • generate_icon_names.py — generator script that introspects the local lucide-react Node package exports to get the ground truth PascalCase names used by the front-end
  • 9 tests covering the icon registry, acceptance of valid icons across all three models, rejection of invalid icons, and default icon validation

Issues

Closes #6

Other Notes

  • One of the biggest trade-offs for this implementation is whether or not to regenerate the list of valid icon names on app startup. Since the list only changes if we change the lucide-react version on the front-end, it doesn't make sense to re-compute the static list every time we start the app. The name generation script will need to be run manually when we change the version, but a CI workflow can enforce that the committed icon list stays in sync with the installed package version.
  • The generator script requires node_modules to be installed in phd-advisor-frontend/ (npm ci or npm install). It does not require network access beyond the npm registry.
  • For persona YAML files, an invalid icon will cause the persona to be skipped at startup (with a warning log) rather than crashing the app. For top-level config icons (features, example categories), it will fail hard at startup.

Made with Cursor.

Copy link
Member

@NeonDaniel NeonDaniel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. In the future, we can run that script to update icon names in some GHA automation so things are always up-to-date

@NeonDaniel NeonDaniel merged commit 62a6005 into NeonGeckoCom:main Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Validate configured icons

2 participants