[BUG]: fix lowercase permadiff team members#3539
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. |
There was a problem hiding this comment.
Pull request overview
These provider review instructions are being used.
Findings
- MEDIUM — Missing regression test for the permadiff fix
- File reference:
github/resource_github_team_members.go:66-79 - Why this is a problem: The fix relies on new schema normalization behavior (
Sethashing +StateFunc) to prevent case-only diffs; without a targeted test, this bug can regress silently (similar to how case handling already has coverage forgithub_team_membership). - Suggested fix: Add an acceptance test for
github_team_membersthat applies with one username case, then flips case and asserts a no-op plan (and/or verifies stored state uses the canonical lowercase form).
- File reference:
This PR addresses the github_team_members perpetual diff caused by username case normalization, by canonicalizing usernames to lowercase for state and set element identity.
Changes:
- Canonicalize
members.usernameto lowercase viaStateFunc. - Make
membersset identity case-insensitive by hashing the lowercase username in a customSetfunction.
stevehipwell
left a comment
There was a problem hiding this comment.
I think changing Set would technically be a breaking change, but I think we ought to do it anyway as any breaking issues would be catching incorrect usage.
RE the username casing, I think that we should keep the diff suppression pattern as that way we don't lose any of the input data.
|
@deiga FYI you should be able to add acceptance tests with alternative cases using the existing users. |
…anges Signed-off-by: Timo Sand <timo.sand@f-secure.com>
…rcase Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
b17fe7e to
a2d5533
Compare
| Required: true, | ||
| DiffSuppressFunc: caseInsensitive(), | ||
| Description: "User to add to the team.", | ||
| StateFunc: func(v any) string { |
There was a problem hiding this comment.
I don't think we need this?
Resolves #3533
Before the change?
After the change?
Pull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!