Unicron downcase user emails#5097
Conversation
Add sanction screening service prod
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe PR normalizes email strings before storing or querying ChangesCLA email normalization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR standardizes how user email addresses are stored and queried (specifically the user_emails DynamoDB attribute) by normalizing to lower-case and trimming whitespace, improving case-insensitive lookups and reducing DynamoDB String Set duplicate-member failures.
Changes:
- Normalize
user_emailsvalues (lower-case + trim) when creating allowlist/approval request records (legacy + Go backend). - Normalize and de-duplicate user email sets via a new
normalizeEmailshelper when persisting users in the Go backend. - Normalize email input during
GetUsersByEmaillookups and update one related log message.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cla-backend-legacy/internal/api/handlers.go | Normalizes stored user_emails values for legacy v2 allowlist request creation paths. |
| cla-backend-go/users/repository.go | Adds email normalization/de-duplication on user writes; normalizes GetUsersByEmail lookups; updates log wording. |
| cla-backend-go/signatures/repository.go | Normalizes email before searching users by user_emails during approval list updates. |
| cla-backend-go/approval_list/repository.go | Normalizes stored user_emails for CCLA approval request records. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@utils/downcase_emails.sh`:
- Around line 12-15: The backfill in downcase_emails.sh only lowercases and
deduplicates user_emails, but it still leaves leading/trailing spaces intact.
Update the jq processing in the main loop that reads each item and builds newss
so the normalization also trims whitespace before deduping, keeping the existing
uid and email backfill flow intact. Use the existing cat/jq pipeline and the
newss assignment as the place to apply the trim+lowercase normalization.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a3d63868-f5a7-43ed-af21-64cf5e972b4b
📒 Files selected for processing (5)
cla-backend-go/approval_list/repository.gocla-backend-go/signatures/repository.gocla-backend-go/users/repository.gocla-backend-legacy/internal/api/handlers.goutils/downcase_emails.sh
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki lgryglicki@cncf.io
Assisted by OpenAI
Assisted by GitHub Copilot
Assisted by Claude