feat(enclave): remove default enclave, prompt to create when none (LC-516) #499
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/LC-516-remove-default-enclave"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Removes the auto-default "General" enclave and replaces it with an inline create-enclave prompt on Home, per LC-516.
backfill_general_membership(server startup + bot creation) so users are no longer force-joined to a shared default enclave. The helper (andget_general_id) stay aspubtest fixtures used across the suite; the immutable0009Generalseed row is left in place (deleting it would cascade-delete its rooms and messages on existing installs).WelcomePage.has_enclaves), posting to the existingPOST /enclaveshandler. The no-enclave state already degraded gracefully to a DM-only Home, so no other flow changed.POST /enclave/{id}/members/add-bot(manage-gated) plus a bot picker on the enclave settings members panel, so managers can add a bot directly. This closes a gap the removal exposed: bots cannot accept invitations, and General membership was previously the only way a bot entered an enclave. Reusesdb::enclave::add_memberand the existingEnclaveMemberAddedlive event; rejects non-bots and skips banned or already-member bots.Testing
server/tests/routes_enclave_prompt.rs: a no-enclave user sees the prompt, an enclave member does not, an owner can add a bot, a non-manager is rejected (403), a non-bot is rejected (400).just check(fmt + clippy-D warningson default + saas + desktop) andjust test(full workspace, 164 test binaries, 0 failures) pass.Notes
Generalrow at the DB level (reassigning its rooms and members) is deliberately out of scope; it is inert after this change (invisible on fresh installs, an ordinary enclave on existing ones). Worth a separate issue if wanted.🤖 Generated with Claude Code
lets-chat auto-joined every user to a seeded "General" enclave via backfill_general_membership, run at each server startup and after bot creation. This made "no enclave" an unreachable state and forced a shared default on everyone. Remove the two production callers so users are no longer auto-joined to anything; the backfill/get_general_id helpers stay as pub test fixtures (used across the suite), and the immutable 0009 General seed row is left untouched (deleting it would cascade-delete its rooms and messages on existing installs). The no-enclave state already degrades to a DM-only Home, so replace the removed default with an inline "create your first enclave" prompt shown on Home only when the user belongs to no enclave (WelcomePage.has_enclaves), posting straight to the existing POST /enclaves handler. Removing the General auto-add left enclave managers no way to bring in a bot (bots cannot accept invitations, and General membership was the only path a bot entered an enclave). Add POST /enclave/{id}/members/add-bot: a manage-gated route that adds a site bot directly as a member, with a bot picker in the enclave settings members panel. It reuses db::enclave::add_member and the existing EnclaveMemberAdded live event, rejects non-bot users, and skips banned or already-member bots. New i18n keys (en+es) for the Home prompt and the add-bot control. Tests cover the prompt visibility toggle and the add-bot route (owner adds, non-manager rejected, non-bot rejected). #LC-516 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>