TEST SPACE SLUG FIX
Documentation for Plans
๐งช Test Plan: Space Slug Fix
Date: October 31, 2025
Status: โ
READY TO TEST
Estimated Time: 5 minutes
โก QUICK START
Step 1: Clear Old Data
Open browser console (F12) and run:
await clearCachedSpaceData();
Expected output:
๐งน Starting cache cleanup...
โ
Deleted all localStorage gg: keys
โ
Deleted IndexedDB database: gograb-space
โ
Cache cleanup complete!
Step 2: Hard Reload
Press Ctrl+Shift+R (or Cmd+Shift+R on Mac)
Step 3: Login
- Email:
[email protected] - Password: Your password
Step 4: Test Slug Stability
Navigate to these URLs one at a time:
http://localhost:5200/test-123/dashboard
http://localhost:5200/whatever/editor
http://localhost:5200/random-slug/space-map
http://localhost:5200/this-should-not-work/modularity
โ EXPECTED RESULTS
What Should Happen:
Initial Navigation:
You navigate to: /test-123/dashboard Browser redirects to: /my-space/dashboard โCheck Console Logs:
[SpaceGuard] Checking space access: { spaceSlug: "test-123", url: "/test-123/dashboard", deploymentMode: "development" โ } [SpaceGuard] Development mode: Loading user space (ignoring URL slug) โ [SpaceGuard] Space slug mismatch, redirecting to correct slug: { provided: "test-123", actual: "my-space" โ }Check Dashboard:
- Current Space section shows:
- NAME:
My space - SLUG:
my-spaceโ (ALWAYS!)
- NAME:
- Current Space section shows:
Subsequent Navigations:
- ALL URLs redirect to
/my-space/* - Space slug NEVER changes
- No more "space-test-should-not-work" or other random slugs
- ALL URLs redirect to
โ FAILURE SCENARIOS
If you see:
- Space slug changes based on URL โ Fix not working
- Console shows
deploymentMode: undefinedโ Provider not configured - Console shows
deploymentMode: "subdomain"โ Wrong environment - No auto-redirect happens โ Guard logic not executing
๐ DETAILED VERIFICATION
Console Logs to Check:
Deployment Mode Injection:
[SpaceGuard] Checking space access: { deploymentMode: "development" โ MUST be "development" }Space Initialization:
[SpaceGuard] Initializing space for authenticated user: { userId: "68fbe3ac4740d821e041f9df", spaceSlug: "test-123", โ URL slug deploymentMode: "development" } [SpaceGuard] Development mode: Loading user space (ignoring URL slug) โ Key message!Space Service:
[SpaceService] ๐ Initializing space (API-first mode) โโ userId: "68fbe3ac4740d821e041f9df", spaceSlug: undefined, โ MUST be undefined in dev mode! isOnline: trueFinal Space State:
[SpaceGuard] Space initialized for authenticated user: { spaceId: "space_68fbe3ac4740d821e041f9df", spaceSlug: "my-space", โ ALWAYS "my-space" name: "My space" }
๐ฏ TEST MATRIX
| Test Case | URL | Expected Slug | Expected Redirect | Status |
|---|---|---|---|---|
| Random slug #1 | /test-123/dashboard |
my-space |
/my-space/dashboard |
โณ |
| Random slug #2 | /whatever/editor |
my-space |
/my-space/editor |
โณ |
| Random slug #3 | /random-slug/space-map |
my-space |
/my-space/space-map |
โณ |
| Long slug | /this-should-not-work/modularity |
my-space |
/my-space/modularity |
โณ |
| Correct slug | /my-space/dashboard |
my-space |
No redirect (already correct) | โณ |
๐ DEBUGGING
If Deployment Mode is Wrong:
Check apps/gograb-space/src/environments/environment.ts:
deploymentMode: DEPLOYMENT_MODES.development, // โ MUST be "development"
If Space Slug Still Changes:
- Check if
clearCachedSpaceData()was run - Check browser console for errors
- Verify
space.guard.tschanges were loaded (check timestamp) - Check if serve process needs restart
If Build Fails:
The core-angular library has circular dependencies with other libs.
The changes I made don't require rebuilding those libs, they only need:
apps/gograb-spaceto restart (happens automatically with nx serve)- Browser to reload with cleared cache
๐ SUCCESS CRITERIA
โ
All test cases show my-space as the space slug
โ
All URLs auto-redirect to /my-space/* path
โ
Console logs show deploymentMode: "development"
โ
Console logs show spaceSlug: undefined in initializeSpace
โ
Dashboard consistently shows SLUG: my-space
โ
No more random slugs appearing
๐ AFTER TESTING
Once verified working:
- Mark test cases as โ in the matrix above
- Update
progress-tracking.mdwith completion - Commit changes with message:
feat: implement development mode routing for stable space slugs - Celebrate! ๐
End of Test Plan | Ready to execute!