Skip to content

Lor delete pass#57

Merged
BuckyMcYolo merged 5 commits into
mainfrom
lor-delete-pass
May 29, 2026
Merged

Lor delete pass#57
BuckyMcYolo merged 5 commits into
mainfrom
lor-delete-pass

Conversation

@BuckyMcYolo
Copy link
Copy Markdown
Owner

@BuckyMcYolo BuckyMcYolo commented May 29, 2026

Summary

This PR executes a comprehensive product repositioning from "Townhall" to "Lor" paired with a foundational data model refactoring that transitions the application from guild-based to workspace-based organization. The changes span branding updates, database schema migrations, API route restructuring, and authorization system updates across the entire codebase.

Key Changes

Branding & Configuration:

  • Application renamed to "Lor" with updated metadata, window titles, and UI copy throughout desktop and web apps
  • Email sender configurations updated to Lor <noreply@team.lor.chat>
  • Domain references changed from townhall.chat to lor.chat
  • Package name updated from "townhall" to "lor"

Data Model Refactoring (Guild → Workspace):

  • Database schema completely restructured: guildworkspace, guildMemberworkspaceMember, guildRoleworkspaceRole, guildInviteworkspaceInvite
  • Session table updated with activeWorkspaceId replacing activeGuildId
  • Removed unsupported channel types: "announcement" and "forum" from channelTypeEnum
  • Channel schema now uses workspaceId instead of guildId with cascade delete semantics

API Routes & Middleware:

  • Routes migrated from /v1/guilds/{guildSlug}/... to /v1/workspaces/{workspaceSlug}/... across all endpoints (channels, invites, members)
  • Guild routes (/v1/guilds/index.ts, routes.ts) completely removed (~167 lines deleted)
  • Authentication middleware renamed: guildAuthMiddlewareworkspaceAuthMiddleware
  • All route parameters updated to use workspace slugs with corresponding schema adjustments

Permission & Authorization System:

  • Complete permission framework refactored: GuildRole/GuildAuthorityWorkspaceRole/WorkspaceAuthority
  • Exported permission functions updated: assertGuildPermissionassertWorkspacePermission, canManageGuildMembercanManageWorkspaceMember
  • Message rate limiting converted to workspace-scoped with updated Redis key prefix (ratelimit:workspace:...)
  • Role position and authority comparison logic adapted for workspace context

Frontend Component Updates:

  • All guild-scoped components renamed/refactored: GuildHeaderWorkspaceHeader, GuildBarWorkspaceBar, GuildMembersPanelWorkspaceMembersPanel, CreateGuildDialogCreateWorkspaceDialog
  • Route parameters systematically updated from $guildSlug to $workspaceSlug in all authenticated routes
  • API client calls and React Query cache keys updated to use workspace endpoints
  • Right sidebar view types updated: GuildMembersSidebarViewWorkspaceMembersSidebarView
  • Channel creation now restricted to text/voice/category types (removing announcement channel support)

Realtime & Events:

  • Socket state tracking changed from guildIds to workspaceIds
  • Realtime events renamed: "guild:member:joined""workspace:member:joined"
  • Presence subscription and notification payloads updated to use workspaceId
  • Channel access validation logic refactored to check workspace membership via workspaceMember schema

Database & Build Infrastructure:

  • Docker Compose updated with new Postgres credentials and database name (lor instead of townhall)
  • Seed scripts refactored to target workspace instead of guild context
  • Default workspace channels logic implemented in auth configuration

Scope & Risk Assessment

This is a large-scale, systematic refactoring affecting ~110+ files with approximately 1,000+ lines of net changes. The refactoring is consistent and thorough across all layers:

  • No orphaned guild references in new workspace code paths
  • Permission helpers comprehensively migrated
  • Database cascading deletions properly configured
  • Realtime room naming conventions updated throughout

Potential Concerns:

  • Lack of database migration scripts in the diff (schema changes appear schema-file only)
  • Announcement channel removal may break existing channel data without migration
  • Complete removal of guild routes without deprecation period
  • No visible test updates to verify workspace-scoped functionality
  • Invitation acceptance flow modifications in apps/api/src/routes/v1/invites/handlers.ts shows significant logic changes that warrant verification

Confidence Score: 3/5

Justification: The PR demonstrates systematic and consistent refactoring across all layers with comprehensive updates to permissions, routes, schemas, and UI components. However, the following factors reduce confidence:

  1. Database Migration Gap - No migration scripts visible; schema files updated but production data migration path unclear, especially for existing guild/channel data
  2. Large Scope - 110+ file changes create surface area for subtle bugs despite apparent consistency
  3. Removed Features - Announcement and forum channel types removed without clear deprecation or user impact analysis
  4. Test Coverage - No test file updates visible to validate workspace-scoped functionality
  5. Breaking Changes - Complete removal of guild routes and endpoints without backwards compatibility layer

The refactoring is well-executed from a code consistency standpoint, but deployment and data migration risks are not evident in the provided diff. Recommend verifying database migration strategy and test coverage before merging to production.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Renames Townhall/guild primitives to Lor/workspace across DB schemas, auth/permissions, API routes/handlers/schemas, realtime server/types, and web app routes/components. Removes announcement/forum channel types, adds workspace icon upload, rewires invites/members/search, and updates branding/configs (tauri, env, docker, README/ROADMAP).

Changes

Workspace pivot and Lor rebrand

Layer / File(s) Summary
Workspace pivot end-to-end
packages/db/src/schemas/*, packages/auth/*, apps/api/src/**/workspaces/*, apps/realtime/src/*, apps/web/src/**, packages/realtime-types/*, apps/desktop/src-tauri/tauri.conf.json, docker-compose.yml, README.md, ROADMAP.md
Replaces guild/Townhall with workspace/Lor across storage, permissions, API, realtime flows, web routing/UI, uploads/invites/members/search, and project branding/configuration.

Sequence Diagram(s)

sequenceDiagram
  participant WebApp
  participant API
  participant DB
  participant Realtime
  WebApp->>API: POST /v1/workspaces/{slug}/invites
  API->>DB: Insert workspaceInvite (workspaceId)
  API-->>WebApp: 200 { invite }
  WebApp->>API: POST /v1/invites/{code}/accept
  API->>DB: Tx: ensure membership, inc uses, insert workspaceMember
  API-->>Realtime: workspace:member:joined
  Realtime-->>WebApp: presence:ready/update (workspaces[])
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • BuckyMcYolo/lor#50 — Earlier guild APIs and guild icon presign now removed/rewired here to workspace equivalents.
  • BuckyMcYolo/lor#56 — Removes guild moderation features that overlap with this workspace migration’s deletion of guild surfaces.

Poem

A rabbit hops through schema fields anew,
Guilds to workspaces, fresh paths to hew.
Lor’s bright banner, emojis askew,
Realtime whispers, permissions true.
Invites flutter, icons queue—
Channels re-ordered, code in view.
Ship it, friend—Merlin approves, too. 🐇✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lor-delete-pass

@BuckyMcYolo BuckyMcYolo merged commit 0095fd8 into main May 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant