feat(invitations): check contact grants on every read, cap pending invitations, and expire them at the deadline

This commit is contained in:
shira committed 2026-10-09 19:06:50 +03:00
1 parent 676b3c6e24
commit 12a7213d4a
67 files changed
+4255 -149

No files matched your search

@@ -372,8 +372,11 @@ func TestAcceptMineAtTheDeadlineStoresTheConflictAndGrantsNothing(t *testing.T)
if result := state.acceptResults[testKeyring{}.IdempotencyScope(acceptOperation, "late", candidateID.String())]; result.Outcome != outbound.InvitationAcceptStateConflict {
t.Fatalf("stored outcome = %+v, want state_conflict under the key", result)
}
if len(state.grants) != 0 || len(state.consentRecords) != 0 || state.invitations[sent.ID].State() != domain.InvitationDelivered {
t.Fatalf("a late acceptance changed the invitation: grants %d, consents %d", len(state.grants), len(state.consentRecords))
// The late command applies the due expiry first, so the invitation is
// expired, and it grants and records nothing.
if len(state.grants) != 0 || len(state.consentRecords) != 0 || state.invitations[sent.ID].State() != domain.InvitationExpired {
t.Fatalf("a late acceptance left %v with grants %d, consents %d; want expired with none",
state.invitations[sent.ID].State(), len(state.grants), len(state.consentRecords))
}
}