Repository navigation
feat(Branches): 远程分支行右侧显示关联 GitHub PR 状态与 PR 号 - #142
Merged
Merged
Conversation
Branches 视图远程分支(含 Favorites 内远程条目)行右侧 description 位显示关联 GitHub Pull Request 徽标(#138 Merged 形态),云图标按状态着色(Merged 紫 / Closed 红 / Open 绿 / Draft 弱化),Tooltip 增 PR 号/标题与经反 SSRF 主机白名单 校验的 Open on GitHub 链接。收藏黄色与活动蓝色优先于 PR 状态色。 - engine/pr 纯逻辑四件:types(PullRequestVM)/ graphql-query(UPDATED_AT 倒序 全态列表查询,$variables 防注入)/ model(宽容解析 + prBadge + prsEqual)/ match(fork 全名 → 同仓 → 唯一兜底三级匹配,歧义宁缺勿错,剥 remote 前缀复用 resolveRemoteBranch 最长前缀); - adapter GitHubPrService:复用 CI 服务 getGitHubContext()(remote/provider 单一 事实源),分页 ≤2×50、TTL 60s、in-flight 去重、401/403/限流冷却独立降级, 未登录/非 GitHub/关闭 → 零请求静默休眠; - 树集成:ensurePrData 异步 kick(索引与快照不同才 fire 一次,引用相等守卫无 刷新循环,repoRoot 竞态守卫防多根串染),GitHubAuth 增 onDidChange 透传、 mdTooltip 增 links 链接行(仅含链接实例放开 isTrusted); - 配置 hyperGit.branches.pr.enabled(默认 true,scope resource); - 单测 25 例(pr-graphql-query / pr-model / pr-match),全套 454/454 绿。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini Code Assist](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- docs/features/branches-pr-status.md:镜像 log-ci-status.md 结构——数据流(嵌 archify 图)、刷新与终止性、三级匹配、认证与安全(safePrUrl 反 SSRF)、限流 与性能(TTL 60s / ≤2×50 / 冷却独立)、边界行为表、配置与实现索引、验证清单; - archify 四件套:mermaid 源图 + 交互 HTML(finalize --quality showcase 四道 门禁全过)+ 深浅双主题 SVG(经 svg-light/svg-dark 直出并浏览器渲染校验); - 溯源矩阵与 archify 索引各增一行(锚定实现提交 7ac122c); - knowledge-map:功能文档条目 + engine 16 模块 / adapter 增 pr/; - CHANGELOG [Unreleased] Added 条目;.gitignore 增 .archify/ 工作目录。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini Code Assist](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 安全:tooltip Markdown 注入防御(codeSpan 按最长反引号串压制 fence、转义 []()、 isTrusted 白名单形态、supportThemeIcons 关闭);主机白名单收敛为共享谓词 isAllowedGitHubHost(CI openExternal 与 PR safePrUrl 统一 hostname 语义) - 正确性:getPullRequests 冷却/inflight 仓根守卫防跨仓串标;索引输入(owner/remotes) 快照参与续期判定;resolveRemote 增 remotes 签名失效(首帧冻结/改址自愈); owner 大小写不敏感匹配;登出清缓存 + 代次作废在途取数(登出即隐去徽标); Retry-After 解析 NaN 防护(parseRetryAfterMs);parseNode 字段级守卫 - 行为:失败 60s 退避且走既有缓存(无闪烁);树侧 epoch 化补拉(切库/登录/配置 在途竞态统一兜住);「Open on GitHub」措辞与文档同口径 - 复用:fetchWithTimeout 提取 graphql-http.ts 双服务共用;单测 +16 例(pr 30、 parseRetryAfterMs/isAllowedGitHubHost 7、字段守卫与判别用例) 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- Tier a 身份校验(用户裁决实施):GraphQL 补 headRepository{name},VM 增 headRepo,
remote 身份按 host/owner/repo 三维比对(owner/repo 双侧小写、host 与本仓同 forge
实例)——排除 login 与 remote 名撞名、含 / remote 名与键同形、同 owner 异仓、
异 forge 实例的错误命中(宁缺勿错)
- 取数主机策略(安全):仅 github.com 与已配置 github-enterprise.uri 实例取数,
其余「GitHub 形态」远程视同非 GitHub(零请求),杜绝 GHE token 发往任意主机
- tooltip 注入面收口:escapeMd 增转义 <>(防 CommonMark 角括号 autolink 在
isTrusted 实例生成非白名单可点链接)
- 文档同口径:Tier a 表行三维校验、取数主机策略、provider/取数仓耦合
(hyperGit.log.ci.provider 钉死休眠、remote 重定向)披露
- 测试 +9 例(身份校验撞名/同形/异仓/异 host/大小写、headRepo 解析与相等性)
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 取数主机策略(CI+PR 双侧):共享谓词 isGitHubInstanceHost——仅 github.com 与
已配置 github-enterprise.uri 实例取数,其余「GitHub 形态」远程零请求,
杜绝 token 发往任意主机(CI status/getStatuses + PR isTrustedRemoteHost)
- openExternal 改 WHATWG URL 解析:与浏览器同规范取 hostname,封死
evil.com\@github.com 类解析器分歧绕过白名单的路径
- 传输层:fetchWithTimeout 保护伞覆盖 body 读取({res,done} 契约,401/403
早退同样解除);dispose 信号已中止时入口短路(迟到监听器不触发)
- 解析健壮性:parseGitHubRemote 对非法百分号序列 decode 容错返回 null
(任一坏 remote URL 不再静默打死 PR 徽标功能);Tier a 身份表改精确
remote 名取键(消除大小写互异名的身份坍缩)
- 文档:log-ci-status 反 SSRF 白名单同口径 + 取数主机策略条目;
CHANGELOG Fixed 条目
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- cacheMatches 单一判定(仓根 + host/owner/repo 四维)统一 TTL 命中、冷却续供、 失败续显三条读路径,消除守卫不对称(改址/换仓/换 provider 后不续供旧仓索引) - 失效收敛为 invalidate():登录态与取数源配置(PR 开关/log.ci.*/github-enterprise.uri) 推进 fetchGeneration(作废在途写回与冷却武装)+ 清缓存 + 复位退避与限流冷却, 经 onDidInvalidate 单一事件通知树侧清快照重取(依赖清单仅服务一处维护) - in-flight 去重键扩为仓根+取数上下文(set-url 竞态不串仓);Tier a 身份表改 精确 remote 名取键(消除大小写互异名坍缩);signIn 与 status/getStatuses 同门 - package.json log.ci.provider auto 描述同步主机策略;decode 容错回归用例; 文档/注释全量同口径 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
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.
概述
Branches 视图远程分支行右侧 description 位显示关联 GitHub Pull Request 徽标(
#138 Merged形态),云图标按状态着色(Merged 紫 / Closed 红 / Open 绿 / Draft 弱化),悬停见 PR 号、标题与经反 SSRF 主机白名单校验的 Open on GitHub 链接。状态语义对齐需求参考图(Open 绿 / Merged 紫 / Closed 红);保留原生树视图形态(用户确认方案)。实现要点
types(PullRequestVM)、graphql-query(UPDATED_AT 倒序全态列表查询,$variables 防注入)、model(宽容解析 +prBadge+prsEqual)、match(fork 全名 → 同仓 → 唯一兜底三级匹配,歧义宁缺勿错;剥 remote 前缀复用resolveRemoteBranch最长前缀)。GitHubPrService:复用 CI 服务getGitHubContext()(remote/provider 单一事实源,新增组合方法);分页 ≤2×50、TTL 60s 缓存 + in-flight 去重、401/403/限流冷却独立降级;未登录 / 非 GitHub / 配置关闭 → 零请求零徽标静默休眠。ensurePrData异步 kick(首轮无徽标先行渲染,索引与快照不同才 fire 一次;TTL 命中与数据未变返回同一实例 → 引用相等守卫无刷新循环;repoRoot 竞态守卫防多根串仓);GitHubAuth增onDidChange透传(登出即隐徽标);mdTooltip增links链接行(仅含链接实例放开isTrusted)。hyperGit.branches.pr.enabled(默认 true,scope: resource)。docs/features/branches-pr-status.md+ archify 数据流图四件套(finalize showcase 四道门禁全过)+ 溯源矩阵 / archify 索引 / knowledge-map / CHANGELOG 同步。验证
pnpm run check-types+pnpm run lint通过;pnpm run test:unit49 文件 / 454 例全绿(含 25 个新用例,全部守卫测试零改动通过)。🤖 Generated with Claude Code