---
phase: 23-verification
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
  - .planning/phases/23-verification/23-UAT.md
autonomous: false

must_haves:
  truths:
    - "All existing Playwright tests pass without regressions"
    - "Manual UAT checklist exists for memory verification"
    - "User can verify session stability with documented steps"
  artifacts:
    - path: ".planning/phases/23-verification/23-UAT.md"
      provides: "Manual verification checklist for memory leaks"
      contains: "15+ minutes"
  key_links:
    - from: "Phase 20 fixes"
      to: "VU meter verification steps"
      via: "UAT checklist section"
    - from: "Phase 21 fixes"
      to: "Chat verification steps"
      via: "UAT checklist section"
    - from: "Phase 22 fixes"
      to: "Session cleanup verification steps"
      via: "UAT checklist section"
---

<objective>
Verify all memory leak fixes from Phases 20-22 work correctly through automated regression tests and manual memory profiling checklist.

Purpose: Confirm v1.4 Memory Leak Prevention milestone is complete before shipping
Output: Passing test suite + UAT.md checklist for human verification
</objective>

<execution_context>
@/Users/nuwan/.claude/get-shit-done/workflows/execute-plan.md
@/Users/nuwan/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/20-vumeter-fixes/20-01-SUMMARY.md
@.planning/phases/21-chat-window-fixes/21-01-SUMMARY.md
@.planning/phases/22-session-screen-fixes/22-01-SUMMARY.md
</context>

<tasks>

<task type="auto">
  <name>Task 1: Run Playwright regression tests</name>
  <files>N/A (test execution only)</files>
  <action>
Execute all existing Playwright tests to verify memory leak fixes don't introduce regressions.

Run command:
```bash
cd /Users/nuwan/Code/jam-cloud/jam-ui && npx playwright test --config=playwright.chrome.config.ts
```

If any tests fail:
1. Document which tests failed
2. Analyze if failures are related to Phase 20-22 changes or pre-existing issues
3. Note pre-existing failures (documented in STATE.md deferred issues) vs new failures

Key test areas to verify pass:
- chat/*.spec.ts (chat functionality)
- attachments/*.spec.ts (attachment functionality)
- session-settings/*.spec.ts (session settings)
- e2e/*.spec.ts (end-to-end flows)
  </action>
  <verify>Test execution completes and results are documented</verify>
  <done>Playwright test results captured showing pass/fail status for all test files</done>
</task>

<task type="auto">
  <name>Task 2: Create UAT checklist for manual memory verification</name>
  <files>.planning/phases/23-verification/23-UAT.md</files>
  <action>
Create comprehensive UAT checklist for manual memory leak verification. Memory profiling requires human interaction with browser dev tools and cannot be fully automated.

UAT.md must include:

**Header:**
```markdown
---
phase: 23-verification
type: uat
status: pending
---

# Phase 23: Memory Leak Verification UAT

## Prerequisites
- Browser: Chrome (recommended for DevTools memory profiling)
- DevTools open with Performance Monitor and Memory tabs
- jam-ui running locally (npm run start)
- web backend running (./runweb)
```

**Section 1: VU Meter Verification (Phase 20 fixes)**
Steps to verify vuStates cleanup:
1. Open React DevTools, find VuContext provider
2. Join session with tracks
3. Note initial vuStates keys
4. Add/remove tracks multiple times
5. Verify vuStates only contains active mixer IDs (no orphaned entries)

**Section 2: Chat Memory Verification (Phase 21 fixes)**
Steps to verify bounded messages and cleanup:
1. Open session, open chat window
2. Send 10+ messages
3. Open Redux DevTools, check sessionChat.messages array
4. Close session (leave button)
5. Verify sessionChat.messages is empty
6. Verify no memory growth after repeated open/close cycles

**Section 3: Session Screen Verification (Phase 22 fixes)**
Steps to verify callback cleanup:
1. Join session
2. Leave session via button
3. Navigate back to dashboard
4. Join again
5. Verify no duplicate callbacks registered (check console for warnings)

**Section 4: 15-Minute Stability Test (VRFY-01)**
Extended session test:
1. Join session
2. Open/close chat window 5 times
3. Show/hide VU meters 5 times
4. Leave and rejoin session 3 times
5. Keep session active for 15+ minutes
6. Verify app remains responsive (no freezes)

**Section 5: Memory Growth Check (VRFY-02)**
Using Chrome DevTools:
1. Open Performance Monitor (More tools > Performance monitor)
2. Note initial JS heap size
3. Perform all actions from Section 4
4. Take heap snapshot
5. Verify heap doesn't show unbounded growth (should stabilize)

**Verification Results Section:**
Template for recording pass/fail with timestamps and notes.
  </action>
  <verify>File exists at .planning/phases/23-verification/23-UAT.md with all 5 sections</verify>
  <done>UAT.md contains comprehensive checklist covering VU meters, chat, session screen, 15-min stability, and memory growth verification</done>
</task>

<task type="checkpoint:human-verify" gate="blocking">
  <name>Task 3: Execute manual memory verification</name>
  <what-built>Automated tests passed (Task 1) and UAT checklist created (Task 2)</what-built>
  <how-to-verify>
Follow the UAT checklist in `.planning/phases/23-verification/23-UAT.md`:

1. **Quick verification (5 min):**
   - Join session, open/close chat 3 times
   - Show/hide VU meters 3 times
   - Verify no console errors
   - App should remain responsive

2. **Full verification (15+ min):**
   - Complete all sections in UAT.md
   - Record results in the verification results section

3. **Memory check:**
   - Open Chrome DevTools > Performance Monitor
   - Note JS heap size before and after test
   - Should stabilize, not grow unbounded

Expected results:
- No console errors related to cleanup
- No memory growth patterns visible
- App remains responsive throughout
  </how-to-verify>
  <resume-signal>Type "approved" with brief summary of results, or describe any issues found</resume-signal>
</task>

</tasks>

<verification>
1. Playwright tests: All tests pass or failures documented as pre-existing
2. UAT.md: File exists with complete checklist
3. Manual verification: User confirms session stability
</verification>

<success_criteria>
1. All existing Playwright tests pass (no new regressions from Phase 20-22 changes)
2. UAT.md created with comprehensive memory verification checklist
3. User executes manual verification and confirms:
   - Session remains stable for 15+ minutes (VRFY-01)
   - Memory usage doesn't grow unbounded (VRFY-02)
</success_criteria>

<output>
After completion, create `.planning/phases/23-verification/23-01-SUMMARY.md`

Update UAT.md status from `pending` to `passed` or `failed` based on verification results.
</output>
