mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-08 16:39:42 +02:00
test: add memory leak prevention pattern tests (P1)
Add comprehensive tests for the cleanup patterns used to prevent memory leaks in long-running sessions: - Task description cache with TTL expiration - Promise callback null-after-rejection pattern - Event listener tracking and removal - DOM handler storage for frontend cleanup - Timer/interval management - Map cleanup patterns and safe iteration - WeakRef/WeakMap usage patterns - Cleanup order verification (LIFO) Update CLAUDE.md with reference to new test file. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -191,6 +191,7 @@ Use `LRUMap` for bounded caches with eviction, `StaleExpirationMap` for TTL-base
|
||||
| **Error codes** | `createErrorResponse()` in `src/types.ts` |
|
||||
| **Test fixtures** | `test/e2e/fixtures/` |
|
||||
| **Test utilities** | `test/respawn-test-utils.ts` |
|
||||
| **Memory leak patterns** | `test/memory-leak-prevention.test.ts` |
|
||||
| **Keyboard shortcuts** | README.md or App Settings in web UI |
|
||||
| **Plan orchestrator** | `src/plan-orchestrator.ts` file header |
|
||||
| **Agent prompts** | `src/prompts/` directory |
|
||||
@@ -227,3 +228,9 @@ When adding new event listeners or timers:
|
||||
1. Store handler references for later removal
|
||||
2. Add cleanup to appropriate `stop()` or `cleanup*()` method
|
||||
3. For singleton watchers, store refs in class properties and remove in server `stop()`
|
||||
|
||||
### Verification Tests
|
||||
Memory leak prevention patterns are tested in `test/memory-leak-prevention.test.ts`. Run with:
|
||||
```bash
|
||||
npx vitest run test/memory-leak-prevention.test.ts
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user