feat(integration): first-class bot identity (LC-73) #168
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-73-bots"
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?
Summary
First-class bot identity (LC-73). A bot is a
usersrow withis_bot = 1(migration 0020). Bots authenticate only via API tokens (LC-72); the cookie login refuses them. Builds on the merged LC-72 token surface.Changes
is_botcolumn onusers(default 0). Threaded throughUserRecord/User+From,row_to_user_record, and every users SELECT that feeds it (by-username/id/session, list, blocked-users)./admin/bots, standalone-only): create a bot (username + token scopes) -> inserts the bot user and mints an API token shown once; disable -> bans the bot and revokes all its tokens (revoke_all_for_user).is_botusers (generic error, no enumeration). Bot password hash is empty/non-verifiable.WHERE is_bot = 0(register + 2FA-register), so a bot can't grab the admin slot.AuthorMeta/MessageViewcarryauthor_is_bot(set at all 9 construction sites); the message template renders a "bot" pill next to the username.Acceptance criteria
/admin/bots.@mentionof a bot resolves like a normal user.Tests
routes_bots.rs(standalone-gated): create + token auth, cookie-login rejection, disable-revokes-tokens, bot badge in a room. Migration 0020 appended to all hand-rolled auth lists (db_auth.rs / rbac.rs / db_invite.rs filled in 0018-0020).just check,just test,just test-saasgreen.🤖 Generated with Claude Code
post_bots created the bot user then minted its API token. If the token insert failed, the bot row was left orphaned, and retrying the same username hit a unique-violation. Delete the just-created bot when the token insert fails so the admin can retry cleanly. (Login defense-in-depth confirmed: verify_password rejects the empty bot hash because PasswordHash::new("") errors, independent of the is_bot gate.) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>