Skip to content

fix(windows): keep installer output and bundle checks portable - #4986

Merged
huangruiteng merged 5 commits into
loopx-project:mainfrom
Duang777:codex/fix-windows-bundle-portability
Sep 24, 2026
Merged

huangruiteng merged 5 commits into
loopx-project:mainfrom
Duang777:codex/fix-windows-bundle-portability

Conversation

@Duang777

Copy link
Copy Markdown
Contributor

Summary

  • Normalize .gitkeep line endings in Chat bundle source fingerprints so a Linux-built artifact verifies on a CRLF checkout.
  • Accept an existing Windows release pointer without release_root when no previous Chat delivery can be reused.
  • Send Chat bundle build progress to stderr so the PowerShell installer keeps stdout as one JSON document.

Context

PR #4949 exposed two failures in the existing windows-powershell baseline. Its diff does not touch the installer, bundle contract, workflow, or Windows tests. Replaying that run's exact Chat artifact against a CRLF checkout isolated the fingerprint mismatch to apps/presentation/dashboard/public/.gitkeep.

Validation

  • Focused tests: 15 passed, 4 skipped
  • Ruff: passed
  • Exact artifact plus CRLF checkout: all 313 source fingerprints matched
  • Standard premerge: 5/5 catalog checks passed, with no warnings or manual holds
  • git diff --check: passed

Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>
Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>
Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>

@huangruiteng huangruiteng 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.

动机

#4986 解决 Windows 源码快照安装时 Chat bundle 的 CRLF 指纹差异、旧 release pointer 缺少 release_root,以及构建进度污染安装收据的问题。这些都是有实际调用方的窄修复;不过“PowerShell installer stdout 是单个 JSON 文档”在文档推荐路径上仍未成立。

改动思路

source_digest.gitkeep 做换行归一化;_ensure_chat_bundle 在旧 pointer 无可复用 root 时转为构建,并把 builder 的 stdout 导向 stderr。这个归属基本合适,未新增状态或并行规则。但最终输出还由外层 scripts/install-windows.ps1 共同决定。

具体改动

关键代码讲解

  • loopx/presentation/chat_bundle.py:30source_digest:让 .gitkeep 进入文本换行归一化路径,避免跨平台 bundle 源指纹漂移。
  • loopx/windows_install.py:60_ensure_chat_bundle:旧 pointer 没有 release_root 时不尝试复用;调用 scripts/chat_bundle.py ensure 时将进度输出重定向到 stderr。
  • loopx/windows_install.py:387main:成功后仍向 stdout 打印 JSON 安装收据;但 PowerShell 包装脚本随后还会输出 PATH 提示。

对主干的风险

[P1] 文档推荐的 -AddToUserPath 路径仍破坏单 JSON stdout。 docs/guides/installing-loopx.md:89-91 明确以该开关调用 PowerShell 安装器。scripts/install-windows.ps1:42 透传 Python 的 JSON 后,:69Write-Output 又追加一行纯文本。即使本 PR 的 Python 测试全部通过,解析整个 stdout 的调用方仍会得到“JSON 后有额外数据”。请将 PATH 提示放到非 stdout 流,或纳入结构化收据,并补一个覆盖外层 PowerShell -AddToUserPath 的整段 stdout JSON 解析回归测试。

在精确 head 1e8382d2 的独立检出中,定向 pytest 为 15 passed、4 skipped(4 项需原生 Windows),四个改动文件的 Ruff 与 git diff --check 均通过。当前机器无 pwsh,因此未声称完成 Windows 原生验证;根据此 Goal 的配置,本次未等待或查询远端 CI。

我的整体评价

修复方向和体量合适,.gitkeep 与旧 pointer 的覆盖有价值;但当前完整安装入口未满足 PR 自述的输出契约,故对这个精确 head 请求修改。修好外层提示流并补回归后,可就同一用户路径复核;不需要扩大成新的安装框架。相关的小型保行为改进已随 helper 提取完成,暂无额外 TS 重构要求。

