build: normalize line endings to LF via .gitattributes (V2-679) - #12
Merged
Conversation
core.autocrlf produced a mixed working tree, so a working-tree build could diverge byte-for-byte from a git archive build and break AMO's source-code reproduction. '* text=auto eol=lf' makes checkout deterministic across platforms. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Problem
The repo had no
.gitattributesandcore.autocrlf=truelocally, so nothing normalized line endings — what a build produced depended on when each file was last checked out.build.mjscopies HTML/CSS verbatim (copyFileSync) into the shipped package, so a working-tree build could diverge byte-for-byte from agit archivebuild. That breaks AMO's source review, which requires a reviewer to reproduce the uploaded package byte-for-byte from the source zip (BUILD.md).Fix
Add
.gitattributes:* text=auto eol=lf— deterministic LF on checkout, on every platform.binaryrules for image/font/archive types (.pngis the only one tracked today; the rest are future-proofing).The
git add --renormalize .step was a no-op — the committed blobs were already LF, so there's no separate normalization commit. The divergence was purely a checkout artifact ofcore.autocrlf=true, whicheol=lfnow overrides.Verification
Built from the working tree and from a clean
git archiveexport (npm ci+npm run build:all), then compared SHA-256 of every output file:dist/(Chrome, 14 files): byte-identicaldist-firefox/(Firefox, 14 files): byte-identicalAlso confirmed
git archiveemits pure LF for every tracked text file underautocrlf=true, stable across repeated runs.Functionally inert for the extension — browsers don't care about CRLF in HTML/CSS; this is purely about build reproducibility.
Closes V2-679.
🤖 Generated with Claude Code