## 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>
CHANGES:
1. **Fixed 9 PDF Scraper Test Failures:**
- Added .get() safety for missing page keys (headings, text, code_blocks, images)
- Supported both 'code_samples' and 'code_blocks' keys for compatibility
- Fixed extract_pdf() to raise RuntimeError on failure (tests expect exception)
- Added image saving functionality to _generate_reference_file()
- Updated all test methods to override skill_dir with temp directory
- Fixed categorization to handle pre-categorized test data
2. **Fixed 25 MCP Test Skips:**
- Renamed mcp/ directory to skill_seeker_mcp/ to avoid shadowing external mcp package
- Updated all imports in tests/test_mcp_server.py
- Simplified skill_seeker_mcp/server.py import logic (no more shadowing workarounds)
- Updated tests/test_package_structure.py to reference skill_seeker_mcp
3. **Test Results:**
- ✅ 297 tests passing (100%)
- ✅ 0 tests skipped
- ✅ 0 tests failed
- All test categories passing:
* 23 package structure tests
* 18 PDF scraper tests
* 67 PDF extractor/advanced tests
* 25 MCP server tests
* 164 other core tests
BREAKING CHANGE: MCP server directory renamed from `mcp/` to `skill_seeker_mcp/`
📦 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>