Skip to content

feat: People API user provider + unified user model#120

Merged
quiiver merged 14 commits into
mainfrom
feat/people-api-user-provider
Jun 25, 2026
Merged

feat: People API user provider + unified user model#120
quiiver merged 14 commits into
mainfrom
feat/people-api-user-provider

Conversation

@quiiver

@quiiver quiiver commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a People entity provider that emits User entities in a new people namespace, sourced from BigQuery, and rewires the workgroup provider to reference those users in Group spec.members. This is the precursor to Auth0 SSO — every user who can sign in needs a User entity for the sign-in resolver to match.

Design (sourcing)

We explored the CIS Person API but pivoted to BigQuery as the base source, because the provisioned CIS credential is scope-limited (classification:workgroup:staff_only): its staff-filter endpoint 500s, staff_information isn't readable, and its primary_email is often a personal address — which can't match Auth0's @mozilla.com login claim. BigQuery's users data has clean @mozilla.com emails + names + GitHub identity, so it yields complete, SSO-resolvable entities with no fragile join.

  • MozcloudPeopleEntityProvider — full-mutation provider over the BigQuery users source (workgroup_subgroup_members). Each row → user:people/<emailToUserName(email)> with displayName (name), email, GitHub annotations/link, and a gravatar picture. No spec.memberOf (membership is derived from Group spec.members).
  • Workgroup provider refactor — stops emitting its own User entities; sets each subgroup Group's spec.members to the same user:people/<emailToUserName(email)> refs, so membership resolves exactly. userToEntities removed; dev guest resolver points at user:people/….
  • CIS PersonApiSource (+ schema) — committed but unwired, reserved for a future best-effort avatar-enrichment pass.
  • Config: catalog.providers.mozcloudPeople.bigqueryUsers; the auth/apiBaseUrl block is reserved (not read).

Auth0

Resolves by @mozilla.com email (mozilla.org/email + spec.profile.email).

Testing

Unit tests for the BigQuery personToEntity transform, the provider (full mutation, dedupe), the workgroup refactor (buildGroupMembers, no users emitted), and the reserved PersonApiSource. Full package suite 111 passing, package lint clean, tsc -p tsconfig.json exit 0.

Follow-ups

  • Auth0 SSO provider + sign-in resolver (the actual goal this precedes).
  • Optional CIS avatar enrichment once a reliable join key is in place.
  • Broaden the population beyond workgroup members if a wider staff table becomes available.

quiiver added 14 commits June 24, 2026 16:43
…erRef

Move the mozcloudPeople provider block before the mozcloud root guard so it
registers even when catalog.providers.mozcloud is absent. Update the module
JSDoc to mention the people provider. Delete the unused userRef export from
refs.ts.
…berships for non-members

The previous edit based the query on the person directory but still grouped
by m.value and ARRAY_AGG'd a STRUCT that is all-NULL for staff with no
workgroup membership. That (a) is invalid SQL (p.email/p.name not grouped)
and (b) would drop every non-member via schema validation. Group by
p.email/p.name, move member_type='user' into the join, and IGNORE NULLS so
non-members get an empty memberships array.
@quiiver quiiver merged commit 0d8f581 into main Jun 25, 2026
1 of 2 checks passed
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