fix: exclude git-ignored files from staged snapshot divergence check - #1621
Open
skoshx wants to merge 2 commits into
Open
fix: exclude git-ignored files from staged snapshot divergence check#1621skoshx wants to merge 2 commits into
skoshx wants to merge 2 commits into
Conversation
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
commit: |
Contributor
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Contributor
Interactive terminal E2ETerminal Control verified the built CLI at
|
skoshx
marked this pull request as ready for review
August 9, 2026 15:53
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.
Root Cause
The
parseStagedSnapshotDivergencesfunction was treating ALL non-space worktree statuses as divergences, including"!"(git-ignored files). Since git-ignored files can never be staged, they should not block--stagedscans with divergence errors.Git status with
--ignored=matchingincludes ignored files with worktree status"!". The existing conditionif (worktreeStatus !== " ")caught these ignored files along with genuinely modified files, causing false positives on every commit in projects with git-ignored config files (e.g.,.opencode/package.json).Scope
The fix is narrowly scoped to exclude only worktree status
"!"from the divergence check:This preserves the correct behavior for:
Only git-ignored config files are now correctly excluded, since they structurally cannot cause the "staged snapshot doesn't match worktree" problem this gate exists to prevent.
Changes
parse-staged-snapshot-divergences.tsto exclude worktree status"!""!"status parser behavior.opencode/package.jsoncaseTesting
All existing tests pass, including:
Parity Analysis
This fix doesn't affect diagnostic rules or scan output - it only fixes a pre-scan gate check that was incorrectly blocking
--stagedmode. Parity is not applicable since:--stagedmode, which isn't used in corpus scansCloses #1620