Skip to content

#1790's *.mjs text eol=lf does not repair existing working trees — 3 suites stay dead after merge #1793

Closed

Description

@bradygaster

Found while building .squad/e2e/windows-test-baseline.md (EECOM, baseline commit 369bba8f).

Summary

#1790 adds *.mjs text eol=lf to .gitattributes, which fixes the #1788 dead-gate class on a fresh checkout. It does not fix a working tree that already exists — and every Windows developer running the E2E series has one.

Merging #1790 and pulling will leave check-changeset-drift.test.ts, promote-insider-tag.test.ts, and patch-esm-imports.test.ts still red, which will read as "the fix didn't work."

Mechanism

.gitattributes governs checkout, not files already on disk. Git only rewrites a working file when the merge changes its index content.

  • core.autocrlf = true on Windows.
  • These three .mjs are already stored LF in the index, so fix(ci): force LF on *.mjs so shebanged scripts stay loadable by vitest #1790 does not renormalize them (it renormalizes only the 9 .mjs that were CRLF in the index).
  • Index unchanged ⇒ working file untouched ⇒ stays CRLF on disk ⇒ Vite's shebang stripping still leaves a bare # ⇒ suite loads zero tests.

Controlled proof

Applied #1790's .gitattributes line locally without a re-checkout:

$ git ls-files --eol scripts/promote-insider-tag.mjs packages/squad-cli/scripts/patch-esm-imports.mjs
i/lf    w/crlf  attr/text eol=lf      packages/squad-cli/scripts/patch-esm-imports.mjs
i/lf    w/crlf  attr/text eol=lf      scripts/promote-insider-tag.mjs

$ npx vitest run test/promote-insider-tag.test.ts
 Test Files  1 failed (1)
      Tests  no tests

Attribute applied. Disk still CRLF. Still zero tests.

Then forced a re-checkout of the same files:

$ Remove-Item <the .mjs files> -Force ; git checkout -- <the .mjs files>
$ git ls-files --eol ...
i/lf    w/lf    attr/text eol=lf      packages/squad-cli/scripts/patch-esm-imports.mjs
i/lf    w/lf    attr/text eol=lf      scripts/promote-insider-tag.mjs

$ npx vitest run test/promote-insider-tag.test.ts test/cli/patch-esm-imports.test.ts
 Test Files  2 passed (2)
      Tests  21 passed (21)

Suggested fix

This is a rollout gap, not a code bug in #1790. Options, cheapest first:

  1. Document it in fix(ci): force LF on *.mjs so shebanged scripts stay loadable by vitest #1790's PR body and in the release/upgrade notes: after merging, run git rm --cached -r . ; git reset --hard (or targeted delete + git checkout --) and verify with git ls-files --eol '*.mjs' → expect w/lf.
  2. Have squad doctor check git ls-files --eol '*.mjs' for any w/crlf and emit a fix-it hint. This makes the condition self-diagnosing instead of presenting as mystery test failures.

Success criteria

  • A developer with a pre-fix(ci): force LF on *.mjs so shebanged scripts stay loadable by vitest #1790 Windows checkout can follow one documented command and get git ls-files --eol '*.mjs' reporting w/lf for every entry.
  • After that command, check-changeset-drift, promote-insider-tag, and patch-esm-imports all run their tests (8 + 15 + 6 = 29 tests, none reporting no tests).
  • Ideally: squad doctor flags any w/crlf .mjs so this never has to be remembered.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions