Repository navigation
namespace.list_mine lists the namespaces a person was granted under their email - #152
Merged
Merged
Conversation
…heir email One person is one principal (server/auth/aliases.py): grants written by operators, invitations and syncs name the person's email, the login token names the self-signup row's handle, and every read folds the two — except namespace.list_mine, which queried loom.namespace_grants for the caller's exact subject. A grant written under the email before the person's first sign-in never appeared in their membership list, so the dashboard refused a namespace the server already serves and the picker did not show it. The handler now reads the membership rows for all of the caller's spellings and folds a namespace granted under both into one row (newest grant stands, highest role wins), and the visits join clears is_new on a visit under any spelling, since mark_seen records visits under the login handle. Signed-off-by: pufit <[email protected]>
…join python -m tests.analyzer.corpus --write: one shape replaced (the visits side of _MEMBERSHIP_SQL). Signed-off-by: pufit <[email protected]>
zlareb1
approved these changes
Oct 25, 2026
This was referenced Oct 25, 2026
The retry mutation binds its DateTime64 from integer epoch milliseconds, not timestamp() * 1000
#153
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
namespace.list_minenow lists the namespaces a person was granted under their email as well as those under their login handle, and clearsis_newon a visit under either spelling. The dashboard no longer refuses ("Your account cannot read this namespace") a namespace the server already lets the person read, and the header picker shows it.Why
One person is one principal (
server/auth/aliases.py): grants written by operators, bootstrap scripts, invitations and syncs name the person's email, the login token names the self-signup row's handle (u-…), and every read folds the two — the auth context, the login widening, the restricted gate,grant_role_for,caller_home,token_grants, the grants list.namespace.list_minewas the one reader that did not: it queriedloom.namespace_grantsfor the caller's exact subject, so a grant written under the email before the person's first sign-in (the handle does not exist yet, andgrants.pycanonicalizes to the handle only once the row does) never appeared in the person's membership list. The dashboard decides readability from that list (App.tsxcanReadNamespace) and rendersNamespaceNoAccessbefore issuing a read, so a link to such a namespace was refused althoughmemory.*reads against it succeed, and the namespace was missing from the picker.Seen on a deployment where a control plane pre-provisions grants for every member of a tenant by email: a member who signs in afterwards sees only their personal namespace. Reproduced against ClickHouse: the exact-subject query returned 1 row for the person, the alias-folded one 12.
The same handler folds aliases for a token's creator three lines below (
_inherited_rows); this makes the caller's own rows follow the same rule.Scope and risk
handle_namespace_list_mineresolvessubject_aliases(org, caller)(cached pergrant_cache_ttl_seconds, falls back to the subject alone when the directory read fails — unchanged behavior in that case) and reads the membership rows for all spellings._one_per_namespacefolds a namespace granted under both spellings into one row: the newest grant stands, the highest role wins (grant_rank, asfold_by_aliasdoes for the Readers list), and the namespace is new only if no spelling has visited it._MEMBERSHIP_SQL: thenamespace_visitsjoin is nowmax(last_seen_at)over the samesubs, instead of equality with the grant row's own subject — otherwise an email-keyed grant would carryis_newforever, sincenamespace.mark_seenrecords visits under the login handle.canonical_subject(grants are still written under the handle when the row exists). Service-account and wildcard subjects have no aliases, so their lists are unchanged.Compatibility, rollout and rollback
tests/analyzer/shapes.txt— one statement shape replaced (the membership read's visits join), viapython -m tests.analyzer.corpus --write.Tests
tests/unit/test_list_mine_aliases.py: email-keyed grants are listed for the handle (and the read asks for both spellings at once); a namespace granted under both spellings is one row with the highest role,is_newcleared by either spelling and the newest grant'sjoined_at; a subject with no aliases lists only its own rows; the visits side of the SQL filters by the samesubsas the grants side.is_newas expected.make test-unitequivalent (pytest tests/unit -p randomly),ruff,mypy-gateandfunction-length-gatepass locally.