CRITICAL FIXES NEEDED

Documentation for Plans

🚨 Critical Fixes Needed Before Testing

Date: November 2, 2025
Priority: P0 (CRITICAL)
Status: Issues Identified, Fixes in Progress


🔴 Critical Issues Found

1. NX Library Organization (P0 - CRITICAL)

Problem: deployment-engine and collaboration-engine placed incorrectly

Current (WRONG):

libs/core/
  ├─ src/
  │  ├─ lib/deployment-engine/     ❌ WRONG LOCATION
  │  └─ lib/collaboration-engine/  ❌ WRONG LOCATION
  └─ index.ts (exports both)         ❌ WRONG PATTERN

Should Be:

libs/engines/                        ✅ NEW CATEGORY
  ├─ deployment-engine/              ✅ SEPARATE LIBRARY
  │  ├─ src/
  │  ├─ project.json
  │  └─ tsconfig.json
  └─ collaboration-engine/           ✅ SEPARATE LIBRARY
     ├─ src/
     ├─ project.json
     └─ tsconfig.json

Impact: HIGH - Breaks NX conventions, confusing imports
Fix: Move to libs/engines/ and create proper NX structure


2. EventSource Infinite Retry (P0 - CRITICAL)

Problem: EventSource tries to connect to /api/events continuously

Error:

GET http://localhost:5300/api/events net::ERR_CONNECTION_REFUSED
EventSource connection error, falling back to mock events

Current Code:

const es = new EventSource(`${backendUrl}/api/events`);
// Keeps retrying forever!

Impact: HIGH - Console spam, performance degradation
Fix: Add retry limit, fallback to disabled state, or mock implementation


3. Singularity Routing Error (P0 - BLOCKS TESTING)

Problem: Can't access /singularity/logic-builder

Error:

RuntimeError: NG04002: Cannot match any routes. URL Segment: 'singularity/logic-builder'

Issue: Redirect added to root /singularity/logic-builder instead of under :spaceSlug

Impact: HIGH - Can't test Singularity
Fix: Move redirect inside :spaceSlug children


4. Widgets Route Error (P0 - BLOCKS TESTING)

Problem: Wrong widget route pattern

Error:

Cannot match any routes. URL Segment: 'space/widgets/create'

Should Be: /:spaceSlug/widgets/create

Impact: HIGH - Can't manage widgets
Fix: Check navigation code generating wrong path


5. Editor Landing UX (P1 - IMPORTANT)

Problem: Editor landing page doesn't guide users without universe

Current: Gets stuck at /chrome-space-1/editor/landing
Needed: Smart detection + universe creation flow

Impact: MEDIUM - Poor UX
Fix: Enhance editor landing to detect universe state and guide users


6. Widget Integration Pattern (P1 - IMPORTANT)

Problem: Not following gograb-modules widget pattern

gograb-modules Pattern:

// embeddableComponents in manifest
{
  id: 'users:list-widget',
  componentType: UserListWidgetComponent,
  displayName: 'User List Widget',
  category: 'widget',
  permissions: ['users:read'],
  inputs: [ActionParameterBuilder...],  // Declarative inputs
}

Our Current: Basic widget registration without proper parameter builders

Impact: MEDIUM - Widgets not fully reusable
Fix: Align widget system with gograb-modules pattern


7. Navigation Warnings (P2 - NICE TO FIX)

Warnings:

⚠️ Navigation fallback: No route-based items found, using module registry directly
⚠️ Module configurations request failed - no tenant context
⚠️ No module routes found to register

Impact: LOW - Functional but warnings in console
Fix: Improve module registration and navigation building


🎯 Fix Priority Order

Immediate (Blocks Testing)

  1. EventSource Retry - Stop infinite connection attempts
  2. Singularity Routing - Fix route matching
  3. Widgets Route - Fix path generation

Important (UX Issues)

  1. Editor Landing - Add universe guidance
  2. NX Library Organization - Proper structure

Enhancement (Best Practices)

  1. Widget Integration - Follow gograb-modules pattern
  2. Navigation Warnings - Clean up console

📋 Detailed Fix Plan

Fix 1: EventSource Retry Limit

// Add max retry count and fallback
let retryCount = 0;
const MAX_RETRIES = 3;

es.onerror = () => {
  retryCount++;
  if (retryCount >= MAX_RETRIES) {
    es.close();
    // Switch to mock events or disabled mode
  }
};

Fix 2: Singularity Route

// Move redirect INSIDE :spaceSlug children
{
  path: ':spaceSlug',
  children: [
    // ... other routes ...
    {
      path: 'singularity/logic-builder',
      redirectTo: 'singularity',
      pathMatch: 'full'
    }
  ]
}

Fix 3: Widgets Route

Check WidgetsManagerManifest navigation - likely has wrong route format

Fix 4: Editor Landing Enhancement

// In editor landing component
if (!hasUniverse()) {
  showUniverseCreationBanner = true;
  // Provide link: "Create Universe → Return to Editor"
}

Fix 5: NX Library Reorganization

# Create proper structure
mkdir -p libs/engines
nx g @nx/angular:lib deployment-engine --directory=libs/engines
nx g @nx/angular:lib collaboration-engine --directory=libs/engines

# Move existing code
# Update tsconfig.base.json paths
# Update imports across codebase

Fix 6: Widget Pattern Alignment

Study gograb-modules/modules/new-user-management pattern:

Fix 7: Navigation System

Review and improve:


⚠️ Impact Assessment

If Not Fixed

After Fixes


🚀 Next Steps

  1. Fix EventSource retry (5 min)
  2. Fix Singularity routing (5 min)
  3. Fix widgets route (10 min)
  4. Enhance editor landing (30 min)
  5. Reorganize NX libraries (1 hour)
  6. Align widget system (1 hour)
  7. Clean up navigation warnings (30 min)

Total Time: ~3.5 hours to production-ready platform


Status: Issues documented, ready to fix systematically
Next: Apply fixes in priority order