Skip to content

fix(windows): enforce LF line endings for shell scripts and Dockerfile#47

Merged
szjanikowski merged 2 commits into
mainfrom
fix/gitattributes-lf
May 9, 2026
Merged

fix(windows): enforce LF line endings for shell scripts and Dockerfile#47
szjanikowski merged 2 commits into
mainfrom
fix/gitattributes-lf

Conversation

@szjanikowski
Copy link
Copy Markdown
Contributor

@szjanikowski szjanikowski commented May 9, 2026

Summary

  • Repo-wide .gitattributes locks *.sh, Dockerfile, and other Linux-bound files to LF; PowerShell/batch keep CRLF. Fixes the silent failure where Windows core.autocrlf=true checked out test.sh with CRLF and Linux benchmark sandboxes read #!/bin/bash\r as the shebang, producing bash: required file not found and RewardFileNotFoundError on every trial.
  • nasde init now scaffolds .gitattributes and writes files with Path.write_text(..., encoding="utf-8", newline="") so freshly-scaffolded test.sh is LF on Windows too (Python's default text mode translates \n\r\n on Windows).
  • Three benchmark-authoring skills (nasde-benchmark-creator, nasde-benchmark-from-history, nasde-benchmark-from-public-repos) got a "Critical: line endings on Windows" section so AI agents authoring benchmarks in user repos enforce the same policy.

Test plan

Linux/macOS — cross-platform regression check

  • git checkout fix/gitattributes-lf && git status --porcelain → empty (no working-tree renormalization for files already LF in repo)
  • uv run pytest -x → 147 passed (verifies _write_if_missing(newline="") doesn't break anything; on Linux/macOS \n was always written literally, so behavior is identical)
  • uv run nasde init /tmp/x -n x; file /tmp/x/tasks/example-task/tests/test.sh → "ASCII text" without "CRLF"

Windows — verified end-to-end during PR development

  • nasde install-skills --force → 4 skills installed
  • nasde run --variant claude-vanilla --tasks python-gilded-rose-polymorphism -C examples/refactoring-skill --harbor-env daytona --without-evaln_completed_trials: 1, n_errored_trials: 0; verifier ran the full pytest suite (23/23 passed); trial received a legitimate reward score (the agent's solution didn't satisfy all rubric criteria, but the system scored it correctly rather than crashing — that's the point: pipeline is healthy)
  • uv run nasde init produced .gitattributes (1038 B) and test.sh (69 B, no \r byte) on Windows

🤖 Generated with Claude Code

…ributes

Without this, a fresh checkout on Windows has CRLF on test.sh; the Linux
kernel inside the benchmark sandbox reads `#!/bin/bash\r` as the shebang
and every trial fails with `bash: required file not found`.

- Repo: .gitattributes locks LF for *.sh, Dockerfile, etc; CRLF for *.ps1.
- Scaffold: nasde init writes .gitattributes and uses
  `Path.write_text(..., newline="")` so freshly-scaffolded files are LF
  on Windows too (Python's default text mode translates \n -> \r\n).
- Skills: nasde-benchmark-creator, nasde-benchmark-from-history, and
  nasde-benchmark-from-public-repos got a "Critical: line endings on
  Windows" section warning AI agents authoring benchmarks.

docs/windows-issues-2026-05-09.md: companion report listing 3 remaining
Windows issues (Unicode crashes on cp1250 console, missing
harbor[daytona] extra) that need separate tickets.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@szjanikowski
Copy link
Copy Markdown
Contributor Author

macOS smoke test results (2026-05-09)

Ran the first two items of the Linux/macOS regression checklist on macOS (Darwin 25.4.0, Python 3.13.11):

  • git status --porcelain → empty (no renormalization). Branch checked out cleanly.
  • uv run pytest -x147 passed in 0.89s.

The third item (nasde init + file CRLF check) was not executed in this smoke run.

Verdict: macOS-safe — no regression from .gitattributes changes.

The report belongs in a separate deliverable; this PR is the code/scaffold
fix only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@szjanikowski szjanikowski merged commit 2419536 into main May 9, 2026
9 checks passed
@szjanikowski szjanikowski deleted the fix/gitattributes-lf branch May 9, 2026 11:36
szjanikowski pushed a commit that referenced this pull request May 9, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@szjanikowski szjanikowski mentioned this pull request May 9, 2026
9 tasks
szjanikowski added a commit that referenced this pull request May 9, 2026
* docs(changelog): record Windows compat + skill bundling under [Unreleased]

Captures everything that landed since v0.3.2 (PRs #42, #43, #44, #45) so
the release notes are queued up. Keeps the section under [Unreleased]
deliberately — more fixes are still expected before cutting v0.3.3, and
release docs say the version header should be added at release-cut time.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(changelog): record .gitattributes LF enforcement (#47)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(changelog): record harbor[cloud] dependency switch (#48)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: release v0.3.3

Cuts v0.3.3 from the accumulated [Unreleased] section. Patch bump
(pre-1.0 policy): no breaking changes to user-facing CLI, nasde.toml
schema, or benchmark project layout — Windows compat, OAuth-script
bundling, harbor[cloud] dep switch are all transparent to users.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Szymon Janikowski <szymon.janikowski@itlibrium.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant