Skip to content

fix(windows): pin generated artifacts and source to LF so a Windows checkout can pass its own gates - #19291

Closed
ShuheiKonno wants to merge 4 commits into
stablyai:mainfrom
ShuheiKonno:fix/windows-crlf-generated-artifacts
Closed

ShuheiKonno wants to merge 4 commits into
stablyai:mainfrom
ShuheiKonno:fix/windows-crlf-generated-artifacts

Conversation

@ShuheiKonno

@ShuheiKonno ShuheiKonno commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

A normal Windows checkout converts text to CRLF, while generated skill manifests and some source-reading tests expect LF. Pin those files to LF so an unchanged checkout can pass its gates.

What Changed

Pin generated skill JSON, Vitest snapshots, and TypeScript source to LF in .gitattributes. Preserve the newer rules from current main, including raw terminal transcript handling. Add a real Git checkout regression covering the pinned files and exclusions.

Why

This fixes the checkout policy for the whole affected file class instead of normalizing individual tests. Windows script files and unrelated .mjs files retain their existing handling.

Linked Issue

Fixes #14479

Visual Proof

N/A — Git checkout policy and regression tests; no application UI changes.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

Adversarial re-review rebased onto main a2f197fde7ef. A real core.autocrlf=true checkout reproduced the stale skill-manifest gate on main; the fixed branch passed the same check. The checkout regression covers 15 pinned/excluded paths, including raw CRLF terminal transcript bytes. Eight related suites: 83 passed, 32 conditional tests skipped. Changed-code quality, focused lint, formatting, and diff checks passed on macOS. On Windows awin with core.autocrlf=true, both checkout-policy suites passed (7 tests), and the actual manifest gate passed after refreshing the existing CRLF artifacts. Full application build and full test suite were not rerun for this attribute-only change.

AI Disclosure

Original implementation prepared with Claude; follow-up adversarial review, rebase, and regression coverage prepared with Codex.

Review

The rebase preserves all newer main attributes. Checked tracked TypeScript sources for literal CR bytes before applying the broad source policy; none found. No outstanding code finding from this review. Also repaired an inherited main-branch lint blocker by changing the protocol capability import shape: counted lines fall from 301 to 298, with all 115 runtime exports proven equal, including array order. Full anti-slop audit and node typecheck passed.

Agent skill upstream boundary

  • Not applicable: no upstream skill-installer content is copied or translated.

Notes

Existing Windows worktrees may retain old CRLF files until they are refreshed. Use a fresh checkout, or refresh only the affected clean files after preserving local work; changing attributes alone does not rewrite every existing file. No runtime, SSH, remote wire, mobile, or folder-workspace behavior changes.

Checklist

  • Small and focused
  • Explained before/after, mechanism, and rationale
  • Visual proof applicability documented
  • Self-reviewed correctness, security, and performance
  • Cross-platform and remote impact considered
  • Full lint, typecheck, test, and build confirmed for the refreshed head; focused checks above passed and CI covers configured gates

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Walkthrough

Adds .gitattributes rules that enforce LF line endings for generated skill bundle JSON files, Vitest snapshot files, and TypeScript source files. Adds a test that checks the expected line endings after staging and checkout with different Git core.autocrlf settings. Changes the agent-launch runtime capability references in protocol-version.ts to use a namespace import.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 6bf2f

