Repository navigation
Conversation
…gle-use link Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…ence and design docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
… layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The members dialog and a repository's Access tab invite a person and show the invitation link; the sign-in gate keeps an invitation link through a single sign-on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…the Library Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…y email does An email no account holds now gets an invitation, not a grant kept as typed; the refused add in the members dialog test is grants.invite's. The schema dump counts the namespace_invites table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…pshot The accept path read the held role from the refusal's structured field, through str(), which the exception-text ratchet refuses; the SDK surface snapshot gains the four invitation methods. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Accepting an invitation grants its role on whatever the name then holds, so an open, unexpired one counts in the in-use check as a live grant does: a name retired with one outstanding is not registered as new by someone else. The cell scan judges the table as one whose org the writing request checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| setNewSubject(""); | ||
| return; | ||
| } | ||
| toast(`Added ${subjectLabel(out.subject, org)} as ${newRole}`, "ok"); |
There was a problem hiding this comment.
Double Enter in MembersDialog sends duplicate invitations
Medium Severity
onAdd does not guard against an in-flight submission while busy is "__add__", and the TextField stays enabled with an Enter onKeyDown handler. Because invite (grants.invite) is non-idempotent and can wait on SMTP delivery, pressing Enter again while a request is in flight creates duplicate invitations and sends duplicate emails.
Reviewed by Cursor Bugbot for commit 8fc527d. Configure here.
| // The invitation an add just made, with its link to copy; and how many it has made, which | ||
| // reads the open invitations again. | ||
| const [sent, setSent] = useState<{ email: string; result: InviteResult } | null>(null); | ||
| const [invited, setInvited] = useState(0); |
There was a problem hiding this comment.
Stale invitation link persists in MembersDialog
Low Severity
sent is only cleared when the modal closes via onOpenChange or on a subsequent grant, not when org or namespace changes while mounted or when the add form's Cancel button is clicked. Reopening the add form or switching namespaces can display a stale InviteSent link from an earlier invitation or namespace.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8fc527d. Configure here.
…rt and the row columns grants.accept_invite records the invitation by the hash it is stored under, never the link's secret. A test drives the SMTP client through both schemes, its timeout and the refused login without STARTTLS; another holds every invitation write to the table's columns, which classifies loom.namespace_invites as a builder table. The journal test lists migration 123. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…second person Accepting spends the link under its lease and grants after leaving it, so the grant's claims and an admin grant's fan-out never nest under the invitation's; after a failed grant the link opens again only when no grant at or above its role stands. When the maker's admin came from their own grant (recheck_maker, a new column of migration 123), accepting reads that grant again and refuses unless it still reaches admin, failing closed. Where sign-in is single sign-on only, an email no account holds is granted as typed, as an add by email did before. An invitation is made only on an active namespace. grants.invite's audit row names who got the role or the invitation, never the address. The four ops carry descriptions; an unknown state reads as closed; a cancel records no accepter; the SMTP timeout is per step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The sharing design, membership table, dashboard and agent guides name the single sign-on grant by email, the maker check, the spend-then-grant order and where self sign-up makes accounts; rolling-upgrade rule 76 covers the new ops and the in-use check; the open invitations show who made each; the add field's help covers both kinds of server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The maker is the account the admin rests on: the caller, or a delegated token's creator. grants.invite and grants.accept_invite read its grants as the gate does (authz.subject_grant_role: a collection's groups, everyone and parents included), so an invitation never outlasts that admin, and an admin only a token's claim makes cannot make one. recheck_maker is dropped. A handle a live grant in the org is stored under counts as held, and a held person is granted under the stored spelling. Only one plain address gets a link, so it names one recipient and keys its own mail limit; the per-maker limit is keyed by the creator. A request with no token grants as typed. An unknown stored role is unlisted and admits nobody. A user's erasure takes them off the invitations they made and closes the open ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
A row's owner_email and a grant's subject are whatever their writer typed, and namespace.register takes any owner, so neither makes an email an account: an invitation to it gets a link. A handle still counts through an account row or a live grant, under the spelling stored for it. The address is checked as sign-up checks it (valid_signup_email). A principal is refused in any case. A failed read of the maker's grants answers 503 at accept too, so the dashboard keeps the link. A link reopens after a failed grant only while its maker is unchanged, so an erasure that ran meanwhile keeps it closed. The Access tab names the handle the server granted. The store's reads run on clickhouse-local in a new test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Accepting reads the maker as a delegated token's creator is read: an admin grant, an active account (creator_account_active) and no revocation of their subject or of tokens as old as the link (is_revoked). The decision resets the fail-closed flag first, so a read the gate survived does not answer 503 here. The put-back after a failed grant reads the grant under the subject create_grant wrote it under, and a failed put-back is logged. smtp:// needs STARTTLS for every send: the email carries the link. The email and the accept card say the role without an article. The card's Not now keeps the link for the next visit, and a link to another org asks for a sign-in there instead of offering Accept. namespace.list_mine and namespace.mark_seen no longer say invitation for a namespace's new mark. namespace_invites is listed under the grants.revoke step it is rewritten by, and rule 76 names the N-1 erasure gap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Main took rolling-upgrade rule 76, so the invitations rule is 77; the Go and Rust wire models are regenerated from the merged server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Main took rule 77 of the rolling-upgrade rules; the invitations rule is 78. The Go wire models and the analyzer corpus are regenerated on the merged tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…k through a non-refusal After a failed grant, the reopen reads the grant just written: on a pool spread across replicas, a replica that has not seen it would reopen a used link. The accept card drops the link only on the server's refusals of it (404, 422): an ended session or a rate limit keeps it for a retry. A failed send's log line names its error, not the address. The store test's expiry follows the clock. Shorter settings comments, and the long doc lines are rewrapped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…hat admit someone The reopen after a failed accept runs to its end through a cancellation (anyio repeats one at every await) and also follows a lost reply to the write that spends the link. The mail limits are read before the invitation is stored, so one that cannot be read leaves no link listed that nobody was given. The open invitations leave out a link whose maker no longer stands. A tokenless request answers under the subject the grant is written under. The help, the sent notice and the docs say an email is granted at once only when it is verified for an account. The store test reads the row back field for field, and the two alternatives the body names are in the sharing page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
| for r in rows | ||
| if admin[r.created_by] | ||
| and not is_revoked(r.created_by, issued_at=int(r.created_at.timestamp())) | ||
| and (role := _role(r.role)) is not None |
There was a problem hiding this comment.
Hidden invites still reserve names
Medium Severity
grants.list_invites now drops an open invitation whose maker is no longer an active admin or is revoked. The row stays open until it expires, so it still counts as the namespace name being in use, but grants.cancel_invite needs the invite_id that only this list returned. No remaining admin can withdraw it, and the name stays reserved until the link expires.
Reviewed by Cursor Bugbot for commit 84ac002. Configure here.
…case The maker check reads an end user's revocation under <org>/user:<id>, the subject their tokens are revoked by, so their links stop with it, at accept and in the open list. smtp_url takes only smtps:// or smtp:// and is refused at load otherwise. The erasure test runs the step and reads the invitation it leaves. The sharing page names what an add does for a person whose tokens Loom does not mint at sign-in, and why the gateway identity provider cannot mark that server. Fixture names are placeholders, and two docstrings say what their reads match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The generated SDKs and reference pages are regenerated on the merged tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
| if subject != person: | ||
| return subject | ||
| if "@" in person: | ||
| return None |
There was a problem hiding this comment.
Verified email handles stay ungranted
Medium Severity
grants.invite treats an email as unverified when canonical_subject returns it unchanged. That happens for a verified account whose login handle is itself an email, because only aliases without @ are treated as the handle. On a server that is not single sign-on only, the call mints a single-use link anyone can open instead of granting that account.
Reviewed by Cursor Bugbot for commit 431729a. Configure here.
| # grant takes its own claims after this one, as `grant_claims` orders them. | ||
| spent = invite | ||
| await invites_repo.put(invite.accepted(subject, datetime.now(UTC))) | ||
| held = await _grant(invite, role, subject) |
There was a problem hiding this comment.
Erasure misses in-flight accepted grant
Medium Severity
grants.accept_invite records the invitation as accepted, drops invite_change, then calls create_grant with the maker id it already read. A user erasure in that window blanks that person on existing grants and invitations, and the following insert writes a new grant that still names them. The erasure pass never sees that row, so the erased id comes back as granted_by.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 431729a. Configure here.
A cancel also closes a link an accept is spending, so a grant that then fails does not reopen it after the admin cancelled it; the answer still says whether it was open. Tests cover two people opening one link at once under the real claim, an accept on a namespace retired since, and a service account's token with an unprefixed subject. The sign-in gate no longer stashes a link before single sign-on: a server that signs in that way makes no link. The docs say a handle a live grant holds is granted, and name the erasure's race with an accept in flight. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The Go wire models are regenerated on the merged tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…n the analyzer The accept card picks up a link pasted into a tab already on the page, holds the link itself when session storage is refused, and drops it only on the server's own refusal codes, not on any 404. The code-ceiling and principal-target checks are public, since invites call them. The reopen after a failed accept drops a redundant consistency wrapper: every read under the claim is already sequentially consistent. The analyzer corpus covers the invite handlers, the integration tests mint person tokens, and the op descriptions and guides say when a handle or email is granted at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…e link aside After an accept the card stays mounted, and its busy state was reset only on failure, so a link pasted next showed with Accept disabled. Busy now resets in a finally. The fragment listener takes only a link the address carries now, so a link set aside by Not now no longer returns on any fragment change. The send path drops a check its one caller already made, the `to` description names all its outcomes, and the docs give the link's full lifetime in the tab and in the Invited list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…he list fails An accept answered after another link was pasted dropped the new link, or marked it refused with the old link's error. The card now keys its refusal and error to a link's secret, and an answer forgets only the link it was about. A failed read of the open invitations showed none; it now says it failed, with Retry. The `to` description fits the reference's cell, a comment names what grants.create takes on the Access tab, and the mail test sets only the setting the message reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com> # Conflicts: # docs/architecture/rolling-upgrades.md # docs/reference/operations.md # docs/reference/status.md # sdk/go/wire/models.gen.go # sdk/ruby/lib/clickhouse/loom/generated/ops.rb # sdk/rust/src/wire_models.rs # sdk/typescript/src/generated/ops.ts
| // The invitation an add just made, with its link to copy; and how many, which reads the | ||
| // open invitations again. | ||
| const [sent, setSent] = useState<{ email: string; result: InviteResult } | null>(null); | ||
| const [invited, setInvited] = useState(0); |
There was a problem hiding this comment.
Invite link stays on other repository
Medium Severity
The repository Access tab keeps sent for the life of the component and never clears it when id changes. After an email invitation on one repository, switching to another still shows that link, so it can be copied as if it belonged to the repository on screen.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 437afe3. Configure here.
… re-read A link pasted while another's accept was in flight showed its own Accept as loading: busy is now keyed by the link's secret, as the refusal and the error are. The card prefers the link the address carries over an older one storage still holds, which matters only when storage refused the new one. The Invited list says a re-read failed even while it shows the last read's rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com> # Conflicts: # sdk/go/wire/models.gen.go
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com> # Conflicts: # sdk/go/wire/models.gen.go # sdk/rust/src/wire_models.rs
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 7 total unresolved issues (including 6 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 375a518. Configure here.
| <div className="flex justify-end gap-2"> | ||
| {/* Not now keeps the link in this tab, so the card is back on the next visit. */} | ||
| <Button type="secondary" htmlType="button" onClick={refused || elsewhere ? close : () => setLink(null)}> | ||
| {refused || elsewhere ? "Close" : "Not now"} |
There was a problem hiding this comment.
Not now drops the invite link
Medium Severity
Not now only clears React state and relies on session storage for the next visit. If storing the link threw, that state was the only copy: the fragment was already removed, and kept() finds nothing. The invitation cannot be accepted later in this tab, including after the Namespaces view unmounts.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 375a518. Configure here.
…utoff The invitation email carries Date and Message-ID, which a relay passes on as the client sent them. LOOM_SMTP_TIMEOUT_SECONDS bounds the whole send, at most 30 s, since grants.invite answers after it and the dashboard gives a request 60 s. A test on the real revocation cache checks that a maker's cutoff is judged by when the link was made, and the store test checks the open list's newest-first order. The dashboard tells a person's spelling from a principal as the server does, and the guide without the dashboard names the invitation ops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com> # Conflicts: # docs/reference/operations.md # docs/reference/status.md # sdk/go/wire/models.gen.go # sdk/ruby/lib/clickhouse/loom/generated/ops.rb # sdk/rust/src/wire_models.rs # sdk/typescript/src/generated/ops.ts


Related: #2150
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
A namespace admin can invite a person by email: an account that signs in under the handle or a verified email is granted at once, and any other email gets a single-use invitation link, emailed when the server has mail settings (
LOOM_SMTP_URL,LOOM_MAIL_FROM).grants.invite, which the dashboard's add now calls, refuses a login handle no account holds instead of keeping a grant that reaches nobody.Why
Adding a member by email did nothing on a server without single sign-on. A grant's subject is mapped from an email to a login handle only through a verified email (an SSO account or a linked one), and a password account's email is never verified. So the email was stored as typed, matched no one, and gave no error and sent no email. The only workaround was to make the namespace public and have the person join it.
An invitation solves this whatever the sign-in setup: password only, SSO, mail or no mail. The link is the credential. Whoever opens it signed in gets the role under the handle they sign in with, so the admin does not need to know that handle.
Design
grants.invite(org, namespace, to, role)(admin):sso_linksrow) goes throughgrants.createat once (outcome: "granted"), under that account's handle. So does a login handle an account's row is owned under, or a live grant in the org is stored under (a person whose tokens Loom did not mint at sign-in, such as the gateway's orloom mint-token's, has no account row), under the spelling stored for it. Only a verified tie counts for an email: a row'sowner_emailand a grant's subject are whatever their writer typed, andnamespace.registertakes any owner.self_signup.valid_signup_email: a dot-atom local part and a domain IDNA encodes, so it names one recipient and keys its own mail limit), gets aloom.namespace_invitesrow and the link/spaces#invite=<secret>&org=…&namespace=…(outcome: "invited", withlink_path,urlwhenpublic_base_urlis set,expires_atandemailed).oauth_login_provider = "oidc"), the identity provider verifies every account's email, so an email no account holds is granted as typed throughgrants.create(outcome: "granted") and reaches that person at their first sign-in: no link to forward. This keeps what an add by email did on such a server before this change.grants.create.secrets.token_urlsafe. Only its SHA-256 is stored (invite_id), so a read of the table admits no one. The link works once, for seven days by default (LOOM_INVITE_TTL_SECONDS, one hour to thirty days), and the table's TTL drops each row a week after it expires.grants.accept_invite(org, namespace, secret)gives the role to the signed-in caller, stampedgranted_bythe inviter:grant_claims.invite_change) it checks that the link is open, the namespace active and the maker still an admin, and marks the invitation accepted. It grants after leaving the lease, so the grant's claims and an admin grant's fan-out to a repository's branches never nest under it; the lease is held alone.shielded.finish_cleanup).grants.inviteandgrants.accept_inviteboth read that account's grants as the gate reads them (authz.subject_grant_role): on a collection its own, its groups' and everyone's, there or on a collection above, assharing.rolesdoes; elsewhere its grant or an inheriting service account's creator's (_lookup_grant). The maker's account must also be active and their subject not revoked, as for a token they delegated (delegation.creator_account_active, andrevocation.is_revokedat the time the link was made, under<org>/user:<id>for an end user as the token check reads it); the decision resets the fail-closed flag first, so a read the gate survived does not count against it. Short of any of these the link is not made, or admits nobody. A failed read answers 503 at both ends, so the dashboard keeps a link through an outage. An admin whose token alone makes them one (a platform admin, an operator's token) holds no grant a later read could tell from a revoked one, so they cannot make a link: an admin through a grant invites the person. The open invitations list names each maker.skip_namespace_authzis set, since the caller has no role there yet. The handler checks the org, and every miss answers the same 404.grants.list_invitesandgrants.cancel_invite(admin) list the open invitations and withdraw one. The list leaves out a link whose maker no longer stands, since it admits nobody. A cancel also closes a link an accept is spending, so a grant that then fails does not reopen it after the cancel.grants.invite's row records the role, the outcome and the subject granted or the invitation'sinvite_id, never the address an invitation link is made for;grants.accept_invite's records theinvite_idand the role, never the secret.user:<id>off every invitation they made and closes the open ones, under each invitation's lease, beside blanking them as the issuer of the grants they gave (forget_maker, in the user erasure's grant step).namespace_census.STATE_TABLES), as a live grant does: accepting it grants its role on whatever the name then holds, so a name retired with one outstanding is not registered as new by someone else.smtp_urltakes onlysmtps://orsmtp://, refused at load otherwise. Plain text oversmtps://(465), orsmtp://(587) with STARTTLS, which every send requires since the email carries the link (a server that offers none gets nothing, and the link is shown to copy), withDateandMessage-IDset, as a relay passes a client's message on as sent.LOOM_SMTP_TIMEOUT_SECONDS(10 by default, at most 30) bounds the whole send, sincegrants.inviteanswers after it and the dashboard gives a request 60 s; a send past it is reported not sent and the link is shown to copy. It sends only whensmtp_url,mail_fromandpublic_base_urlare all set. The limits are read before the invitation is stored, so one that cannot be read fails the invitation and leaves no link listed that nobody was given. At most 20 invitations an hour per maker (a delegated token's creator, so minting tokens adds none) and 3 a day per address are emailed (server.auth.attempts), so the server's mail is no relay for a namespace admin, whom any sign-up can make. A refused or failed send still makes the invitation, and the dashboard shows its link to copy; the log line of a failed send names its error, not the address.grants.invite; a service account, a group, an agent or everyone still goes throughgrants.create.RESOURCE_NOT_FOUND,VALIDATION_FAILED) drops it: a replica that does not serve the op yet, an ended session or a rate limit keeps it for a retry.namespace.list_mineandnamespace.mark_seencalls a namespace's new mark that, not an invitation, which now means agrants.invitelink.Alternatives not taken (also in
docs/architecture/sharing.md):Scope and risk
grants.accept_inviteis the one new op that admits a caller to a namespace it has no role on, so it carries the checks above and a single-use lease. The 404 for an unknown handle ingrants.invitetells a namespace admin whether a handle has an account in their own org. This is the price of refusing typos; handles are already visible to members of shared namespaces.grants.revokestep that rewrites it, besidenamespace_grants. An accept or an invitation already past its maker check as that step runs can still write the user's id (a grant's issuer, an invitation's maker), as an in-flightgrants.createcan for an issuer; such a link admits nobody, since the step revokes the user's grants first. The cell scan judges it as a table whose org the writing request checked.grants.invite. On a password server an email no account holds gets a link instead of a grant that reached nobody, and a login handle no account holds is refused instead of being stored. Where sign-in is single sign-on only, an email is granted as before. Where tokens come from outside Loom's sign-in (an upstream gateway,loom mint-token, a trusted caller acting on behalf of someone), an email also gets a link, and a handle Loom has not seen yet is refused, where both were granted as typed before;grants.createstill grants a subject the minter names as typed. Thegatewayidentity provider cannot select the old behaviour: it is also what a password server with sign-up off infers, where a grant by email reached nobody.grants.createkeeps storing a subject as typed (service accounts, principals, and scripts that name a subject on purpose).Compatibility, rollout and rollback
grants.invite,grants.list_invites,grants.cancel_inviteandgrants.accept_invite. No changed field or default.123_namespace_invites(additive). To email invitations, setLOOM_SMTP_URL,LOOM_MAIL_FROMandLOOM_PUBLIC_BASE_URL. Without them, invitations work by copying the link. Optional:LOOM_INVITE_TTL_SECONDS,LOOM_SMTP_TIMEOUT_SECONDS.docs/architecture/rolling-upgrades.md): build N-1 does not serve the new ops, so an add or an acceptance routed to it fails until a retry reaches N. N-1's in-use check does not count an open invitation, so cancel open invitations before retiring a name during the rollout. A user erasure an N-1 replica runs leaves the user's id as the maker of their invitations until the TTL drops them; those links admit nobody, since the grants are revoked.Tests
tests/unit/test_grants_invite.py(66): grant for a held handle (under its stored spelling), a handle only a grant names, or a verified email; a link for an email only a grant or a registered row's owner names, and for an international address sign-up takes; refusal of an unknown handle, of principals in any case and of a list, display name, comment, quoted or malformed dot-atom address; a tokenless request granting as typed (answered under the handle a verified email ties to); hash-only storage, single use with the inviter as issuer, a higher role standing, a failed grant reopening the link, expired and cancelled links, the accepter checks, the mail settings, header injection, the mail limits throughserver.auth.attempts(20 an hour per inviter, 3 a day per address), a failure after the grant landed leaving the link used (the fake grant read answers none unless it is sequential), a lost reply to the spend and a cancelled accept (anyio repeating the cancel at every await) reopening the link, a mail limit that cannot be read storing nothing, two people opening one link at once under the real claim (one let in; both without it), an accept on a namespace retired since the invitation, a service account's token with an unprefixed subject refused as an accepter, a cancel while a failing accept is in flight keeping the link closed, a link whose maker no longer stands (lowered, disabled, revoked) left off the list, a maker's revocation cutoff judged by when the link was made (on the real revocation cache: a cutoff after it stops the link at accept and in the list, one before it does not), an end user's links stopping with their<org>/user:<id>revocation, ansmtp_urlof another scheme refused at load, the mail'sDateandMessage-ID, a send past the timeout reported not sent, the maker's admin read at both ends (lowered, token-only refused, a delegated token's creator as maker and mail key, a failed read answering 503 at both ends with the link kept open), a link its maker was erased from during a failed grant staying closed, a link stopping with its maker's disabled account or revoked subject, an earlier failed read in the request not refusing the maker, a grant written under the accepter's handle (a verified email signed in) keeping the link used, an unknown role unlisted and admitting nobody, an erased maker's links closed and unnamed, the user erasure step leaving the user's invitation cancelled and unnamed, no invitation on an inactive namespace, the single sign-on grant by email, an unknown state read as closed, the SMTP transport (both schemes, the timeout, nothing sent oversmtp://without STARTTLS, login or not), and every write carrying every column.tests/unit/test_invites_store_sql.pyon clickhouse-local: an invitation's newest state wins and reads back field for field;open_onlists only the open, unexpired ones, newest first;made_byfinds every invitation a maker made in the org;account_handleandgranted_spellinganswer the spelling as stored, and nothing for an inactive row, another org, a pending or a revoked grant.tests/unit/test_sharing.py:authz.subject_grant_rolereaches a collection through a group's grant on its parent, and not for another subject or a collection not in the tree.tests/unit/test_audit_subject_credentials.py: an invitation's audit row names who got the role or the invitation, never the address; an acceptance's names the invitation by its hash and never holds the secret.--checkand the analyzer corpus (12 tests, with ClickHouse) pass. Each new guard was mutation-checked: removing it fails its test.mixed-versionCI job (make test-mixed-version) covers the cross-boot; rule 79 records what it does not check.tests/analyzer: the invitation handlers' reads are in the corpus, and EXPLAIN QUERY TREE passes on a migrated ClickHouse.tests/integration/test_grants_invite.py(6, minting throughmint_test_token, which now takesis_service_account) against a server from source and its own ClickHouse: invite by email → list → accept under another handle →grants.listshows the inviter → a second accept is 404 → the list is empty; an unknown handle is 404 and writes no grant; a held handle is granted at once under its stored spelling; a handle a grant names is granted under that spelling, and an email a registered namespace's owner names gets a link; a cancelled link is unlisted and admits nobody; a link stops when its maker's admin grant is revoked.vitest run(LC_ALL=en_US.UTF-8 TZ=UTC): 4079 passed (on the tree merged withmain). Biome 2.5.14,tsc -b, the build and the bundle budget (index 118.7 kB) are clean. Playwrightnamespace-picker,a11yandfocus-rings: 182 passed.tests/unit/test_signup_name_in_use.py: an invitation counts as in use only while it is open and unexpired; each clause was mutation-checked on clickhouse-local. A probe against the test ClickHouse gave not in use → in use (open) → not in use (cancelled).docs_reference, the reach manifest, settings reference/schema/example,schema.sql, the erasure census, op budgets, public copy and doc links.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. The owner reviews the design and the auth paths.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.main; no merged migration is edited.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.🤖 Generated with Claude Code
Note
High Risk
Introduces a new auth path (
grants.accept_invite) that admits callers without an existing namespace role, plus mixed-version rollout quirks and namespace in-use semantics tied to open invites.Overview
Adds namespace invitations so admins can add people by login handle or email without silent dead grants on password-only servers.
API and storage: New experimental ops
grants.invite,grants.list_invites,grants.cancel_invite, andgrants.accept_invite, backed byloom.namespace_invites(hashed secret, TTL). Verified emails and known handles grant immediately; other emails get a one-time/spaces#invite=…link (optional SMTP viaLOOM_SMTP_URL,LOOM_MAIL_FROM,LOOM_PUBLIC_BASE_URL). Unknown handles return 404 instead of storing unreachable grants. Open invitations block namespace name reuse and are closed on user erasure.Dashboard: Members / Share / repository Access routes people through
grants.invite(service accounts and principals still usegrants.create). UI shows copyable links, emailed status, open invites with cancel, and accept flow via fragment → session storage on Namespaces.Docs: Architecture (invitations, rolling upgrade rule 79), security in-use census, storage layout, configuration, and operation reference updated (+4 ops, 394 total).
Reviewed by Cursor Bugbot for commit a591a66. Bugbot is set up for automated code reviews on this repo. Configure here.