Repository navigation
fix: members invite through the plugin's endpoints again, the operator alone through its adapter; close step 4.2 - #75
Conversation
…r alone through its adapter; close step 4.2 The founder's answers on the 4.2 code audit, "1. A" and "2. Okay": - A member's invitation, cancel and renewal go back to auth.api.createInvitation, cancelInvitation and createInvitation with resend, as in step 4.1. The adapter writes only on the operator's path: the client's company, its first owner's invitation, its cancel and its renewal. checkNotMember and the member branch of the role check leave; invitationExpiry stays for the operator's renewal. - mailInvitation answers a typed outcome, SENT or BOUNCED (C49); the registration handler maps it with no catch (C14), and a member's invitation still answers MAIL_BOUNCED. - The owner-is-not-operator rule lives in identity, in registerCompanyOn and the next owner invitation; isOperator normalizes with storedAddress; the operator's proof carries the row its admission read and holds, so the registration no longer reads and locks it twice. - The Central's reads build typed objects; the answer's schema validates at the exit (C27, C31). Closing (delivery L5, L19): the D6 exception under Roll back, the S6/S11 amendment, a note in 0015, T5's test Hub exemption, the bounce rule in boundaries, the use-line placeholder, and the card leaves docs/steps.
|
Reviewer: Opus 5.5 (delta main..f278f8f) Rules read: Delta scope: the merge base of Ran
Not run: Earlier findings
Closing list (PR #52, L19): D6 exception under "Roll back" in Findings
I found nothing bigger than needed. Verdictapprove. Both Bloqueia from the 4.2 audit are fixed as the founder chose ("1. A", "2. Okay"). Members use the endpoints in Better Auth 1.7.8, and no copied rule remains on their path. The four Fechamento items and the closing list are applied, the docs check passes with no card, the affected tests and the new removal row behave, and the two Fechamento items above go to the closing. Recommendation for firstmateMergeable under L13 once CI is green on |
…lugin's endpoint; rewrap the amended docs An administrator renewing an owner's invitation answers INVITATION_ROLE_REFUSED, which only the endpoint decides now; removal row invitation-member-native-renewal proves the member's renewal goes through it. boundaries.md says why a member's cancel has no such row. The amended lines in security.md and boundaries.md wrap at 100 columns (delta check 3 of #75, Fechamento 1 and 2).
A member's invitation, renewal and cancellation now go through the plugin's endpoints, still in the company's scope; the mail after them keeps the sender's scope and takes main's delivered or refused outcome; the owner's mail keeps the operator's scope. Both sides' removal rows stay. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The founder's answers on the line-by-line code audit of step 4.2 ("1. A", "2. Okay"), its Fechamento items, and step 4.2's closing (delivery L5, L19). Step 5's PR #54 is red on the docs check until
docs/steps/holds one card; this PR removes 4.2's.Bloqueia 1, audit 2.9: members invite through the plugin's endpoints again
auth.api.createInvitation,auth.api.cancelInvitationandauth.api.createInvitationwithresend: true, as in step 4.1, inside the Hub's transaction (written,cancelThroughininvitations.ts;renewedininvitation-management.ts). The library's refusals map as in 4.1 (INVITATION_REFUSALS).getOrgAdapter) stays on the operator's path only:registerCompanyOn/renameCompanyOn, and the first owner's invitation, cancel and renewal when the admission isOwnerInviterProof.checkNotMember(deleted: a company the operator may invite into has no member, so the operator path never needed it), the member's role check (mayInviteAsnow only feeds the company page's read, as in 4.1), the cancel admitted byinvitation:create(the endpoint checksinvitation:cancelagain), andinvitationExpiry(kept only for the operator's renewal).lockCompanyfirst everywhere.invitation-member-native-endpointwrites a member's invitation through the adapter instead; "convidar: o administrador pedindo dono…" ininvitations.test.tscatches it, because the Hub no longer checks the creator role or an existing member itself.docs/reference/boundaries.mdsays exactly this, with the founder's answer.Bloqueia 2, audit 2.14, rule C14: no catch in a handler
mailInvitationreturnsMailOutcome,{ kind: 'SENT' } | { kind: 'BOUNCED' }(C49), and still marks a bounce as mailed. The registration handler inoperations/routes.tsmaps it tomailBouncedwith notry; the member routes incompany-routes.tsmap BOUNCED toMAIL_BOUNCEDthroughdeliveredOrRefused, so their answers are unchanged.Fechamento
clientsOf,listandreadOperatedCompaniesbuild typed objects from rows parsed at the database boundary;servevalidates the answer at the exit.ClientSummary.parseno longer strips fields halfway.checkOwnerNotOperator, called inregisterCompanyOnand in the operator's next owner invitation.isOperatorleaves the Central's ports.isOperatornormalizes withstoredAddress.OperatorProof,OwnerInviterProof) carry the user row their admission read and locked, and the adapter names it as inviter, so the registration and the owner invitation no longer read and lock that row twice.Step 4.2's closing (L19)
docs/architecture.md"Roll back": the D6 exception, P6 B's one-time deletion.registerClientanswers 201 withmailBouncedinstead ofMAIL_BOUNCED, and the bounced address shows as an ordinary "Aguardando o administrador" invitation once the note is gone (boundaries, the e-mail entry).docs/steps/e042-cadastro-de-cliente.mdleavesdocs/steps/(L5).client-owner-not-operator,owner-inviter-is-operator,invitation-bounce-marked; all 20 rows on the changed files are caught locally.Not in this PR, still open: the founder's confirmation of the P6 test-company list before the release; issues #60 to #64.
Checks run locally
lint, typecheck, deps, knip, suppressions, docs; server tests for identity, operations and platform (198 passed); the 20 removal rows on the changed files (all caught). Main, with #65, is merged in.