Skip to content

fix(doctor): require exact GitHub hosts for release freshness - #7229

Merged
loopx-agent merged 1 commit into
mainfrom
codex/doctor-github-origin-20261024
Oct 24, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/doctor-github-origin-20261024

Conversation

@BigDataDZ

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

Installation freshness must not identify another host as GitHub merely because its remote URL contains github.com. The existing substring search accepted both https://notgithub.com/example/project.git and another host's /github.com/example/project.git path, allowing an unrelated tracking ref to influence the doctor's upgrade recommendation.

Parse URL authority and anchor SCP syntax in the existing Git adapter. Require the exact GitHub hostname, reject whitespace and invalid ports, and preserve supported HTTPS/HTTP/Git/SSH forms, legacy SSH aliases, and Unicode remote/ref readback. This is source classification, not authentication of fetched Git objects.

Author Declaration

  • Written by: model_agent (OpenAI Codex), under the author's direction.
  • Implemented against: the existing source-freshness contract in loopx/doctor_git.py and loopx/doctor.py at 58e646f7115b167df60442f8766a37ba50fa1a71; reproduced defect is the outcome basis. Intended base: main.
  • Criteria: non-GitHub lookalikes supply no freshness source; legitimate GitHub transports retain existing freshness decisions; malformed addresses cannot acquire a source through parser normalization. All implemented in the existing provider boundary.

Validation

Tested revision: 1d6c8a477b7bf586d5b17c7439274ede6cd89705. Run state: finished. Inputs: synthetic. Native Windows, CPython 3.12.10, real disposable Git repositories; no remote fetches.

  • tests/test_doctor_install_freshness.py, tests/test_doctor_git_encoding.py, and tests/test_install_source_git_provenance.py: 66 passed, 3 skipped. Skips are existing POSIX installer cases.
  • Twenty real-Git cases exercise the fetched-ref resolver and actual doctor freshness consumer, asserting both source identity and requires_upgrade. Initial regressions failed before repair; separate negative port/whitespace and positive legacy SSH cases also failed before their corresponding corrections.
  • Independent author-side review caught the legacy SSH compatibility gap; the final implementation and tests retain both git+ssh and ssh+git.
  • Ruff, whitespace, semantic advisory, bilingual RFC diff checks and public-boundary scans pass. The inline transport-scheme set describes Git URL syntax locally; it does not create a new shared vocabulary or authority contract.

Scope And Continuation

Complete within this installation-diagnostic repair. Existing repository/ref resolution and upgrade mechanisms retain their owners. The stable Python Git transport remains the appropriate placement; no parallel TypeScript decision owner or speculative abstraction is added. The related refactor replaces the substring matcher with one cohesive parser.

Frontend/Lark/CLI: existing diagnostic consumption only; no new operation, setting or visual surface. Packaged frontend and installed-host validation were not run. Hosted CI and maintainer review remain pending; no approval or merge is claimed.

Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | reasoning_effort=max

Exact head: 1d6c8a477b7bf586d5b17c7439274ede6cd89705

动机

核对安装版本、决定是否升级的维护者。 诊断仅凭远端地址里的 github.com 子串认定 GitHub 来源,其他主机的本地跟踪引用也能触发升级建议。 远端为 notgithub.com 或其他站点的 /github.com/ 路径时,修复前显示落后并建议升级,修复后不再把其跟踪引用作为 GitHub 版本依据。 真实 Git 远端和引用经原来源解析器进入 doctor 新鲜度消费者,伪主机不再触发升级,合法传输保持可用,完整对照的其他诊断保持。 本次仅纠正来源地址分类,不认证下载对象、不联网 fetch、不安装升级,也不证明已安装主机或原生 Windows 已采用。

改动思路

复用现有 Python Git IO adapter,标准 URL 解析先核 authority,SCP 形式从主机开头完整匹配,再检查已有 owner/repository。来源与升级投影仍由原消费者拥有,不加新状态、配置或 TypeScript 决策分支。 完整边界是精确 GitHub 主机、现有 Git URL/SCP 形式和对应新鲜度建议;本地引用来源匹配不等于来源内容认证。

No change leaves reproduced foreign-host upgrade advice. Anchor SCP and parse URL authority at the existing owner; a blacklist, stricter substring or new trust registry is less precise or larger. 现有意图已足够,不增加用户确认轮次、配置复制或手动账本。物理来源的读取与用户选择分别归原 owner;本次没有把发现、安装或可用性当成激活、执行、验收或升级授权。这个分支用文字即可说明,未引入未核实图示。

具体改动

