chore: Add suppress diff func for unordered list#3514
Open
stevehipwell wants to merge 2 commits into
Open
Conversation
|
👋 Hi, and thank you for this contribution! This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can. You can help us prioritize by joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions. 🤖 This is an automated message. |
deiga
previously approved these changes
Jul 2, 2026
Signed-off-by: Steve Hipwell <steve.hipwell@gmail.com>
da997a3 to
c1a769c
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
These provider review instructions are being used.
Findings
-
MEDIUM —
bypass_actorsdiff suppression may not work for ID-less actors (plan diffs can persist)- File reference:
github/util_rules.go:908 actor_idis optional in the schema (and may be omitted / non-intin the decoded map), butbypassActorCompareIdentitycurrently returns0wheneveractor_idisn’t anint, which prevents deterministic ordering for those entries and can defeat the unordered-diff suppression.- Suggested fix: use the existing
toInthelper and includebypass_modeas a tiebreaker (inline fix provided in comment).
- File reference:
-
MEDIUM — New unit test doesn’t assert the negative cases
- File reference:
github/util_rules_test.go:1450 Test_bypassActorCompareIdentityonly fails whenwantSame=true; allwantSame=falsecases currently can’t fail, reducing its value as a regression test.- Suggested fix: add an
elseassertion forwantSame=false(inline fix provided in comment).
- File reference:
Changes:
- Added a reusable
suppressUnorderedListDiffhelper for suppressing diffs on unorderedTypeListfields via a caller-provided comparator. - Replaced ruleset
bypass_actorsdiff suppression to use the new helper and a dedicated bypass-actor comparator. - Added a unit test for the bypass-actor comparator.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
github/util_diff.go |
Adds generic unordered-list diff suppression helper used by schema fields. |
github/util_rules.go |
Replaces bypass-actors diff suppression logic with a comparator-based identity sort. |
github/util_rules_test.go |
Adds unit coverage for the bypass-actor comparator. |
github/resource_github_repository_ruleset.go |
Switches bypass_actors to use suppressUnorderedListDiff. |
github/resource_github_organization_ruleset.go |
Switches bypass_actors to use suppressUnorderedListDiff. |
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.
Resolves #ISSUE_NUMBER
Before the change?
After the change?
suppressUnorderedListDifffunction that supports suppressing diffs for lists using identity based orderinggithub_organization_ruleset&github_repository_rulesetuse the new functionPull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!