fix(scripts): guard persist_design_system against None project_name (#159)#388
Merged
mrgoonie merged 1 commit intoJun 25, 2026
Conversation
persist_design_system crashed with AttributeError: 'NoneType' object has
no attribute 'lower' when the design_system dict carries an explicit
project_name of None (the default of generate(query, project_name=None)).
dict.get("project_name", "default") only substitutes the default for a
MISSING key, not a present-but-None value, so project_name.lower() blew
up.
Coalesce falsy values (None/""/missing) to "default" before slugifying.
Applied to both the source of truth and the bundled cli/assets copy.
The "search blindness" half of nextlevelbuilder#159 (core.py tokenize length filter) is
already resolved on main (`len(w) >= 2`), so this targets the remaining
crash only.
Closes nextlevelbuilder#159
Co-authored-by: YangKuoshih <155388493+YangKuoshih@users.noreply.github.com>
mrgoonie
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
persist_design_systemcrashes withAttributeError: 'NoneType' object has no attribute 'lower'(#159) when thedesign_systemdict carries an explicitproject_nameofNone:dict.get(key, default)only substitutes the default for a missing key, not a present-but-Nonevalue — andgenerate(query, project_name=None)is the documented default, so aNonereaches here easily.Fix
Coalesce falsy values (
None/""/ missing) to"default"before slugifying:Applied to both the source of truth (
src/ui-ux-pro-max/scripts/) and the bundledcli/assets/copy.Verification
npm run check:assetspasses (both copies in sync).Scope
#159 also cited the
core.pytokenize length filter ("search blindness"); that's already resolved onmain(len(w) >= 2), so this PR targets only the remaining crash.Supersedes #160 (same root cause; this version coalesces
""as well and keeps the two script copies in sync). Credit to @YangKuoshih for the original diagnosis and fix.Closes #159