feat(rank): 未注册贡献者不再产生 /u/ 死链(hasProfile 打标 + 兜底档案页)#373
Merged
Conversation
方案 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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
注释规则遵循 CLAUDE.md(禁引 issue 编号);全 false 大概率是探测挂了 而非真没人注册,按"不隐藏故障"原则加 build 日志告警(降级方向不变)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RtSNVtrEkCsFVHrbt4Zjgi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ts:hasProfile !== true的/u/{id}不再收录方案 B:直接命中的旧死链给兜底页
/u/{githubId}后端查无此人时,若命中 leaderboard(git 贡献者但未入驻)→ 渲染「尚未入驻」档案页:仓库贡献统计(积分/commits)+ 贡献文档列表 + GitHub 外链 + 「是你本人?登录认领」CTA。数据全部来自 build-time JSON,零后端/DB 调用;metadatanoindex。非贡献者照旧 404。验证
hasProfile探测 8/21,与死链实测(13 个 404)完全互补/zh/u/150361711(未注册)→ 200 兜底页;/zh/u/999999999→ 404;/zh/u/114939201(已注册)→ 200 正常主页/u/条目从 21 个减到精确 8 个pnpm typecheck/pnpm lint(0 error)/ vitest 52 通过 /pnpm build通过注意:Vercel 构建环境需已配
BACKEND_URL(现状已配);未配时脚本默认打生产api.involutionhell.com,行为一致。🤖 Generated with Claude Code
https://claude.ai/code/session_01RtSNVtrEkCsFVHrbt4Zjgi