Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Fix #159: Resolve AttributeError in design_system and search blindnes…#160

Open
YangKuoshih wants to merge 1 commit intonextlevelbuilder:mainfrom
YangKuoshih:fix-issue-159
Open

Fix #159: Resolve AttributeError in design_system and search blindnes…#160
YangKuoshih wants to merge 1 commit intonextlevelbuilder:mainfrom
YangKuoshih:fix-issue-159

Conversation

@YangKuoshih
Copy link

Closes #159

Description of Changes

This PR addresses the two specific bugs reported in issue #159 that were causing the design system generator to crash and search queries to fail for short acronyms.

1. AttributeError Fix (design_system.py)

The Problem: When calling persist_design_system without an explicit project_name (defaulting to None), the execution attempted to run project_name.lower(), resulting in an AttributeError.
The Fix: Added explicit handling to fallback checking if project_name is not None else "default", ensuring a valid string is always present before string manipulation occurs.

2. Search Blindness Fix (core.py)

The Problem: The BM25 algorithm's tokenize function was dropping any search query terms with a length of 2 or less. This created "search blindness" for critical industry acronyms like UI, UX, 3D, and AI.
The Fix: Updated the length filter constraint in core.py from > 2 to > 1 to allow 2-letter tokens to be properly indexed and searched against the CSV database.


QA & Testing Instructions

To verify these fixes locally, the following tests were conducted:

1. Testing project_name=None Fallback:
Ran a generation pass strictly passing no project name:
generate_design_system('SaaS dashboard', project_name=None, persist=True)

  • Result: Successfully created the ./design-system/default/ directory and wrote MASTER.md without crashing.

2. Testing Search Blindness Fix:
Ran design system generations using 2-letter queries that were previously ignored:
generate_design_system('UI dashboard', persist=True)
generate_design_system('UX dashboard', persist=True)

  • Result: The BM25 algorithm successfully parsed the queries, located the correct patterns in the CSV files, and generated tailored design systems for both "UI" and "UX" concepts without skipping the 2-letter terms.

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.

AttributeError Crash during File Persistence

1 participant