Skip to content

Let the identity directory supply appearance a provider lacks - #2

Open
petergaultney wants to merge 1 commit into
No-Instructions:mainfrom
TrilliantHealth:comments/configured-decoration
Open

Let the identity directory supply appearance a provider lacks#2
petergaultney wants to merge 1 commit into
No-Instructions:mainfrom
TrilliantHealth:comments/configured-decoration

Conversation

@petergaultney

Copy link
Copy Markdown
Contributor

🍋:

The identities setting has no effect for anyone an identity provider already recognises, which is normally everyone. resolveAuthorIdentity walks its resolvers and returns the first one that answers at all, so a Relay record with a name and nothing else beats a configured entry carrying a name, a picture, and a colour. Configure a directory with avatars in it, and comments still render as initials.

Who an ID belongs to and what they look like come from different places, and only the first is something a provider reliably knows. Relay's plugin API (PublicAPI.ts) emits picture only when the OAuth provider supplied one — Microsoft accounts supply none — and color only where the record has one, which for Relay is the per-session value User.ts draws at random from an 8-colour palette for its own presence cursors. colorLight isn't in Relay's User shape at all, so the directory is its only possible source. Meanwhile normalizeIdentity already treats all three appearance fields as optional while requiring a name, so the two kinds of knowledge were already separable — nothing was reading them that way.

So a provider stays authoritative about identity, and the directory fills in appearance the provider does not carry, field by field.

picture: identity.picture ?? configured.picture,
color: identity.color ?? configured.color,
colorLight: identity.colorLight ?? configured.colorLight,

The directory never overrides something a provider does carry, and an entry setting only a colour does not blank out a picture it said nothing about.

Details

  • withConfiguredDecoration in src/identity/providers.ts is a pure function over two identities. It is the whole precedence rule.
  • Both resolution paths — the async resolveAuthorIdentity and the synchronous resolveAuthorIdentitySnapshot — go through one decorated helper, so they cannot drift.
  • Decoration is skipped when ConfiguredIdentityResolver is itself the answering resolver, which has nothing to fill in from.
  • The directory lookup for decoration uses resolveUserSnapshot and swallows its own failures, so a broken directory entry degrades to an undecorated identity rather than losing the provider's answer.
  • Four unit tests: filling a gap, refusing to override, no directory entry, and each field independent of the others.

Not addressed here: canvas pin cards build their avatars in src/canvas/pins.ts from authorInitials with no image branch at all, and tint one only for the local user's own comments. So a canvas card shows initials even for an author who now has a picture. That is a rendering gap rather than an identity one, and I'm happy to send it separately if you want canvas cards to match the gutter and sidebar.

`resolveAuthorIdentity` takes the first resolver that returns anything and
discards the rest, so a provider record with a name but no picture beats a
configured entry that has both. The `identities` setting then appears to do
nothing for anyone the provider recognises - which, with Relay signed in to
a directory of the whole team, is everyone.

Who an ID belongs to and what they look like come from different places. A
provider knows the first; whether it knows the second depends on the account
it signed in with. Relay carries a picture only when the OAuth provider
supplied one - Microsoft supplies none - and a colour only for the local
user, drawn at random per session for its own presence cursors. So every
comment author renders as initials in one uniform accent colour.

A provider now wins on identity while the directory fills in picture,
colour, and colourLight field by field. The directory never overrides
something the provider does carry, and an entry that sets only one field
does not blank the others.
@petergaultney
petergaultney marked this pull request as ready for review August 17, 2026 21:13
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