Skip to content

Report who sent each pending invite - #21

Merged
TroyHernandez merged 1 commit into
mainfrom
feat/invite-records
Aug 6, 2026
Merged

TroyHernandez merged 1 commit into
mainfrom
feat/invite-records

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

Groundwork for chat.api phase 1d (chat_poll()$invites + chat_join()), which is the change that removes corteza's last $raw reach-through.

mx_extract_invites() returns room ids and nothing else. An invite's sender is the whole of whether it should be accepted — auto-joining anyone's invite hands a stranger a session with whatever the client can do — so a caller that wants to decide has to walk invite_state itself. corteza does exactly that today, in matrix_invite_inviters(), which is Matrix sync-shape knowledge sitting two packages away from the sync.

mx_extract_invite_records(sync_resp, self_id) returns list(room_id, inviter).

The NA

inviter is NA when the stripped state carries no m.room.member event for self_id, rather than being guessed at or omitted. A caller gating on the sender can then tell "nobody I trust" from "I could not tell". Both refuse — but they are different reasons, and only one is worth logging as a rejection.

No timestamp

Stripped state has no reliable origin_server_ts, and an invite is a standing state rather than an event at a moment. A field that could only ever be NA is worse than no field, so there isn't one. That is the one place this record deliberately differs from chat_message() and chat_reaction().

Testing

197 assertions. Three mutations, all caught: matching a membership event for someone other than self_id, matching a join or a leave as though it were an invite, and reporting a missing sender as NULL rather than NA.

mx_extract_invites() is unchanged and still exported — the new function's room ids are asserted to agree with it.

R CMD check --as-cran clean but for the days-since-last-update NOTE.

mx_extract_invites() gives room ids and nothing else, and an invite's
sender is the whole of whether it should be accepted: auto-joining
anyone's invite hands a stranger a session with whatever the client can
do. A caller that wanted to decide had to walk invite_state itself, which
corteza does today.

mx_extract_invite_records() returns list(room_id, inviter). inviter is NA
when the stripped state carries no m.room.member event for self_id,
rather than being guessed at, so a caller gating on it can tell 'nobody I
trust' from 'I could not tell'. Both refuse; they are different reasons,
and only one of them is worth a message.

No timestamp. Stripped state has no reliable origin_server_ts, and an
invite is a standing state rather than an event at a moment -- a field
that could only ever be NA is worse than no field.

197 assertions. Three mutations, all caught: matching a membership event
for someone other than self_id, matching a join or leave as though it
were an invite, and reporting a missing sender as NULL rather than NA.
@TroyHernandez
TroyHernandez merged commit 45568ed into main Aug 6, 2026
2 checks passed
@TroyHernandez
TroyHernandez deleted the feat/invite-records branch August 6, 2026 15:46
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