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

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:

  1. Initial Navigation:

    You navigate to: /test-123/dashboard
    Browser redirects to: /my-space/dashboard โœ…
    
  2. 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"  โœ…
    }
    
  3. Check Dashboard:

    • Current Space section shows:
      • NAME: My space
      • SLUG: my-space โœ… (ALWAYS!)
  4. Subsequent Navigations:

    • ALL URLs redirect to /my-space/*
    • Space slug NEVER changes
    • No more "space-test-should-not-work" or other random slugs

โŒ FAILURE SCENARIOS

If you see:


๐Ÿ” DETAILED VERIFICATION

Console Logs to Check:

  1. Deployment Mode Injection:

    [SpaceGuard] Checking space access: {
      deploymentMode: "development"  โ† MUST be "development"
    }
    
  2. 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!
    
  3. Space Service:

    [SpaceService] ๐Ÿš€ Initializing space (API-first mode)
    โ””โ”€ userId: "68fbe3ac4740d821e041f9df", 
       spaceSlug: undefined,  โ† MUST be undefined in dev mode!
       isOnline: true
    
  4. Final 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:

  1. Check if clearCachedSpaceData() was run
  2. Check browser console for errors
  3. Verify space.guard.ts changes were loaded (check timestamp)
  4. 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:


๐Ÿ“Š 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:

  1. Mark test cases as โœ… in the matrix above
  2. Update progress-tracking.md with completion
  3. Commit changes with message: feat: implement development mode routing for stable space slugs
  4. Celebrate! ๐ŸŽŠ

End of Test Plan | Ready to execute!