Skip to content

Fix flaky username generation in GetUserNameFromEmailAsync#25558

Merged
salihozkara merged 2 commits into
rel-10.4from
maliming/fix-username-from-email-flaky
Jun 5, 2026
Merged

Fix flaky username generation in GetUserNameFromEmailAsync#25558
salihozkara merged 2 commits into
rel-10.4from
maliming/fix-username-from-email-flaky

Conversation

@maliming

@maliming maliming commented Jun 5, 2026

Copy link
Copy Markdown
Member

Fix flaky CI failure in IdentityUserManager.GetUserNameFromEmailAsync when AllowedUserNameCharacters contains a limited digit set: pick each random digit from the allowed set instead of generating an integer that may contain disallowed digits.

Copilot AI review requested due to automatic review settings June 5, 2026 02:53
@maliming maliming added this to the 10.4-patch milestone Jun 5, 2026

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

This PR fixes a flaky username generation path in IdentityUserManager.GetUserNameFromEmailAsync when AllowedUserNameCharacters contains only a subset of digits, by generating the 4-digit suffix using only digits from the allowed set (per-digit selection) rather than using an integer range that can introduce disallowed digits.

Changes:

  • Update GetUserNameFromEmailAsync to append 4 random digits by sampling from the distinct allowed digits set.
  • Tighten an existing test regex to require 4 allowed digits at the end (instead of 3).
  • Add targeted regression tests covering partial digit sets, exact digit sets, and allowing leading zeroes in the random suffix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs Switches random digit suffix generation to sample only from allowed digits, eliminating disallowed-digit flakiness.
modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs Strengthens and expands test coverage to ensure generated usernames respect restricted digit sets and can include leading zeroes.

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@maliming maliming requested a review from salihozkara June 5, 2026 03:06
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 15.55556% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.38%. Comparing base (9e63359) to head (a4b170e).

Files with missing lines Patch % Lines
...sts/Volo/Abp/Identity/IdentityUserManager_Tests.cs 0.00% 37 Missing ⚠️
...ty.Domain/Volo/Abp/Identity/IdentityUserManager.cs 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           rel-10.4   #25558      +/-   ##
============================================
- Coverage     49.41%   49.38%   -0.03%     
============================================
  Files          3674     3671       -3     
  Lines        124021   123880     -141     
  Branches       9477     9470       -7     
============================================
- Hits          61280    61179     -101     
+ Misses        60919    60867      -52     
- Partials       1822     1834      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@salihozkara salihozkara merged commit 3128d12 into rel-10.4 Jun 5, 2026
3 of 6 checks passed
@salihozkara salihozkara deleted the maliming/fix-username-from-email-flaky branch June 5, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants