Skip to content

profile: new component for the public persona (handle, display name, bio, avatar, links) #52

Closed

Description

@matthewjhunter

Summary

Add web/profile: a mountable component owning the generic "public persona" every community site in the suite needs -- unique handle, display name, a short bio, an avatar, and bio links. Two consumers are ready now:

  • SF (speculativefiction/sf) -- greenfield. Has a users table (006_users.sql) but no persona fields yet, and is about to need them: the author-claim flow means a claimed author is a user with a public persona (display name, bio, picture, links), which is exactly this component's data shape.
  • OSG (old-school-gamers/osg) -- extraction. Already built this once: 004_directory_profiles.sql (handle citext UNIQUE, display_name, bio) plus ~594 lines in server/internal/directory/profile.go.

A future forum component is the third consumer: it needs a stable "render this user's card" API (avatar token + handle + display name in posts, gravatar-style) and should depend on web/profile, not on each host's bespoke users table.

The key design constraint: profiles are peripheral, users are not

Every existing component here (blog, contact, newsletter, media) is self-contained -- nothing else FKs into it. A users table is the opposite: it is the host's FK hub. OSG's campaigns, characters, and memberships FK into users.id; SF's authors.claimed_by does the same. Neither host could cleanly hand that table to a component, and a component that owns it stops being mountable and starts being the site.

So the component does not own users, auth, or sessions. It owns one satellite table keyed by an opaque host-supplied user key:

CREATE TABLE profile_profiles (
    user_key     text PRIMARY KEY,   -- host's stable user identifier (e.g. users.id as text)
    handle       citext UNIQUE,
    display_name text NOT NULL DEFAULT '',
    bio          text NOT NULL DEFAULT '',   -- reduced text via ui/markdown, never raw HTML
    avatar_url   text NOT NULL DEFAULT '',   -- canonical media URL from media.Ingest
    ...
);

The host keeps owning identity (its users table, its OIDC sync) and passes the key in. This also means profile works the same whether or not the host adopts the RP user-sync extraction (infodancer/oidclient#10).

Scope

Data

  • handle: citext UNIQUE, charset/length policy, reserved-name list (admin, root, www, the host can extend it).
  • display_name: free text, length-capped.
  • bio: one paragraph of markdown, sanitized through infodancer/ui/markdown (the single audited pipeline), stored reduced per CONVENTIONS.md.
  • bio links: ordered (label, URL) pairs; scheme allowlist http/https only; rendered with rel="me nofollow ugc".
  • avatar: ingested through web/media (media.Ingest -- re-encode strips EXIF/metadata, content-addressed, thumbnails); store the returned canonical URL. Deterministic generated fallback (identicon-style, derived from handle) so cards always render something without leaking email hashes the way gravatar does.

Handlers (mount contract)

  • Edit-form fragment (CSRF on the POST, per CONVENTIONS.md).
  • Public-profile fragment.
  • Avatar upload endpoint (size/dimension caps, content-type sniffing -- media already enforces most of this).
  • Card(userKey) renderer: the small avatar+handle+display-name unit other components and hosts embed (forum posts, campaign rosters, SF author pages).

Posture -- standard across the monorepo: New(pool) / Migrate(ctx, pool), profile_goose_db_version, profile_ table prefix, sqlc + pgx/v5, handlers depend on small store interfaces, Postgres tests in the integration module.

Non-goals

  • Authentication, sessions, OIDC callback handling, or the claims -> local-user upsert. That duplication (OSG users.go vs SF auth.go, near-verbatim copies) is real but belongs near oidclient, not here -- extracted as rpuser: extract the duplicated claims -> local-user sync into an audited helper oidclient#10.
  • Owning the users table (see above).
  • OSG's site-specific profile features: home_label/home_point geography, GeoNames geocoding, the player directory, the profile_public listing flag. Those stay in OSG, composed alongside the component's fields on the same edit page.
  • webauth changes. webauth's users.display_name remains the IdP claim; here it is at most an initial seed.

Open questions

  • display_name authority: recommend the component is authoritative after first save; the webauth claim seeds it on first login. Decide before v1 so there are not two sources of truth.
  • handle policy: immutable after creation, or renameable? Renames break @-style references if a forum lands later; lean immutable-with-admin-override for v1.
  • profile visibility: is a generic "hide my profile" flag in scope, or host policy (OSG's profile_public)? Lean host for v1.

Adoption

  • SF: mount greenfield; author pages reuse the public fragment and card renderer instead of building their own persona display.
  • OSG: migrate handle/display_name/bio from users into profile_profiles keyed by users.id; keep geo fields and the directory local; compose its account page from the component's edit fragment plus its own fields.

Activity

  1. added
    enhancement
    on Jun 9, 2026
  2. added a commit that references this issue on Jun 9, 2026
    ac56daf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions