-
Notifications
You must be signed in to change notification settings - Fork 50
Unicron downcase user emails #5097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
24acbd4
Merge pull request #5090 from linuxfoundation/dev
lukaszgryglicki 9c37709
Downcase user_emails
lukaszgryglicki c158e19
Merge branch 'dev' into unicron-downcase-user-emails
lukaszgryglicki 56157b8
Add data migration script
lukaszgryglicki eb0acdb
Address AI feedback
lukaszgryglicki 8bd2ab0
Address AI feedback
lukaszgryglicki ee81c18
Address AI feedback
lukaszgryglicki ba93106
Address AI feedback
lukaszgryglicki 6cd8419
Address AI feedback
lukaszgryglicki 4eb9e42
Guard sensitive data
lukaszgryglicki e1a883c
Fix E2E
lukaszgryglicki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -288,3 +288,4 @@ spans*.json | |
| *.out | ||
| CLAUDE.md | ||
| .claude/* | ||
| /*user_emails.json | ||
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| STAGE=${STAGE:-dev} | ||
| PROFILE="lfproduct-${STAGE}" | ||
| REGION=us-east-1 | ||
| TABLE="cla-${STAGE}-users" | ||
| APPLY="${APPLY:-0}" | ||
|
|
||
| aws dynamodb scan --profile "$PROFILE" --region "$REGION" --table-name "$TABLE" --projection-expression 'user_id, user_emails' --filter-expression 'attribute_exists(user_emails)' --output json > "${STAGE}_user_emails.json" | ||
| cat "${STAGE}_user_emails.json" | jq -c '.Items[] | select(.user_emails.SS != null) | ([.user_emails.SS[] | ascii_downcase | gsub("^\\s+|\\s+$";"") | select(length > 0)] | unique) as $n | select(($n | length > 0) and ($n != (.user_emails.SS | sort)))' \ | ||
| | while IFS= read -r item; do | ||
|
lukaszgryglicki marked this conversation as resolved.
|
||
| uid=$(jq -r '.user_id.S' <<<"$item") | ||
| newss=$(jq -c '[.user_emails.SS[] | ascii_downcase | gsub("^\\s+|\\s+$";"") | select(length > 0)] | unique' <<<"$item") # lower + trim + drop-empty + dedupe | ||
| if [ "$newss" = "[]" ] | ||
| then | ||
| echo "skip $uid (no valid emails after normalize)" >&2 | ||
| continue | ||
| fi | ||
| echo "user $uid -> $newss" | ||
| if [ "$APPLY" = "1" ] | ||
| then | ||
| aws dynamodb update-item --profile "$PROFILE" --region "$REGION" --table-name "$TABLE" \ | ||
| --key "{\"user_id\":{\"S\":\"$uid\"}}" \ | ||
| --update-expression 'SET user_emails = :e' \ | ||
| --expression-attribute-values "{\":e\":{\"SS\":$newss}}" && echo "ok" | ||
| fi | ||
| done | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.