Skip to content

fix: improve avatar rendering - #9048

Open
bmuenzenmeyer wants to merge 1 commit into
mainfrom
refactor-avatar-rendering
Open

fix: improve avatar rendering#9048
bmuenzenmeyer wants to merge 1 commit into
mainfrom
refactor-avatar-rendering

Conversation

@bmuenzenmeyer

@bmuenzenmeyer bmuenzenmeyer commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description

Improves avatar rendering by using the durable, immutable GH id and the currently observed url from GH. Notably, this works for both users and orgs, the inciting ask from https://openjs-foundation.slack.com/archives/CVAMEJ4UV/p1785347765682829

Turns out, the old avatars.githubusercontent url was no longer observed in GH API responses. This new one is represented there, on their website, and works for both users and orgs (with the caveat that we need to use an id).

IDs are better anyways, as evident by two of our authors.json values changing out from under us. I updated both of those entries while here, as well as fixing some typos in the file that were breaking the rendering of those authors.

Validation

image

This should NOT affect author or blog post workflows, to my knowledge, as no logic was driven off of the username-as-id. Meaning, no blog posts need to know the author - they keep using the full names.

Related Issues

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

Copilot AI review requested due to automatic review settings July 29, 2026 21:35
@bmuenzenmeyer
bmuenzenmeyer requested a review from a team as a code owner July 29, 2026 21:35
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nodejs-org Ready Ready Preview Jul 29, 2026 9:35pm

Request Review

@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Localized to author display and avatar URL construction; blog workflows still use display names, with legacy fallback for unknown GitHub usernames.

Overview
Author avatars now use GitHub’s stable numeric user/org IDs (avatars.githubusercontent.com/u/{id}) instead of username-based URLs, so orgs and renamed accounts keep working.

In authors.json, every author’s id is now a numeric GitHub ID (several org entries share 9950313). Typos (webistewebsite) are fixed and missing profile links are added where needed. Author.id is typed as number.

getGitHubAvatarUrl defaults to the /u/{id} form and supports an optional legacy username URL for unknown authors. getAuthorWithId resolves known authors by GitHub handle from website (not by id), uses numeric id for images, and derives nickname from the profile URL. Tests cover shared org IDs for distinct bylines (e.g. release vs TSC).

Reviewed by Cursor Bugbot for commit 11545db. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.87640% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.13%. Comparing base (b3f93f5) to head (11545db).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/site/util/author.ts 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9048      +/-   ##
==========================================
+ Coverage   75.12%   75.13%   +0.01%     
==========================================
  Files         102      102              
  Lines        9109     9121      +12     
  Branches      372      376       +4     
==========================================
+ Hits         6843     6853      +10     
- Misses       2262     2264       +2     
  Partials        4        4              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@bmuenzenmeyer bmuenzenmeyer left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self-review

Comment thread apps/site/authors.json
Comment on lines -305 to +308
"id": "tracy-hinds",
"name": "Tracy Hinds"
"id": 1981088,
"name": "Tracy Hinds",
"website": "https://github.com/hackygolucky"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example of one of the broken username re-names

Comment thread apps/site/authors.json
Comment on lines -268 to +269
"webiste": "https://github.com/sam-github"
"website": "https://github.com/sam-github"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example of one of the typos

Comment thread apps/site/authors.json
Comment on lines -202 to +204
"id": "mike-dolan",
"name": "Mike Dolan"
"id": 7398917,
"name": "Mike Dolan",
"website": "https://github.com/mkdolan"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other rename this resolves

Comment thread apps/site/authors.json
Comment on lines -167 to +172
"id": "nodejs",
"id": 9950313,
"name": "Node.js Release Working Group",
"website": "https://github.com/nodejs/release"
},
"Node.js Technical Steering Committee": {
"id": "nodejs",
"id": 9950313,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note the same avatar will resolve, but proper bylines

Comment thread apps/site/util/author.ts

// Extracts the GitHub username from an author's profile URL, since the numeric
// `id` is only used to build a stable avatar URL and no longer holds the handle
const getGitHubUsername = (website?: string) => website?.split('/').pop();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is slightly un-ideal but works

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the inverse? e.g. instead of supplying website, we supply username, and this builds the website

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During lint, we can check if username === id?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves how author avatars are rendered across the site by switching from username-based avatar URLs to GitHub’s stable numeric id, while keeping existing fallbacks for unknown authors and updating the author data accordingly.

Changes:

  • Update getGitHubAvatarUrl to support stable id-based avatar URLs (with an opt-in legacy username-based path).
  • Adjust author mapping logic to look up authors via their GitHub URL “handle/slug” and use numeric ids for avatar rendering.
  • Update tests, author types, and authors.json entries (including fixing webistewebsite typos) to match the new model.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/site/util/github.ts Switch avatar URL generation to use id-based /u/:id by default, with a legacy option.
apps/site/util/author.ts Update author lookup/nickname logic to use URL-derived slugs and numeric ids for avatars.
apps/site/util/tests/github.test.mjs Refresh and expand tests for the new avatar URL behavior (id vs legacy).
apps/site/util/tests/author.test.mjs Update author mapping tests to validate id-based avatar URLs and distinct bylines.
apps/site/types/author.ts Change Author.id type from string to number to reflect GitHub numeric ids.
apps/site/authors.json Replace username “id” values with numeric GitHub ids and fix website key typos.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/site/util/github.ts
Comment thread apps/site/util/author.ts
@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Size Comparison

Summary

Metric Value
Old Total First Load JS 10.66 MB
New Total First Load JS 10.66 MB
Delta -1.73 KB (-0.02%)

Changes

🔄 Modified Routes (4)
Route Old First Load JS New First Load JS Delta
/[locale] 2.54 MB 2.54 MB 📉 -443.00 B (-0.02%)
/[locale]/[...path] 2.54 MB 2.54 MB 📉 -443.00 B (-0.02%)
/[locale]/blog/[...path] 2.54 MB 2.54 MB 📉 -443.00 B (-0.02%)
/[locale]/download/archive/[version] 2.54 MB 2.54 MB 📉 -443.00 B (-0.02%)

Comment thread apps/site/util/author.ts

// Extracts the GitHub username from an author's profile URL, since the numeric
// `id` is only used to build a stable avatar URL and no longer holds the handle
const getGitHubUsername = (website?: string) => website?.split('/').pop();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During lint, we can check if username === id?

@ovflowd ovflowd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

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.

7 participants