Skip to content

fix: user module returns changed=False when group membership already matches#237

Draft
mimihalescu wants to merge 1 commit into
masterfrom
fix/user-groups-idempotency
Draft

fix: user module returns changed=False when group membership already matches#237
mimihalescu wants to merge 1 commit into
masterfrom
fix/user-groups-idempotency

Conversation

@mimihalescu

Copy link
Copy Markdown
Collaborator

What

The user module's update check now compares the user's actual group membership against the groups parameter instead of treating the mere presence of the parameter as a change.

Why

Previously, any task that set groups reported changed=True on every run, even when membership was identical. No redundant API calls were made (the sync logic already diffed old vs new IDs), but the reported state broke idempotency. The existing integration test "Testing user update no change" in tests/user-management/user-test.yml asserts changed == false for this exact scenario.

How

  • New _groups_differ helper resolves the requested group names/IDs and compares them as a set against um_users_groups_get results, reusing get_resource_id
  • _should_update_object checks the cheap property comparisons first and only performs the two group API calls when no other property changed

Notes

The group module has the same pattern for its users parameter and could get the same treatment in a follow-up.

Checklist

  • Module compiles, changelog updated
  • Integration test run: tests/user-management/user-test.yml (needs credentials)

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants