Skip to content

[BUG]: fix lowercase permadiff team members#3539

Open
deiga wants to merge 5 commits into
mainfrom
fix-lowercase-permadiff-team-members
Open

[BUG]: fix lowercase permadiff team members#3539
deiga wants to merge 5 commits into
mainfrom
fix-lowercase-permadiff-team-members

Conversation

@deiga

@deiga deiga commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Resolves #3533


Before the change?

  • username lower casing is causing permadiff

After the change?

  • fixes permadiff by storing username as lowercase in state

Pull request checklist

  • Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@deiga deiga requested a review from Copilot July 14, 2026 14:26
@github-actions

Copy link
Copy Markdown

👋 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.

@github-actions github-actions Bot added the Type: Bug Something isn't working as documented label Jul 14, 2026
@deiga deiga requested a review from stevehipwell July 14, 2026 14:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

These provider review instructions are being used.

Findings

  1. 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 (Set hashing + StateFunc) to prevent case-only diffs; without a targeted test, this bug can regress silently (similar to how case handling already has coverage for github_team_membership).
    • Suggested fix: Add an acceptance test for github_team_members that applies with one username case, then flips case and asserts a no-op plan (and/or verifies stored state uses the canonical lowercase form).

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.username to lowercase via StateFunc.
  • Make members set identity case-insensitive by hashing the lowercase username in a custom Set function.

Comment thread github/resource_github_team_members.go

@stevehipwell stevehipwell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@stevehipwell

Copy link
Copy Markdown
Collaborator

@deiga FYI you should be able to add acceptance tests with alternative cases using the existing users.

deiga added 5 commits July 14, 2026 21:13
…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>
@deiga deiga force-pushed the fix-lowercase-permadiff-team-members branch from b17fe7e to a2d5533 Compare July 14, 2026 18:18
@deiga deiga requested a review from stevehipwell July 14, 2026 18:18
Required: true,
DiffSuppressFunc: caseInsensitive(),
Description: "User to add to the team.",
StateFunc: func(v any) string {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: v6.13.0 lower cases all team members

3 participants