feat(enclave): graduated member trust + posting gate (LC-551) #521
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/LC-551-trust-levels"
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?
LC-551: Graduated member trust (Round 4, Vein C - community-scale governance)
LC-551 bundles three ideas (trust levels, a join-approval queue, and an onboarding checklist). This PR ships the foundational, behavior-gating piece - graduated member trust - and flags the other two as follow-ups (see below).
What ships
trustlevel:newortrusted. A member joins a community enclave (via invite code / discover) asnewand graduates totrustedautomatically after posting enough (GRADUATE_AFTER_POSTS) in that enclave. Owners and admins are always effectively trusted.newmember (not owner/admin) is held to a minimum interval between posts (NEW_MEMBER_COOLDOWN_SECS, aNewMemberPostcooldown), which blunts drive-by spam from a freshly-joined account without throttling established members. DMs and trusted members pay nothing. Graduation runs right after a successful send and re-renders the settings member list live so the pill updates.POST /enclave/{id}/members/{user_id}/trust.Design notes
backfill_general_membershipinserts general members as trusted. Thenewlevel is earned when joining a community enclave. (This also means the always-on cooldown never touches the town square.)trustis kept OFF the widely-usedEnclaveMembershipstruct /get_membershipSELECT surface (a drift trap); it is read via dedicated helpers (is_new_member,trust_map) instead.Tests
Integration
routes_trust_levels.rs: the new-member rapid second post is refused over HTTP while the owner is exempt; graduation flips exactly once at the threshold; manualset_trustflips both ways.Deferred (remaining LC-551 scope, follow-up PRs)
post_join_by_codewould enqueue a pending request instead of adding the member, with an admin approve/decline panel reusing the invitation-accept UI. The trust column + member-management plumbing here is the natural base for it.Both are called out so the issue's full scope is tracked; this PR is the coherent, self-contained core.
Gates:
just check, fulljust test,just test-saasall green. (Note: adding an always-on new-member cooldown surfaced two anti-spam / slowmode tests that rapidly post as a member; the fix was semantic - established/general members are trusted - so those tests pass unmodified.)🤖 Generated with Claude Code
https://claude.ai/code/session_01S5obszLoUgUi8qaF7Hi5qz
Add a `trust` column ('new' | 'trusted', default 'new') to enclave_members. Existing members are marked trusted by the migration (they predate the feature), and backfill_general_membership now inserts the default-home general enclave's members as trusted too - the "new" level is meant for community enclaves you join, not the town square. Add is_new_member / set_trust / trust_map / count_enclave_messages_by_user and maybe_graduate (promotes a new member to trusted once they have posted GRADUATE_AFTER_POSTS messages in the enclave). Owners and admins are never "new". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5obszLoUgUi8qaF7Hi5qzSurface member trust in the enclave settings member list: a "New" pill on ungraduated members, and (for managers) a button to Trust a new member or reset a member to new, via POST /enclave/{id}/members/{user_id}/trust. resolve_member_views resolves trust in one batch lookup so both the settings page and the live OOB fragment render it. i18n in en and es. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5obszLoUgUi8qaF7Hi5qz