Frontend Surface Ownership Map

Goal

Define canonical ownership for user, org-admin, and super-admin frontend surfaces before deleting any duplicate routes or components.

Current Route Surfaces

  • frontend/src/app/dashboard/page.tsx
    • Primary user-facing communication dashboard route.
    • Owns user self-service analytics view.
  • frontend/src/app/chat/page.tsx
    • Primary user simulation/chat runtime route.
    • Composes user dashboard widgets from components/dashboard/*.
  • frontend/src/app/org-admin/page.tsx
    • Primary organization admin route.
    • Renders OrgAdminPageContainer from features/org-admin, which mounts OrgDashboard.
  • frontend/src/app/admin/page.tsx
    • Primary super-admin route.
    • Owns cross-organization and system-level management surfaces.
    • Reuses OrgDashboard from features/org-admin when super admin drills into selected org.

Current Component Ownership

  • frontend/src/components/admin/*
    • Super-admin-only management modules (users, organizations, workdays, analytics, logs, health, simulation).
  • frontend/src/components/dashboard/*
    • User-facing dashboard widgets (personal metrics, tasks, messages, etc.).
  • frontend/src/features/org-admin/*
    • Canonical org-admin UI: OrgDashboard, org chrome, simulation entry from org context, org admin guard hook.
There is no separate org subtree under components/dashboard/ and legacy components/org-admin/ has been removed.

Overlap and Risk Areas

  • Role-surface overlap: admin/page.tsx imports both super-admin modules and org dashboard module.
  • Naming overlap: components/dashboard/* hosts user widgets; avoid adding org-admin-specific modules there—use features/org-admin.

Canonical Ownership Rules (current)

  • Super-admin pages: route under app/admin/*, components under components/admin/*.
  • Org-admin pages: route under app/org-admin/*, implementation under features/org-admin/*.
  • User pages: routes under app/chat and app/dashboard, components under components/dashboard/*.

Test Placement Convention (enforced)

  • Frontend tests are colocated (*.test.tsx, *.integration.test.tsx).
  • New __tests__/ trees are disallowed for frontend source.
  • Enforcement contract: tests/contract/test_repo_structure_hygiene.py.

Migration Order (No Behavior Change)

  1. Keep route contracts stable (/admin, /org-admin, /dashboard, /chat).
  2. Prefer new org-admin UI work in features/org-admin; re-export from there if a shared entry is needed elsewhere.
  3. Rename/refactor user-only dashboard widgets explicitly (avoid mixing org-admin concerns into components/dashboard/).
  4. Preserve stable route contracts and avoid duplicate admin entrypoints.

Deletion Criteria

  • Any deprecated component path removable only after:
    • no imports in runtime/test code,
    • no docs references,
    • no role-regression in admin/org-admin routing smoke tests.