PROBLEM: Tests written for filesystem-based v1/v2, but service refactored to MongoDB v3
- 18/25 tests failing (expected filesystem, got MongoDB)
- Tests checking for .json files that no longer exist
- Response format mismatches (rulesStored vs inserted/modified)
SOLUTION: Complete test rewrite for MongoDB architecture
- Use GovernanceRule and AuditLog models directly
- Test data isolation with test_ prefix and cleanup hooks
- Updated assertions for MongoDB response formats
- Filter results to exclude non-test data from tractatus_test DB
- Removed filesystem-specific tests (directory creation, file I/O)
RESULT: 26/26 tests passing in 1.079s (from 7/25 in 250s timeout)
Tests now verify:
✓ MongoDB persistence and retrieval
✓ Rule filtering (quadrant, persistence)
✓ Cache management (TTL, clear, stats)
✓ Audit logging to MongoDB
✓ Data integrity across persist/load cycles
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed sync script disconnecting Mongoose (prevents production errors)
- Created text search index (fixes search in rule-manager)
- Enhanced inst_024 with closedown protocol, added inst_061
- Added sync infrastructure: API routes, dashboard widget, auto-sync
- Fixed MemoryProxy tests MongoDB connection
- Created ADR-001 and integration tests
Result: Production stable, 52 rules synced, search working
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>