Uh oh!
There was an error while loading. Please reload this page.
fix(repo): enforce LF checkouts across platforms - #302
Conversation
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe repository now enforces LF line endings for text files. Contributor documentation explains how to normalize an existing checkout and verify its line-ending state. ChangesLF checkout policy
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk:⚪ Minimal · up to The change standardizes text checkouts to LF and documents recovery steps without changing runtime behavior or source contents; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Linked Issues checkExplanation The pull request satisfies the coding objectives in issue Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.) ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
70cb520 to
9bb796eComparett-a1i
commented
Aug 31, 2026
修订完成,最终 head
|
Uh oh!
There was an error while loading. Please reload this page.
Closes#291
Problem
仓库此前没有
.gitattributes或其他仓库级换行策略,工作树中的行尾由开发者机器的 Git 配置决定。在 Windows 且系统 Git 使用常见配置
core.autocrlf=true时,最新main的干净 checkout 会出现:i/lf w/crlf表示索引保存 LF,但工作树实际使用 CRLF。Git 比较时会自动归一化,因此git status仍显示干净,问题很难从工作区状态中发现。这会直接破坏仓库的本地验证契约。Biome 按实际工作树字节检查格式,因此一个没有源码修改、
git status干净的 Windows checkout 会在bun run format:check中报告约 270 个格式错误,建议改动基本都是删除行尾的\r。Windows 贡献者因而无法在干净 checkout 上可靠执行仓库要求的bun run check,而自动格式化还可能产生覆盖全仓库的换行噪声。本问题与 #69 中用户输入包含 CRLF 时 fenced Markdown 的解析问题不同。本 PR 只处理仓库源码的 checkout 策略。
Value
本修复让仓库自身成为换行策略的来源,而不再依赖每位贡献者的全局 Git 配置:
git status干净但格式检查失败的隐蔽故障。Approach
在仓库根目录增加:
这条规则要求 Git 将识别为文本的文件以 LF 写入工作树,同时继续通过
text=auto区分文本和二进制文件。本 PR 没有提交全仓库换行重写,因此不会引入源码内容层面的噪声 diff。提交只包含:
.gitattributes;CONTRIBUTING.md中记录保留旧目录、clone 到新目录的迁移与验证步骤。如果后续出现确实需要 CRLF 的 Windows 专用文件,可以针对具体路径增加更窄的属性规则。
Validation
验证环境为 Windows,系统 Git 配置
core.autocrlf=true。属性解析:
应用策略并重新生成当前工作树后:
使用包含本 PR 提交的隔离 checkout,在
core.autocrlf=true下验证:仓库检查:
bun run check完整通过。Windows 全量测试说明
本地执行
bun run test时,完整测试集中的三个 Windows 进程终止测试出现了间歇性失败:本 PR 不修改运行时代码、进程管理代码或测试代码,这些失败也不经过
.gitattributes或贡献文档的代码路径。进一步隔离验证结果:
background-terminals测试串行运行:全部通过;taskkill /T清理流程时出现。这些测试会真实创建长时间运行的 Node 子进程,并在固定 teardown 时间窗口内调用
taskkill、等待进程树退出和触发 settlement。Node test runner 并行执行多个测试文件时,Windows 的进程调度和清理时序会使这些严格时间窗口产生竞争。因此这里没有把
bun run test标记为通过。现有证据表明这是 Windows 全量并行测试的既有时序稳定性问题,而不是本 PR 引入的行为回归。为保持本 PR 聚焦,本次没有夹带测试基础设施改动;相关测试的 Windows 并发控制适合独立处理。Impact
core.autocrlf对本仓库文本 checkout 的影响。text=auto识别,确需 CRLF 的文件可以增加路径级例外。.gitattributes和CONTRIBUTING.md,没有源码内容重写。Summary by CodeRabbit
Documentation
Chores
Maintainer revision and validation — 2026-08-31
Final head:
9bb796e4a9d3abc2ecfcc3424c19ceb320ceba47, rebased ontomain@f474f60fb5305a9053609aa0ab569bc22ab951ac.git status干净,普通git restore --source=HEAD --worktree -- .也不会强制重写文件。现在建议保留旧目录、clone 到一个未使用的新目录;明确未推送提交、未提交改动、未跟踪/忽略文件不会自动迁移。没有添加脚本或运行时机制。.gitattributes与CONTRIBUTING.md,一行原生 Git 策略不变,无源码重写。bun install --frozen-lockfile、bun run check、bun run test均通过:Node 1086 passed / 1 platform skip / 0 failed;Vitest 30 passed。core.autocrlf=true):334 个文本文件均为i/lf w/lf,0 个w/crlf,2 个二进制文件字节哈希与 Git blob 一致;新 clone 格式检查 278 files passed,工作树干净。旧 CRLF 复现目录保留不动。上述本次验证不是原生 Windows 全量测试验收;前文作者的 Windows 历史验证与失败说明保留。新 head 的 GitHub CI 与实际合并状态另行确认。