Skip to content

feat(rank): 未注册贡献者不再产生 /u/ 死链(hasProfile 打标 + 兜底档案页)#373

Merged
longsizhuo merged 2 commits into
mainfrom
feat/rank-profile-fallback
Jul 18, 2026
Merged

feat(rank): 未注册贡献者不再产生 /u/ 死链(hasProfile 打标 + 兜底档案页)#373
longsizhuo merged 2 commits into
mainfrom
feat/rank-profile-fallback

Conversation

@longsizhuo

Copy link
Copy Markdown
Member

Closes #372

背景实测(2026-07-18):rank 页 21 位贡献者里 13 位从未注册本站,VIEW DOSSIER → 全是 404 死链,且 sitemap 把这 13 个 /u/{id} 主动喂给了爬虫(Sentry 里 AhrefsBot 反复打 /en/u/150361711 的流量源头)。

方案 A:不生成死链

  • generate-leaderboard.mts:构建时逐人调 /api/user-center/profile/{githubId} 探测注册状态,JSON 每行加 hasProfile(探测失败降级 false——宁可少个按钮不留死链)。走接口不直连 DB(DB 已收回内网),~20 人的 N+1 与既有 GitHub API 兜底同模式
  • ContributorRow:仅 hasProfile 时渲染 VIEW DOSSIER,未注册者保留原有 GITHUB 外链
  • sitemap.tshasProfile !== true/u/{id} 不再收录

方案 B:直接命中的旧死链给兜底页

/u/{githubId} 后端查无此人时,若命中 leaderboard(git 贡献者但未入驻)→ 渲染「尚未入驻」档案页:仓库贡献统计(积分/commits)+ 贡献文档列表 + GitHub 外链 + 「是你本人?登录认领」CTA。数据全部来自 build-time JSON,零后端/DB 调用;metadata noindex。非贡献者照旧 404。

验证

  • 重新生成 JSON:hasProfile 探测 8/21,与死链实测(13 个 404)完全互补
  • dev 实测:/zh/u/150361711(未注册)→ 200 兜底页;/zh/u/999999999 → 404;/zh/u/114939201(已注册)→ 200 正常主页
  • sitemap 实测:/u/ 条目从 21 个减到精确 8 个
  • pnpm typecheck / pnpm lint(0 error)/ vitest 52 通过 / pnpm build 通过
  • 注册状态是构建时快照:贡献者事后注册,下次部署自动出现 DOSSIER 按钮(无需人工维护)

注意:Vercel 构建环境需已配 BACKEND_URL(现状已配);未配时脚本默认打生产 api.involutionhell.com,行为一致。

🤖 Generated with Claude Code

https://claude.ai/code/session_01RtSNVtrEkCsFVHrbt4Zjgi

方案 A:generate-leaderboard.mts 构建时逐人探测 profile 接口,JSON 加
hasProfile;ContributorRow 仅对已注册者渲染 VIEW DOSSIER;sitemap 不再
收录未注册者的 /u/{id}(此前 13 个死链是 sitemap 主动喂给爬虫的)。

方案 B:/u/{githubId} 后端查无此人时,若命中 leaderboard 则渲染"尚未
入驻"兜底页(仓库贡献统计 + GitHub 外链 + 登录认领 CTA,数据全部来自
build-time JSON,不打后端),不再掉进通用 404;非贡献者仍 404。

Closes #372

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RtSNVtrEkCsFVHrbt4Zjgi
Copilot AI review requested due to automatic review settings July 18, 2026 22:15

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vercel

vercel Bot commented Jul 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
involutionhell-github-io Ready Ready Preview, Comment Jul 18, 2026 10:55pm
website-preview Ready Ready Preview, Comment Jul 18, 2026 10:55pm

注释规则遵循 CLAUDE.md(禁引 issue 编号);全 false 大概率是探测挂了
而非真没人注册,按"不隐藏故障"原则加 build 日志告警(降级方向不变)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RtSNVtrEkCsFVHrbt4Zjgi
@longsizhuo
longsizhuo merged commit 7a3a5e4 into main Jul 18, 2026
6 of 8 checks passed
@longsizhuo
longsizhuo deleted the feat/rank-profile-fallback branch July 18, 2026 22:32
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.

rank 页 Contributors 的 VIEW DOSSIER 对未注册贡献者是死链(13/21 个 /u/<githubId> 404)

2 participants