Skip to content

feat: add an upstream badge for /dev/null contributors - #741

Open
Akiyo974 wants to merge 4 commits into
dev-null-sh:productionfrom
Akiyo974:feat/upstream-badge
Open

Akiyo974 wants to merge 4 commits into
dev-null-sh:productionfrom
Akiyo974:feat/upstream-badge

Conversation

@Akiyo974

Copy link
Copy Markdown
Contributor

Relates to #442. /dev/null is built in the open by its own users, but nothing on a profile says so. This adds a 14th badge, upstream: "Got a pull request merged into /dev/null itself."

  • UpstreamContributorsQuery asks GitHub for the repository's contributors (anyone with a commit on production, which is where every merged pull request lands) through the existing GitHub::accountIds(), up to 10 pages. People are matched by GitHub account ID, so a renamed username keeps the badge.
  • The list is cached for an hour and shared by every profile. When GitHub doesn't answer, the last list it gave is kept and asked for again a minute later, so an outage neither hides badges nor sends every profile view to GitHub.
  • Like the other badges it's computed from current data, gives no XP, and uses the git-pull-request icon in the shelf and the dialog.
  • The knowledge base lists it, so Tom can explain it.

It doesn't overlap with #488: that PR builds the /about list in its own ContributorsQuery; this one only needs the IDs. If #488 lands first, the two could share one GitHub call.

Tests: tests/Unit/Queries/UpstreamContributorsQueryTest.php (matching by ID, pagination, the hour of cache, the fallback while GitHub is down, and no badge when it has never answered) and an unlock case in UserAchievementsQueryTest. The full suite passes with 100% coverage and type coverage.

The badge unlocked on a profile:
upstream-badge

Copilot AI balanced review requested due to automatic review settings October 19, 2026 23:59
@Akiyo974

Copy link
Copy Markdown
Contributor Author

The only failure was NotificationGroupsQueryTest > it keeps stars and conversations apart while grouping followers, unrelated to this change: the run hit it at 00:01 UTC, so its two follows (created 2 and 1 minutes earlier) fell on different days and weren't grouped (DATE(created_at)). Re-ran CI with an empty commit.

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.

🟡 Changes recommended

Concurrent cache misses can duplicate GitHub requests and bypass the intended shared outage backoff.

1 open issue
What changed in this PR

Adds an upstream achievement recognizing contributors to /dev/null within the existing profile badge system.

Changes:

  • Fetches GitHub contributor IDs with hourly caching and outage fallback.
  • Adds badge eligibility and icons to both achievement views.
  • Documents the badge and tests contributor matching, caching, and unlocking.
File Description
tests/​Unit/​Queries/​UserAchievementsQueryTest.php Tests badge unlocking and updated count.
tests/​Unit/​Queries/​UpstreamContributorsQueryTest.php Tests contributor lookup, pagination, and caching.
resources/​js/​components/​achievements-shelf.tsx Adds the upstream icon.
resources/​js/​components/​achievements-dialog.tsx Adds the upstream icon.
KNOWLEDGE_BASE.md Documents eligibility and updates badge count.
app/​Queries/​UserAchievementsQuery.php Integrates contributor-based eligibility.
app/​Queries/​UpstreamContributorsQuery.php Fetches and caches contributor IDs.
app/​Enums/​Achievement.php Defines upstream badge metadata.

Review effort: Balanced

Comment thread app/Queries/UpstreamContributorsQuery.php
Christen Dijoux added 2 commits October 23, 2026 14:44
…-badge

# Conflicts:
#	KNOWLEDGE_BASE.md
#	app/Enums/Achievement.php
#	app/Queries/UserAchievementsQuery.php
#	resources/js/components/achievements-dialog.tsx
#	resources/js/components/achievements-shelf.tsx
#	tests/Unit/Queries/UserAchievementsQueryTest.php
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.

2 participants