## Critical Bugs Fixed ### 1. UnboundLocalError in AI Enhancement Modules (BLOCKING) **Issue**: Duplicate `import os` statements inside conditional blocks caused UnboundLocalError when accessing os.environ before the import was reached. **Files Fixed**: - src/skill_seekers/cli/guide_enhancer.py (lines 92, 112) - src/skill_seekers/cli/ai_enhancer.py (line 77) - src/skill_seekers/cli/config_enhancer.py (line 82) **Root Cause**: `os` was already imported at file top, but re-imported inside conditional blocks, creating a local variable scope issue. **Solution**: Removed duplicate import statements - os is already available from the top-level import. **Impact**: Fixed 30 failing guide_enhancer tests ### 2. PDF Scraper Test Expectations (BREAKING CHANGE) **Issue**: Tests expected old keyword-based categorization behavior, but PR introduced new single-file strategy for single PDF sources. **Files Fixed**: - tests/test_pdf_scraper.py (5 tests updated) **Tests Updated**: 1. test_categorize_by_keywords 2. test_build_skill_creates_reference_files 3. test_code_blocks_included_in_references 4. test_high_quality_code_preferred 5. test_image_references_in_markdown **Solution**: Updated test expectations to match new single-file strategy behavior (single PDF → single category named after PDF basename). **Impact**: Fixed 5 failing PDF scraper tests ## Test Results **Before Fixes**: 35 tests failing **After Fixes**: 130 tests passing, 5 skipped ✅ ### Tested Modules: - ✅ PDF scraper (18 tests) - ✅ Guide enhancer (30 tests) - ✅ All adaptors (82 tests) ## Verification ```bash pytest tests/test_pdf_scraper.py tests/test_guide_enhancer.py tests/test_adaptors/ -v # Result: 130 passed, 5 skipped in 1.11s ``` ## Notes The original PR features (GLM-4.7 support + PDF scraper improvements) are excellent and working correctly. These fixes only address the import scoping bug introduced during implementation and update tests for the new behavior. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
18 KiB
18 KiB