Enforce LF for PowerShell files - #40
Merged
Merged
Conversation
The published bootstrap contract is a byte-for-byte SHA-256 comparison between scripts/bootstrap/run.ps1, the wdt-site copy, and production. Without a repository-owned EOL policy, Windows checkouts with core.autocrlf=true materialize CRLF working copies (5198 bytes, sha256 ff2f4bf8...) while the Git blob and production stay LF (5071 bytes, sha256 fd1f9bc5...), so strict local hash checks fail falsely. - Add .gitattributes with the single rule '*.ps1 text eol=lf'. - Renormalization of tracked .ps1 files is a no-op: all 49 blobs are already stored as LF, and the canonical bootstrap blob (da24993) is unchanged. - Extend tests/bootstrap-sync.tests.ps1 to pin the policy: the .gitattributes rule must exist, the bootstrap checkout must contain no CR bytes, and its SHA-256 must remain the reviewed value. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The supply-chain guarantee for the published bootstrap is a strict byte-for-byte SHA-256 comparison across four copies:
scripts/bootstrap/run.ps1(canonical),wdt-siterun.ps1, the Pages artifact, and productionhttps://wdt.digital/run.ps1.That guarantee currently depends on each contributor's local Git configuration instead of the repository. On Windows with
core.autocrlf=true(the Git for Windows default), the working copy of every.ps1file materializes as CRLF even though all 49 tracked PowerShell blobs are stored as LF. Reproduced measurements:fd1f9bc55fe8665c4a2d4706728eff16723a4c62fffd57baeb9c697b35a77bc6core.autocrlf=trueworking copy (before this PR)ff2f4bf8d5b9a09bf639295c16ff27a341d307c22b5e051ac9064b1940b20afcAny strict local hash verification against the working copy therefore fails falsely on Windows — the exact platform this toolkit targets.
What changed
.gitattributes(new, one rule):*.ps1 text eol=lf. Checkouts of PowerShell files are LF on every platform regardless ofcore.autocrlf.tests/bootstrap-sync.tests.ps1: regression assertions that the.gitattributesrule exists and is active, that the canonical bootstrap checkout contains no CR bytes, and that its SHA-256 remains the reviewed value (fd1f9bc5…; the pinned value must be updated only for a deliberate bootstrap change).What did not change
git add --renormalize -- ':(glob)**/*.ps1'staged zero content changes: all 49 tracked.ps1blobs were already LF.da249936c88eec0283628ebc4f07d2b94ee3748b, SHA-256fd1f9bc55fe8665c4a2d4706728eff16723a4c62fffd57baeb9c697b35a77bc6before and after.Verification
scripts/validate.ps1: pass on PowerShell 7.6.3 and Windows PowerShell 5.1.tests/bootstrap-sync.tests.ps1: pass on both engines; a deliberate CRLF-corruption of the working copy makes the new assertion fail with an actionable message, andgit checkoutrestores LF/fd1f9bc5….tests/release.tests.ps1: pass on both engines.git clone -c core.autocrlf=trueof this branch checks outrun.ps1as LF, 5071 bytes,fd1f9bc5….git diff --check: clean.🤖 Generated with Claude Code