…dle-portability

Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>
Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>

@huangruiteng huangruiteng 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.

动机

#4986 解决 Windows 源码快照安装时 Chat bundle 的 CRLF 指纹差异、旧 release pointer 缺少 release_root,以及构建进度污染安装收据的问题。这些都是有实际调用方的窄修复;不过“PowerShell installer stdout 是单个 JSON 文档”在文档推荐路径上仍未成立。

改动思路

source_digest.gitkeep 做换行归一化;_ensure_chat_bundle 在旧 pointer 无可复用 root 时转为构建,并把 builder 的 stdout 导向 stderr。这个归属基本合适,未新增状态或并行规则。但最终输出还由外层 scripts/install-windows.ps1 共同决定。

具体改动

关键代码讲解

  • loopx/presentation/chat_bundle.py:30source_digest:让 .gitkeep 进入文本换行归一化路径,避免跨平台 bundle 源指纹漂移。
  • loopx/windows_install.py:60_ensure_chat_bundle:旧 pointer 没有 release_root 时不尝试复用;调用 scripts/chat_bundle.py ensure 时将进度输出重定向到 stderr。
  • loopx/windows_install.py:387main:成功后仍向 stdout 打印 JSON 安装收据;但 PowerShell 包装脚本随后还会输出 PATH 提示。

对主干的风险

[P1] 文档推荐的 -AddToUserPath 路径仍破坏单 JSON stdout。 docs/guides/installing-loopx.md:89-91 明确以该开关调用 PowerShell 安装器。scripts/install-windows.ps1:42 透传 Python 的 JSON 后,:69Write-Output 又追加一行纯文本。即使本 PR 的 Python 测试全部通过,解析整个 stdout 的调用方仍会得到“JSON 后有额外数据”。请将 PATH 提示放到非 stdout 流,或纳入结构化收据,并补一个覆盖外层 PowerShell -AddToUserPath 的整段 stdout JSON 解析回归测试。

在精确 head 1e8382d2 的独立检出中,定向 pytest 为 15 passed、4 skipped(4 项需原生 Windows),四个改动文件的 Ruff 与 git diff --check 均通过。当前机器无 pwsh,因此未声称完成 Windows 原生验证;根据此 Goal 的配置,本次未等待或查询远端 CI。

我的整体评价

修复方向和体量合适,.gitkeep 与旧 pointer 的覆盖有价值;但当前完整安装入口未满足 PR 自述的输出契约,故对这个精确 head 请求修改。修好外层提示流并补回归后,可就同一用户路径复核;不需要扩大成新的安装框架。相关的小型保行为改进已随 helper 提取完成,暂无额外 TS 重构要求。

English verdict: REQUEST_CHANGES - head 1e8382d; the documented -AddToUserPath path still appends non-JSON stdout after the receipt. Local focused tests: 15 passed, 4 Windows-only skipped; Ruff and diff-check passed. Native PowerShell was unavailable.

@Duang777

Duang777 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@huangruiteng Please re-review the PowerShell stdout fix at exact head 4d173e52c0d111c63b463af04352b7750ad3a354 (merged current main at 076682236a58f502ac01a2d71ffaaa461c5139df).

The requested outer-wrapper contract is now covered:

  • scripts/install-windows.ps1 -AddToUserPath writes its PATH notice directly to stderr, leaving the Python installer receipt as the only stdout document;
  • the native Windows installer regression now invokes the real outer script with -AddToUserPath, parses the complete captured stdout with json.loads, and asserts the notice is on stderr;
  • the test snapshots and restores the exact user PATH value through a Base64 round trip in finally, so local Windows runs do not retain the temporary test path.

Local verification on the new merged head: focused Windows/bundle tests 15 passed and 4 native-Windows cases skipped on macOS; Ruff and diff checks passed; standard premerge passed all 13 selected checks. The branch was updated with signed-off commits and a normal push. Exact-head CI has started; the Windows job will exercise the four native cases.

Exact-head CI update (09:50 UTC): the complete native Windows job passed. The Python lifecycle suite finished with 161 passed and 3 skipped, including the outer PowerShell -AddToUserPath regression that parses the full stdout receipt and checks the PATH notice on stderr. SQLite CLI integration passed 5/5; the TypeScript scheduler and SQLite authority suite passed 365/365; the python.exe-only Chat bundle rebuild and source verification also passed. DCO, dependency review, release artifacts, Frontstage, minimum Node, Chat bundle, Dashboard, and installed-distribution checks have passed. The remaining exact-head jobs are still running.

@huangruiteng huangruiteng 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.

动机

#4986 修复 Windows 源码安装的三个实际问题:CRLF 检出使 .gitkeep 的 Chat bundle 指纹不同,旧 release pointer 缺少 release_root 时预构建失败,以及安装进度污染 JSON 收据。上次 review 指出的外层 -AddToUserPath 提示仍写入 stdout,本次提交也已覆盖。

改动思路

沿用现有分工:source_digest 决定源码指纹,_ensure_chat_bundle 选择可复用旧 bundle 或重新构建,PowerShell 包装脚本负责可选的用户 PATH 更新。构建进度与 PATH 提示进入 stderr,Python 安装器继续独占 stdout 收据。没有引入新的 pointer 状态或安装入口。

具体改动

关键代码讲解

  • loopx/presentation/chat_bundle.py:30source_digest 将已知文本占位文件 .gitkeep 纳入 CRLF 归一化,二进制文件仍逐字节取指纹;tests/presentation/test_chat_bundle.py 同时检验这两侧。
  • loopx/windows_install.py:60_ensure_chat_bundle 对缺失 release_root 的旧 pointer 直接走新构建,并将 builder stdout 转到 stderr;tests/test_windows_install.py 覆盖这一退路与进度流。
  • scripts/install-windows.ps1:69-AddToUserPath 提示写到 stderr。原生 Windows 安装测试现在运行整个外层脚本、解析完整 stdout 为 JSON,并在 finally 中恢复原用户 PATH。

对主干的风险

先前阻塞点已在最新 diff 中修复:旧提交的 Write-Output 会在 JSON 后追加文本;当前提交改为 Console.Error.WriteLine,并给外层脚本加了回归。相同 .gitkeep CRLF/LF 输入在基线指纹不等,在本 head 相等。定向测试 15 passed、4 skipped,Ruff、git diff --check 与当前 main 的无冲突合并检查均通过。

本机不是原生 Windows,也没有 pwsh,因此四项 Windows 集成测试未在此次 review 中执行。额外启动的宽范围 premerge 在与本 diff 无关的安装 smoke 中运行数分钟后中止,不能算作通过;合并前仍须以仓库规定的 Windows 检查和 merge readiness 为准。本次没有查询或等待远端 CI。

语义与 CI 对齐

这复用现有 Chat bundle 指纹、旧 pointer 和安装收据契约,只补齐 .gitkeep 的跨平台文本归一化与 stdout/stderr 边界;没有新的语义词汇或权限。测试保留二进制字节差异,并对文档推荐的 -AddToUserPath 路径设置完整 stdout JSON 断言。

我的整体评价

对精确 head 4d173e52c0d111c63b463af04352b7750ad3a354 给出 APPROVE。修复范围与问题相称,上一轮的外层包装缺口已闭合;原生 Windows 的实际执行结果属于合并前独立验证,当前 review 没有将跳过项冒充通过。相关的小型保行为整理已体现在预构建 helper 的提取中,无需扩大为安装框架重构。

English verdict: APPROVE - head 4d173e5; the PowerShell PATH notice no longer appends to JSON stdout, and the full-wrapper regression is present. Local focused tests: 15 passed, 4 Windows-only skipped; Ruff and diff check passed. Native Windows validation remains a merge gate.

@huangruiteng
huangruiteng merged commit 2126967 into loopx-project:main Sep 24, 2026
19 of 25 checks passed
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