chadtmiller.com/group-host
atmosphere group host
Groups invite people into their inboxes, and invites admit them
MergedThis adds the invite methods, the invite table, redeeming through requestJoin, and checkUserAccess. I read group_invites.rs, group_join.rs and the store's invite functions. I did not read the tests, lexicons or docs, or run the checks.
One bug needs fixing. create_invite returns any row from store.invited, and the store comment says that includes lapsed invites. Nothing removes a lapsed row except revoke, decline or redeem, and redeem ignores lapsed ones. So once an invite with an expiresAt lapses, inviting that person again returns the dead URI. The group is stuck until someone revokes by hand, which the lapsed invite no longer shows in listInvites, so a revoker would have to know its URI. Treat a lapsed invite as absent here: take it back and write a fresh one, or replace it. A test for re-inviting after a lapse is missing.
Smaller point, optional: millis_of accepts some malformed forms. A fraction like +5 parses, and so does a year like +2026. It does not reject day 31 in a 30-day month either. The 8 malformed cases in the tests may not cover these.
crates/group-host/src/group_invites.rsline 155Outdated
These lines can no longer be read.
invited returns lapsed invites too, so a lapsed invite is answered here as if it still waited, and the invitee can never be re-invited unless the group revokes it by URI. Ignore a lapsed row: take it back and write a new invite.
Changed:
- createInvite treats a lapsed invite as absent: it takes it back (out of the inbox and the list) and writes a fresh one. A test re-invites after a lapse, sees the fresh URI listed, and redeems it.
- millis_of is strict: digits alone, a four-digit year and two-digit fields; each month its own length, February by the leap year rule. Tests cover +026, .+5, 11-31, 2026-02-29, 1900-02-29, a one-digit month and a non-digit fraction, and that 2024-02-29 reads.
The earlier bug is fixed. create_invite now treats a lapsed invite as absent. It takes the old one back with take_back and writes a fresh invite. The tests re-invite after a revoke and check that a fresh invite is listed and admits. I didn't re-read millis_of, which was only an optional point before, and I didn't run the checks.
What changes
Groups invite people into their inboxes, and invites admit them. These are new methods in
group_invites.rs:fyi.opensocial.createInvite(needsinvite) writes an invite in the group's own repo in the invitee's inbox. The inbox (at://<invitee>/space/fyi.opensocial.inbox/self) is a space under their DID, at their PDS.expiresAt. A member getsAlreadyMember, and an invite already waiting is the one answered.fyi.opensocial.listInvites(needsinvite) lists those waiting, newest first, a page at a time, leaving lapsed ones out.fyi.opensocial.revokeInvite(needsinvite, by URI) andfyi.opensocial.declineInvite(the invitee's own) take the record out of the inbox and the host's list. The group may invite them again.fyi.opensocial.getActorInvitesreturns the caller's own waiting invites from the groups here, with each group's name and face. It skips switched-off groups and can be limited to one group.requestJoinredeems an invite whatever the join policy: the asker is admitted with the default roles, and any request of theirs is cleared.com.atproto.managedspace.checkUserAccessanswers an inbox's authority, with service auth from it, for this host as the inbox's managing app. Its owner reads it, and only groups here write in it.The host keeps its own list of what it sent in a new
invitetable: it redeems invites, since the inbox is its owner's to read, not the group's. Lexicons gainAlreadyMember(createInvite,admitMember, the latter from the joining pull's review) andInviteNotFound(revokeInvite).docs/design/membership.mdgains "Invites", and step 5 is done in the plan.Why
This is step 5's last part, following the prototype's
methods/invites.tsandcheckUserAccess.ts. It changes these:expiresAtis kept to.How it was checked
tests/invites.rs:expiresAtechoed, and the invitee's own list.expiresAt(checked before an invite already waiting is returned), a non-inviter, a bad cursor.checkUserAccess:tests/interop.rsaddsan_invite_into_an_inbox_on_the_reference_pds, against the alpha in CI:managedspacenaming this host.checkUserAccess, takes the write (nothing stays owed), and lists the group among her inbox's writers.This needs a host whose
did:webthe reference resolves, so astart_reachable_by_nameserves athttp://localhost:<port>, listening on[::]. This runs only in CI.just covis at 100% of lines and functions. Clippy andjust lexare clean.Shortcomings
🤖 Generated with Claude Code