fix(Pull-SDLC): make drift gate EOL-insensitive to avoid false positives#179
Merged
Merged
Conversation
Test-LocalDriftOnManagedPaths compared raw blob SHAs, which are EOL sensitive. A Windows consumer whose git committed the synced files with CRLF had HEAD blobs that differ from the upstream LF blobs even though the content was identical, firing a spurious POLICY VIOLATION on a clean tree. Confirm any blob-SHA difference with an EOL-insensitive content diff (git diff --ignore-cr-at-eol) before reporting drift. Genuine divergence, including upstream-deleted files the consumer still has committed, is preserved. Closes #178 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
Test-LocalDriftOnManagedPaths(the Pull-SDLC drift gate) compared rawcommitted blob SHAs (
HEAD:<path>vs<anchor>:<path>). Blob SHAs areend-of-line sensitive, so a Windows consumer whose git committed the
synced files with CRLF ended up with HEAD blobs that differ from the
upstream LF blobs even though the content was byte-for-byte identical
after EOL normalization. The result was a spurious
POLICY VIOLATIONona completely clean working tree.
Diagnosis (issue #178)
Reproduced on the affected consumer (
CopyToGooglePhotos) against anchorf7d1f13:raw diff but an EMPTY
git diff --ignore-cr-at-eol-- i.e. EOL-onlydivergence (a false positive).
.github/agents/*.agent.mdfiles were genuine divergence(deleted upstream, still committed downstream) and remain correctly
flagged.
Fix
When the fast blob-SHA pre-filter detects a difference, confirm it with
an EOL-insensitive content diff (
git diff --quiet --ignore-cr-at-eol)before reporting drift. Only paths that still differ after ignoring
CR-at-EOL are reported. Genuine divergence -- including upstream-deleted
files the consumer still has committed -- is preserved.
Tests
Added a
Test-LocalDriftOnManagedPathsDescribe block (behavior-first):"Expected 0, but got 1").
Full suite: 187 passed, 0 failed.
Closes #178