🛡️ Stale Virtual Environment Prevention System
Critical developer experience enhancement - Comprehensive 6-layer strategy to prevent "stale venv vs source code" version mismatches that caused the v8.23.0 tag validation bug to persist despite the v8.22.2 fix.
🔍 Root Cause Solved
Problem: MCP servers load from site-packages, not source files. System restart doesn't help - it relaunches with the same stale package. This caused source code to show v8.23.0 while venv had v8.5.3, making the tag validation fix appear broken.
Solution: Multi-layer prevention system that automatically guides developers to use pip install -e . for proper editable installs.
✨ What's New
🛡️ Phase 1: Automated Detection
- New Script:
scripts/validation/check_dev_setup.py- Validates source/venv version consistency, detects editable installs - Enhanced Pre-commit Hook: Blocks commits when venv is stale, provides actionable error messages
- Documentation: Added CLAUDE.md development setup section with explicit
pip install -e .guidance
⚠️ Phase 2: Runtime Warnings
- Server Checks: New
check_version_consistency()function inserver.pywarns on startup if versions mismatch - Developer Docs: Updated README.md developer section and
docs/development/ai-agent-instructions.mdwith proper setup commands
🤖 Phase 3: Interactive Onboarding
- Smart Install:
install.pynow detects developer mode (checks for git repo) and prompts for editable install - CI/CD Validation: New workflow
.github/workflows/dev-setup-validation.ymlwith 5 comprehensive test jobs:- Version consistency validation
- Pre-commit hook functionality
- Server startup warnings
- Interactive developer prompts
- Documentation accuracy checks
🎯 6-Layer Prevention System
| Layer | Component | Function |
|---|---|---|
| 1. Development | Pre-commit hook + detection script | Block bad commits, validate setup |
| 2. Runtime | Server startup checks | Catch edge cases with warnings |
| 3. Documentation | CLAUDE.md, README.md, ai-agent-instructions.md | Explicit guidance for developers |
| 4. Automation | check_dev_setup.py, pre-commit hook | Automated validation |
| 5. Interactive | install.py developer detection | Guided onboarding experience |
| 6. Testing | CI/CD workflow | Continuous validation of all mechanisms |
📦 Installation
For Developers
# Clone repository
git clone https://github.com/doobidoo/mcp-memory-service.git
cd mcp-memory-service
# Install in editable mode (CRITICAL for development)
pip install -e .
# Verify setup
python scripts/validation/check_dev_setup.pyFor Users
# Standard installation (unchanged)
python scripts/installation/install.py🔄 Migration Notes
- For Developers: Run
pip install -e .to install in editable mode (will be prompted by install.py) - For Users: No action required - prevention system is transparent for production use
- Pre-commit Hook: Automatically installed during
install.py, validates on every commit
🐛 Commits Included
670fb74- Phase 1: Automated detection (check_dev_setup.py, pre-commit hook, CLAUDE.md)9537259- Phase 2: Runtime warnings (server.py) + developer documentationa17bcc7- Phase 3: Interactive onboarding (install.py) + CI/CD validation
📁 Files Modified
scripts/validation/check_dev_setup.py- NEW automated detection scriptscripts/hooks/pre-commit- Enhanced with venv validationCLAUDE.md- Added development setup guidancesrc/mcp_memory_service/server.py- Added runtime version checkREADME.md- Updated developer sectiondocs/development/ai-agent-instructions.md- Updated setup commandsscripts/installation/install.py- Added developer detection.github/workflows/dev-setup-validation.yml- NEW CI/CD validation
📚 Documentation
- CHANGELOG.md - Complete changelog entry
- CLAUDE.md - Developer guidance
- README.md - Updated installation instructions
Full Changelog: v8.23.0...v8.23.1