PERSISTENCE BUG TESTING
Documentation for Plans
๐งช Universe Persistence Bug - Diagnostic Testing
Date: November 3, 2025
Status: DIAGNOSTIC LOGGING ADDED
Goal: Find why universes disappear after refresh
๐ฌ What Was Added
Enhanced logging in SpaceService to trace every step:
- Universe Loading - Shows what universeIds the space has
- Storage Checks - Verifies each universe exists in storage
- Validation - Shows spaceId comparison for each universe
- Merge Logic - Shows what IDs are merged from backend/local
- Backend Sync - Shows what backend returns after sync
๐งช Test Procedure
Step 1: Clear Browser State
IMPORTANT: Start fresh to avoid old data interfering
- Open DevTools Console (F12)
- Run:
clearCachedSpaceData() - Or manually: Clear IndexedDB โ Delete "gograb-space" database
- Refresh page
NEW: You can also run debugUniverseStorage() at any time to see:
- All universes in storage
- Their spaceIds
- Validation status
Step 2: Create Universe
- Navigate to:
http://localhost:5200/chrome-space-1/dashboard - Click "Create Universe"
- Fill form:
- Name: "Test Universe Persist"
- Description: "Testing persistence"
- Click "Create Universe"
- WATCH CONSOLE: Look for these logs:
[SpaceService] ๐พ Universe saved to local storage [SpaceService] ๐ Syncing space to backend with new universe... [SpaceService] โ Space synced to backend with universeIds
Step 3: Navigate to Space Map
- Should see universe in the overview
- WATCH CONSOLE: Look for:
[SpaceService] ๐ Loading universes for space: [SpaceService] ๐ Checking universe from storage: [SpaceService] ๐ Validating universe: [SpaceService] โ Universe INCLUDED: Test Universe Persist
Step 4: Refresh Page (THE CRITICAL TEST)
- Press F5 to refresh
- WATCH CONSOLE CAREFULLY: Look for:
[SpaceService] ๐ Merging validated universeIds from local storage: [SpaceService] ๐ Backend returned after sync: [SpaceService] ๐ Loading universes for space: [SpaceService] ๐ Checking universe from storage: [SpaceService] ๐ Validating universe:
Step 5: Navigate to Dashboard
- Click "Dashboard" in sidebar
- WATCH CONSOLE: Look for universe validation logs
- Check dashboard: Does it show 0 or 1 universe?
๐ What To Look For
โ GOOD SIGNS (Universe Persists)
[SpaceService] ๐ Validating universe:
universeId: "universe_xxxxx"
universeName: "Test Universe Persist"
universeSpaceId: "69067c087ebb621cd9ff8c3f" โ
Has spaceId
currentSpaceId: "69067c087ebb621cd9ff8c3f" โ
Matches
hasSpaceId: true โ
idsMatch: true โ
willBeIncluded: true โ
[SpaceService] โ
Universe INCLUDED: Test Universe Persist
โ BAD SIGNS (Universe Lost)
Missing spaceId:
[SpaceService] โ Universe missing spaceId property, filtering out
universeSpaceId: undefined โ No spaceId!
currentSpaceId: "69067c087ebb621cd9ff8c3f"
Space ID Mismatch:
[SpaceService] โ Universe does not belong to current space
universeSpaceId: "some-other-space-id" โ Wrong spaceId!
currentSpaceId: "69067c087ebb621cd9ff8c3f"
Not Found in Storage:
[SpaceService] โ Universe not found in storage
universeId: "universe_xxxxx" โ Not in storage!
storageKey: "universe_universe_xxxxx"
Backend Returned Empty:
[SpaceService] ๐ Backend returned after sync:
returnedUniverseIds: [] โ Backend lost data!
returnedCount: 0
sentCount: 1
๐ Copy ALL Console Logs
When you see the issue, copy the ENTIRE console output from:
- Universe creation
- Navigation to space-map
- Page refresh
- Navigation to dashboard
Send the logs so we can pinpoint the exact failure point.
๐ก Expected Diagnosis
The enhanced logging will reveal ONE of these issues:
- Universe not saved with spaceId โ Fix createUniverse()
- Space ID changed between creation and reload โ Fix initializeSpace()
- Backend not returning universeIds โ Fix backend API
- Storage key mismatch โ Fix storage.get() key
- Merge logic filtering out valid universes โ Fix merge validation
Ready to test! ๐
Run the test procedure and share the console logs.