You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Safe Settings do not update org Branch Protection Rulesets after created #998
The issue is mergeDeep had a bug. Here are the details:
The Bug
When you manually removed required_reviewers from a ruleset via the GitHub UI, safe-settings failed to detect the change because the comparison logic in mergeDeep.js was silently ignoring array items without identifying properties (like name, username, etc.).
What was happening:
GitHub state: required_reviewers: [] (empty after manual removal)
In mergeDeep.js, the processArrays() method tracks array items using identifying properties. The required_reviewers objects don't have these properties, so they were never added to the visited object and therefore never compared.
The Fix
I modified mergeDeep.js in three places to use JSON.stringify as a fallback identifier when objects lack identifying properties:
In processArrays() (line 206): Changed from silently skipping items to using JSON representation as a unique key
In array comparison filters (lines 225-245): Updated both additions and deletions filters to use the fallback identifier
In compareDeepIfVisited() (line 259): Updated to use the same fallback identifier for consistency
Verification
✅ Created test case: "detects when required_reviewers array changes from populated to empty"
✅ Manual testing confirms the fix: comparison now returns hasChanges: true
✅ StandardJS linting passed
✅ Syntax validation passed
Files Modified
mergeDeep.js - Fixed comparison logic
rulesets.test.js - Added regression test
The fix is general-purpose and will now work for ANY array field where items lack identifying properties, making drift detection more robust across the board.
Activity
decyjphr commentedon Jun 17, 2026
The issue is mergeDeep had a bug. Here are the details:
The Bug
When you manually removed
required_reviewersfrom a ruleset via the GitHub UI, safe-settings failed to detect the change because the comparison logic in mergeDeep.js was silently ignoring array items without identifying properties (likename,username, etc.).What was happening:
required_reviewers: [](empty after manual removal)required_reviewers: [{minimum_approvals: 1, file_patterns: ["*.js"], reviewer: {...}}]hasChanges: false❌Root Cause
In mergeDeep.js, the
processArrays()method tracks array items using identifying properties. Therequired_reviewersobjects don't have these properties, so they were never added to thevisitedobject and therefore never compared.The Fix
I modified mergeDeep.js in three places to use JSON.stringify as a fallback identifier when objects lack identifying properties:
processArrays()(line 206): Changed from silently skipping items to using JSON representation as a unique keycompareDeepIfVisited()(line 259): Updated to use the same fallback identifier for consistencyVerification
✅ Created test case: "detects when required_reviewers array changes from populated to empty"
✅ Manual testing confirms the fix: comparison now returns
hasChanges: true✅ StandardJS linting passed
✅ Syntax validation passed
Files Modified
The fix is general-purpose and will now work for ANY array field where items lack identifying properties, making drift detection more robust across the board.
decyjphr commentedon Jun 17, 2026
@ddhananjay this has been fixed in yadhav/fix-recent-issues branch