The current transcript handling is preserved, but the added test does not detect a loss of raw bytes in the Git index. Adding the staged-blob assertion is a bounded follow-up; no production behavior defect is established.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed #14479 requires LF checkout behavior for generated skill JSON and TypeScript read by byte-sensitive checks. .gitattributes pins skill JSON, snapshots, and .ts/.tsx files to LF. The Git checkout …
Out of Scope Changes check ✅ Passed The changes support the reported pnpm lint checkout problem. The regression test covers the Git checkout policy. The protocol-version.ts namespace-import refactor addresses an existing lint blocke…
Docstring Coverage ✅ Passed 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 2…
Title check ✅ Passed The title clearly describes the main change: pinning generated artifacts and source files to LF for Windows checkouts. It is specific and relevant, though somewhat long.
Description check ✅ Passed The description covers the required sections, explains the problem and solution, links issue #14479, states that visual proof is not applicable, and reports testing and review details. It also clearly…

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • .gitattributes line-ending pins — four new rules pin LF for generated artifacts (/resources/skills/*.json, **/__snapshots__/*.snap) and the source tree (*.ts, *.tsx) so a core.autocrlf=true Windows checkout stops producing phantom lint/test failures and phantom modified files.

ℹ️ Blanket *.ts also reclassifies two NUL-containing files

*.ts text eol=lf reaches two files that embed raw \0 bytes — src/main/runtime/browser-client-download-transfers.ts:333 and src/relay/dispatcher.test.ts:804 — which Git had been auto-detecting as binary (i/-text in git ls-files --eol). I verified this is content-safe: neither file contains a CR byte, and the clean-filtered blob (git hash-object --path=…) is byte-identical to the index blob, so renormalization is a no-op and no phantom diff results. The only observable change is that future diffs of those two files render NUL bytes as ^@ text rather than "Binary files differ". No change needed — flagging it only because the PR body's "every file was already LF in the index" is not quite true for these two.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker force-pushed the fix/windows-crlf-generated-artifacts branch from 2f97277 to 0eb3e71 Compare October 6, 2026 07:48
ShuheiKonno and others added 4 commits October 6, 2026 00:54
`verify:skill-bundle-manifest` regenerates `resources/skills/*.json` and
compares the bytes. On a Windows checkout with `core.autocrlf=true` those
files arrive CRLF while the generator writes LF, so the gate reported the
committed artifacts as stale on a tree whose content diff is empty —
`pnpm lint` could not pass at all, and the suggested fix (regenerate and
commit) would have committed a pure line-ending churn.

`/resources/plugins/**` and `en-runtime-required.json` are already pinned
for exactly this reason; this is the same class of gap two directories over.

Also pins `__snapshots__/*.snap`: Vitest writes LF, so any local test run on
Windows left the worktree modified with a zero-content diff — phantom changes
that invite an accidental commit.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012Lc8yzNit7nZ6uPawXS63h
29 test files load repo source through `readFileSync` and assert on
`\n`-joined text. On a Windows checkout with `core.autocrlf=true` those
bytes arrive CRLF, so `SourceControl.host-context-boundary.test.ts` fails
on a stock clone — and, as stablyai#14479 notes, every other file in that set is
one multi-line assertion away from the same failure.

Pins `.ts`/`.tsx`. TypeScript and the bundlers are line-ending agnostic,
and the tree is authored LF everywhere else, so the only effect is that
Windows stops receiving a translation its own tests reject.

Two deliberate exclusions. `.mjs`: `config/scripts/**/*.mjs` is already
pinned for the Vite shebang bug, and `shebang-script-line-ending-pin`
asserts that pin stays narrow, so a blanket rule would defeat its own
guard. `.cmd`/`.ps1`/`.nsh`: they run through Windows interpreters and no
test reads them back.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012Lc8yzNit7nZ6uPawXS63h
@nwparker
nwparker force-pushed the fix/windows-crlf-generated-artifacts branch from 0eb3e71 to 6bf2f5e Compare October 6, 2026 07:57

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
config/scripts/generated-artifact-line-ending-pin.test.mjs (1)

39-46: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Assert the raw fixture bytes in the index before checkout.

The checkout assertion checks only the working tree. It can pass when Git stores LF in the index and converts it back to CRLF during checkout. Compare the staged blob as a Buffer:

Suggested fix
     git(['-c', 'core.autocrlf=input', 'add', '--', '.'])
+    expect(
+      git(['show', ':src/main/daemon/__fixtures__/pty-transcripts/example.txt']),
+    ).toEqual(Buffer.from(crlf))
     for (const path of paths.keys()) {

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b1e6a869-4015-4160-9bde-50c90b321dd6
📥 Commits

Reviewing files that changed from the base of the PR and between 0eb3e715739a45d56db1868c3e501070d822e4ea and 6bf2f5e.

📒 Files selected for processing (1)
  • src/shared/protocol-version.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@ShuheiKonno ShuheiKonno closed this Oct 6, 2026
@nwparker

nwparker commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@ShuheiKonno Sorry for delays, I'm tryign to merge some of the work

I saw you closed the PR, I will open a new one + hope you don't mind if I add you as co-author

Apologies again for this being so late. And thank you for your PRs 🙏

@ShuheiKonno

ShuheiKonno commented Oct 6, 2026 via email

Copy link
Copy Markdown
Contributor Author

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.

[Bug]: pnpm lint cannot pass on a stock Windows checkout (CRLF line endings)

2 participants