This repository was archived by the owner on Sep 1, 2026. It is now read-only.
Repository navigation
fix: dedupe user-group memberships from usersAndUserGroups - #43
Merged
Merged
Conversation
The layout API tolerates the same group listed more than once in a user's userGroups. process_user_group_members passed the duplicates into user_group_members, whose PRIMARY KEY (user_id, user_group_id) aborted the whole export. Dedupe the pairs, and keep the derived users.user_group_ids/user_group_count consistent with them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
The MIC DB Export workflow failed with:
(e.g. https://github.com/gooddata/Services-MIC-Cloud/actions/runs/28851951284,
aic_diagnose/ preprod)The
/api/v1/layout/usersAndUserGroupsAPI tolerates the same group appearing more than once in a user'suserGroupsarray.process_user_group_memberspassed those duplicates straight into theuser_group_memberstable, whosePRIMARY KEY (user_id, user_group_id)then aborted the entire export.Fix
process_user_group_members: collect(user_id, user_group_id)pairs into a set, so the junction table receives each membership once (output stays sorted).process_users: dedupe the deriveduser_group_ids/user_group_count(order-preserving) so they stay consistent with the junction table.tests/test_process_users_groups.py).🤖 Generated with Claude Code