fix(checks): give every tracked text file LF on checkout - #8657
fix(checks): give every tracked text file LF on checkout#8657harjothkhara wants to merge 1 commit into
Conversation
A Windows checkout with core.autocrlf=true rewrites tracked text files to CRLF. Repository checks then fail before a contributor changes a file. The starter-prompt generator rejects a carriage return, and these compare a tracked file byte-for-byte against a pinned digest: - the credential-helper pin - the pinned prompt assets - the Hermes image layout - the reviewed MCP runtime bundle - the reviewed npm lockfiles - the pinned workflow actions and scripts - the Deep Agents Code and E2E image fixtures Set text=auto eol=lf for every path instead of naming files, so a file added later is covered too. text=auto keeps Git's binary detection, so Git does not convert the 110 binary files. No tracked file holds CRLF or mixed line endings today, so this normalizes no content. Add a test that derives its file list from git ls-files --eol. Git converts a file when it copies that file out of the index, not when .gitattributes changes, so the test also asserts the worktree form and CONTRIBUTING.md gives an existing Windows checkout the fix. Fixes NVIDIA#8648 Signed-off-by: harjoth <harjoth.khara@gmail.com>
📝 WalkthroughWalkthroughThe repository now enforces LF line endings for tracked text files, documents Windows checkout recovery, and adds Git-backed tests for index and worktree line endings. ChangesLF line-ending enforcement
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR Review Advisor — No blocking findings reportedAdvisor assessment: No blocking advisor findings reported Model lanes
3 terminology differences from the second opinionAdvisory only. These are normalized differences from the primary terminology receipt.
Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests. 3 semantic terminology decisionsTerminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.
E2E guidanceAdvisory only. A maintainer can dispatch the default E2E suite against this exact revision. Recommended E2E: None 1 warning · 0 suggestionsWarningsWarnings do not block.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CONTRIBUTING.md`:
- Line 367: Update the Windows line-ending remediation instructions in
CONTRIBUTING.md to require contributors to commit or stash local changes, or
verify that the working tree is clean, before running git reset --hard; preserve
the existing cache removal and reset steps.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 17df4ffd-4a4c-4acf-95a5-e3ee8722b311
📒 Files selected for processing (3)
.gitattributesCONTRIBUTING.mdtest/checkout-line-endings.test.ts
|
|
||
| If you still have `core.hooksPath` set from an old Husky setup, Git will ignore `.git/hooks`. Run `git config --unset core.hooksPath` in this repo, then `npm install` so `prek install` (via `prepare`) can register the hooks. | ||
|
|
||
| If you cloned this repo on Windows before `.gitattributes` set `* text=auto eol=lf`, your working tree still holds CRLF and the repository checks still fail. Run `git rm --cached -r .` and then `git reset --hard` in this repo to check the files out again with LF. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Protect local changes before the hard reset.
git reset --hard discards staged and unstaged changes. Require contributors to commit or stash local work before this command, or state that the working tree must be clean.
Proposed fix
-If you cloned this repo on Windows before `.gitattributes` set `* text=auto eol=lf`, your working tree still holds CRLF and the repository checks still fail. Run `git rm --cached -r .` and then `git reset --hard` in this repo to check the files out again with LF.
+If you cloned this repo on Windows before `.gitattributes` set `* text=auto eol=lf`, your working tree still holds CRLF and the repository checks still fail. First commit or stash all local changes. Then run `git rm --cached -r .` and `git reset --hard` in this repo to check the files out again with LF.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| If you cloned this repo on Windows before `.gitattributes` set `* text=auto eol=lf`, your working tree still holds CRLF and the repository checks still fail. Run `git rm --cached -r .` and then `git reset --hard` in this repo to check the files out again with LF. | |
| If you cloned this repo on Windows before `.gitattributes` set `* text=auto eol=lf`, your working tree still holds CRLF and the repository checks still fail. First commit or stash all local changes. Then run `git rm --cached -r .` and `git reset --hard` in this repo to check the files out again with LF. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@CONTRIBUTING.md` at line 367, Update the Windows line-ending remediation
instructions in CONTRIBUTING.md to require contributors to commit or stash local
changes, or verify that the working tree is clean, before running git reset
--hard; preserve the existing cache removal and reset steps.
Summary
A Windows checkout with
core.autocrlf=truerewrites tracked text files to CRLF, so repository checks fail before a contributor changes anything..gitattributessets no line-ending rule, so Git converts every text file in the repository.This sets
* text=auto eol=lf, which gives every tracked text file LF on every checkout.Related Issue
Refs: #8648
Changes
.gitattributes:* text=auto eol=lf.test/checkout-line-endings.test.ts: three assertions, all derived fromgit ls-files --eol, so a file added later is covered without editing the test.git check-attrresolveseol: lffor every file the index stores with LF..gitattributeschanges, so a checkout made before this rule keeps its CRLF bytes and keeps failing. This assertion names those files instead of leaving a digest mismatch to diagnose.CONTRIBUTING.md: how to re-check-out an existing Windows clone, next to the existingcore.hooksPathnote.No source file changes, and no tracked content changes.
Why a repository-wide rule and not per-file rules
The issue proposes a rule for the starter-prompt source. That file is one of many. These checks all compare a tracked file byte-for-byte against a pinned digest, or reject a carriage return:
scripts/generate-starter-prompt.mts:19rejects any carriage return.scripts/checks/local-credential-helper-pin.mts:66compares the SHA-256 of the working-tree bytes.test/starter-prompt-docs.test.ts:731byte-compares each prompt asset with its pinned Git blob.test/hermes-final-image-layout.test.ts:502compares 16 SHA-256 digests with the valuesagents/hermes/Dockerfiledeclares.test/mcp-tool-discovery-image-contract.test.ts:306pins four reviewed runtime bundle digests.There are more.
scripts/audit-reviewed-npm-graph.mts:265digests reviewed npm lockfiles,tools/e2e/workflow-boundary-policy.mts:4pins workflow action and script content, andtest/e2e-fixture-dependency-review.test.tsandtest/langchain-deepagents-code-image.test.tspin image fixtures. The Verification section shows those failing on a CRLF checkout too.An enumerated list was written first and reviewed; the review found 18 files the list had missed. A list that must name every pinned file is wrong the moment someone pins a new one, and a test built on that list cannot detect the omission. One rule covers all of them and every future one.
Why this is safe
text=autokeeps Git's own binary detection.git ls-files --eolreports the same 110 binary files before and after the rule, so no binary file is touched.git ls-files --eolreports 0i/crlfand 0i/mixed. The rule therefore normalizes no content and produces no renormalization commit.linguist-generated,diff=markdown, and-diffrules still resolve.git check-attrconfirms this for the bundle and skills paths.One behavior change worth naming:
scripts/bootstrap-windows.ps1andtools/wsl/ci-helper.ps1will check out with LF on Windows instead of CRLF. Both are already LF in the index and on every Linux and macOS checkout today. PowerShell runs LF scripts.Type of Change
Quality Gates
CONTRIBUTING.mdgains the existing-Windows-clone remediation. Nodocs/page changes: no public API, CLI, configuration, default, error, or product behavior changes, and no tracked content changes.Documentation Writer Review
docs-updatedCONTRIBUTING.md. The reviewer confirmed nodocs/page needs a change:docs/get-started/windows-preparation.mdx:54fetches the bootstrap script fromraw.githubusercontent.com, which serves the index blob, so the documented Windows user path is byte-identical. It found the existing-clone gap and the two overclaiming test titles, both fixed here.Verification
Two real clones with
core.autocrlf=true, one at base8096cdd7band one at this commit.Tracked files that check out with CRLF:
Repository checks:
Pinned-digest suites in the same two trees,
--no-file-parallelism:Every one of the 27 failures is fixed, and none fails in both trees. They include
keeps security entrypoint hashes synchronized with the copied files,pins the reviewed image runtime artifacts exactly,keeps local prompt assets byte-aligned with their pinned revision blobs (#6990), andrejects a cache seed that does not match the lockfile integrity.New test, red and green on this checkout:
Affected suites on this checkout:
Test Files 5 passed (5) Tests 49 passed (49).npm run checks:repository,npm run typecheck:cli,npx @biomejs/biome check, andnpm run docsall pass.Limits, stated plainly:
The Windows behavior is proven by a
core.autocrlf=truecheckout on macOS, not on a Windows host.core.autocrlfis the setting that performs the conversion and it behaves the same on every platform.An existing Windows working tree that already holds CRLF is not rewritten by pulling this commit. The second test names those files and
CONTRIBUTING.mdgives the fix, but the commit cannot repair a working tree by itself..github/workflows/wsl-e2e.yaml:33and.github/workflows/platform-vitest-main.yaml:174already setcore.autocrlf false. Those lines are now redundant. They are left in place because they are harmless and removing them is a separate decision.PR description includes a
Signed-off-by:line and every commit appears asVerifiedin GitHubNormal
pre-commit,commit-msg, andpre-pushhooks passedTargeted behavior tests pass for the current change set — command/result above
Applicable broad gate passed —
npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result:Quality Gates section completed with required justifications or waivers
No secrets, API keys, or credentials committed
npm run docsbuilds without warningsDoc pages follow the style guide (doc changes only)
New doc pages include SPDX header and frontmatter (new pages only)
Signed-off-by: Harjoth Khara harjoth.khara@gmail.com
Summary by CodeRabbit
Documentation
Chores
Tests