fix: normalize line endings in FileHash to prevent false state:modified results#12731
Open
claygeo wants to merge 2 commits into
Open
fix: normalize line endings in FileHash to prevent false state:modified results#12731claygeo wants to merge 2 commits into
claygeo wants to merge 2 commits into
Conversation
Contributor
|
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
Contributor
Additional Artifact Review RequiredChanges to artifact directory files requires at least 2 approvals from core team members. |
claygeo
added a commit
to claygeo/dbt-core
that referenced
this pull request
Mar 30, 2026
a899b17 to
da1b8f7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12731 +/- ##
==========================================
- Coverage 91.44% 91.43% -0.02%
==========================================
Files 203 203
Lines 25803 25804 +1
==========================================
- Hits 23596 23594 -2
- Misses 2207 2210 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
claygeo
added a commit
to claygeo/dbt-core
that referenced
this pull request
Mar 30, 2026
da1b8f7 to
c54c98d
Compare
claygeo
added a commit
to claygeo/dbt-core
that referenced
this pull request
Mar 30, 2026
c54c98d to
0c27292
Compare
claygeo
added a commit
to claygeo/dbt-core
that referenced
this pull request
Mar 30, 2026
0c27292 to
1a51321
Compare
…ed results When comparing manifests built on different platforms (e.g. local Windows vs dbt Cloud Linux), files with identical logical content produce different hashes because CRLF vs LF line endings change the hash input. This causes dbt ls --select state:modified to select ALL files even when nothing actually changed. Normalize line endings to LF before hashing in FileHash.from_contents. This ensures the same logical file content produces the same checksum regardless of the platform it was created on. Fixes dbt-labs#11473
1a51321 to
07d7459
Compare
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
Fixes #11473
When comparing manifests built on different platforms (e.g. local Windows CLI vs dbt Cloud on Linux),
dbt ls --select state:modifiedselects ALL files even when nothing changed. This happens because Windows uses CRLF line endings while Linux uses LF, producing different SHA-256 hashes for identical logical content.This affects every dbt Cloud user who develops locally on Windows and uses state comparisons. The current workaround is disabling git line ending conversion, which is a footgun.
Fix
Normalize line endings to LF (
\n) before hashing inFileHash.from_contents(). The normalization replaces both\r\n(Windows) and standalone\r(legacy Mac) with\nbefore encoding to UTF-8 and hashing.This ensures the same logical file content produces the same checksum regardless of the platform it was created on.
Note: This is a one-way change. Existing checksums in manifests built on Linux (LF only) will not change since
\nis already the normalized form. Checksums in manifests built on Windows will change on the next build, which is the correct behavior (they should have matched the Linux checksums all along).5 lines changed in 1 file.