没有另外约束这个局部来源解析修复的已接受书面规格,采用 no_spec。判断依据是不可变基线 58e646f7115b167df60442f8766a37ba50fa1a71 的现有 manifest repo/ref、来源根目录隔离和实际 doctor 消费者,加上可复现的伪主机升级误报;作者的测试列表不会单独成为验收标准。

关键代码讲解

  • _github_repository_from_remote_url:有 scheme 的地址先用 urlsplit 读取 authority,并访问 port 触发合法性检查;只接受现有 Git 传输形式、精确 github.com、无 query/fragment。SCP 语法单独从主机开头完整匹配,然后整个路径恰为 owner/repository。空格/tab 不可被解析器悄悄规范化后取得身份。
  • trusted_release_ref_for_root:仍先校验真实源码根目录、隔离四个环境 Git 路由变量,再读取 remote URL;只有匹配 manifest repository 的远端才能提供已存在的跟踪引用。没有网络 fetch,也没有把 ref 当下载对象认证。
  • build_install_freshness:既有消费者沿原 source 比较给出 reason、来源和 requires_upgrade。错误主机现在不能使安装显示落后;合法 SSH/HTTPS 显式端口也恢复可用。格式、引用选择、未知来源和修复文案仍属原 owner。

完整审查两路径 +88/-4,包括全部生产分支、未修改共享消费者和新增真实后端测试;没有只看最后补丁或继承作者结论。

对主干的风险

独立本机三个原模块 69 passed,无跳过;真实 Git source、UTF-8 remote/ref、manifest/root 约束和 doctor 新鲜度均在其中。额外32组相同真实远端/引用逐版走生产来源解析与 doctor 消费者,比较完整输出,不归一化语义差异:20组完全相同;9组伪主机/无效输入不再产生升级建议;3组合法显式端口原来被子串规则漏掉,本头正确恢复来源。HTTP/HTTPS/Git、SCP、git+ssh/ssh+git、大小写主机继续通过;其他仓库、缺失ref、额外路径、query/fragment及超界端口保持拒绝。另4次缺失ref/仓库不匹配控制通过。

真实来源读前读后全文件哈希一致,并故意污染四个 Git 路由变量证明未借用外部仓库;只使用隔离合成仓库。独立 local quick premerge 6直接+3选中检查通过,涵盖安装、打包安装、update smoke,以及双语、语法和维护边界检查。相关 #7226 的 dirty 未知修复位于相邻但不同语义,不依赖其提交、评审或 live 采用。

最大的剩余限制是“URL写作 GitHub”并不能认证对象来自 GitHub,本地 remote/ref 本身可被操作者编辑;此 PR 的动机也明确只修分类,没有升格安全保证。没有新增协议、配置、自动升级或权限;scheme 集合是本地 Git URL 语法,不是新共享状态词表。端口路径恢复与伪主机拒绝均在公开动机及本评审明确披露,没有静默启用新能力。原生 Windows、真实已安装采用、全仓套件和网络对象验证未独立运行。当前 wait_for_ci=false,没有查询或等待远程 CI。

我的整体评价

未发现阻塞问题,APPROVE。局部交付 goal_achieved,仅指来源分类与诊断修复;长程影响 preserved,用户体验 improved,不把测试或 PR 数当长期净收益。已有 source owner 足够,解析器替换子串匹配是有界且可回滚的简化,不需要新能力或迁移。 复用现有 Python Git IO adapter,标准 URL 解析先核 authority,SCP 形式从主机开头完整匹配,再检查已有 owner/repository。来源与升级投影仍由原消费者拥有,不加新状态、配置或 TypeScript 决策分支。 完整边界是精确 GitHub 主机、现有 Git URL/SCP 形式和对应新鲜度建议;本地引用来源匹配不等于来源内容认证。

检查了doctor来源解析和新鲜度输出;无渲染组件、页面布局、控件或视觉素材变动,视觉评审不适用。 未独立执行原生Windows、live安装采用、全仓套件或网络对象认证;实际Git与doctor消费者已执行。 已通过、失败及未测试范围分别保留;全树健康、长期效果、实际主机升级与其他 PR 的合入不由本次结论认证。合并仍归维护者,本轮没有合并或安装。

English verdict: APPROVE. The exact head fixes foreign-host freshness attribution while preserving supported Git transports and the existing diagnostic owner. Real-Git paired controls and local repository checks passed; URL matching is not object authentication, and native installed adoption remains unverified.

@loopx-agent
loopx-agent merged commit 1746822 into main Oct 24, 2026
29 of 37 checks passed
@loopx-agent
loopx-agent deleted the codex/doctor-github-origin-20261024 branch October 24, 2026 12:36
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