mirror of
https://github.com/proffesor-for-testing/agentic-qe.git
synced 2026-09-19 08:45:47 +08:00
b3d2018ee2
Critical bug fixes and code quality improvements from brutal-honest-review. ## Critical Fixes (9/10 completed, 1 deferred) 1. Fixed Agent Pattern Isolation (CRITICAL) - Added SwarmMemoryManager.queryPatternsByAgent() - SQL filtering by agent_id in metadata - Each agent now isolated 2. Fixed Async Method Cascade - Changed getPatterns() to async - Fixed 10 callers across 6 files - Build passes 3. Fixed Misleading Logging - Added isRealAgentDB() detection - Honest mock vs real reporting 4. Consolidated Embedding Generation - Created EmbeddingGenerator utility - Removed 50+ duplicate lines 5. Added AgentDB Initialization Checks - Empty DB detection - HNSW index verification 6. Integration Test Suite - 26 new test cases - Error path coverage 7. Repository Cleanup - Removed 19 temp test files 8. New QE Skill: sherlock-review - Evidence-based investigative review - 38 QE skills total 9. Deferred: Wire Up Real Test Execution - Deferred to v1.9.0 (documented) ## Statistics - Fixes: 9/10 (90%, 1 deferred) - Files Modified: 16 - Files Created: 3 - Files Deleted: 19 - Integration Tests: 26 - Build: PASSING ## Breaking Changes - getPatterns() now async - add await 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3.4 KiB
3.4 KiB
⚠️ CRITICAL: Test Execution Rules
DO NOT RUN FULL INTEGRATION TESTS - WORKSPACE WILL CRASH
The Problem
Running all integration tests at once causes Out of Memory (OOM) errors that crash the DevPod workspace.
- 46 integration test files (40 main + 6 phase2)
- Each creates Database instances, agents, FleetManagers
- Running all 46 at once exceeds 768MB memory limit
- Result: Workspace crash, lost work, productivity loss
✅ ALWAYS Use These Commands
For Integration Tests
# ✅ CORRECT: Use batched execution
npm run test:integration
# This runs scripts/test-integration-batched.sh which:
# - Runs main tests in batches of 5 files
# - Runs phase2 tests individually
# - Includes cleanup between batches
For Other Test Types
# ✅ Unit tests (safe)
npm run test:unit
# ✅ Agent tests (safe)
npm run test:agents
# ✅ MCP tests (safe)
npm run test:mcp
# ✅ CLI tests (safe)
npm run test:cli
# ✅ Performance tests (safe, uses 1536MB limit)
npm run test:performance
# ✅ AgentDB tests (safe, uses 1024MB limit)
npm run test:agentdb
# ✅ Sequential execution (safe, runs one suite at a time)
npm run test:sequential
❌ NEVER Use These Commands
# ❌ DANGEROUS: Runs all 959 tests in parallel, causes OOM
npm test
# ❌ DANGEROUS: Loads all 46 integration files at once, causes OOM
npm run test:integration-unsafe
# ❌ DANGEROUS: Direct Jest execution without batching
jest tests/integration
# ❌ DANGEROUS: Direct Node execution without memory limits
node_modules/.bin/jest tests/integration
Why Batching Is Required
Memory Usage Per Test File
- Each integration test creates multiple objects:
- Database instances (SQLite connections)
- FleetManager instances
- Multiple agent instances
- Memory stores
- Event buses
- Logger instances
Without Batching
46 files × ~30MB per file = ~1,380MB
DevPod limit: 768MB
Result: OOM crash ❌
With Batching
5 files × ~30MB per file = ~150MB per batch
+ Cleanup between batches
= Stays under 768MB limit ✅
For Agent Developers
When working on code that requires integration testing:
-
Development/Testing: Test your specific file only
# Test a single file npm run test -- tests/integration/your-file.test.ts -
Before Commit: Use batched integration tests
npm run test:integration -
CI/CD: Already configured to use batched approach
For Code Reviews
Red flags to watch for:
- Direct
jest tests/integrationcommands npm testwithout contexttest:integration-unsafeusage- Missing memory limits in test commands
Monitoring Memory
If you need to check memory before running tests:
# Check available memory
free -h
# Check Node.js heap usage
node -e 'console.log(process.memoryUsage())'
# Run with memory tracking
npm run test:memory-track
Emergency Recovery
If workspace crashes:
- Restart DevPod workspace
- Don't run integration tests immediately
- Check memory:
free -h - Use batched approach:
npm run test:integration
Questions?
- See:
scripts/test-integration-batched.shfor batch implementation - See:
package.jsonscripts section for all test commands - See:
CLAUDE.mdfor full test execution policy
Last Updated: 2025-11-07 Status: CRITICAL - Must be followed by all agents and developers