Remove legacy processUsername utility and userstore prefix processing from core SDK - #63
Remove legacy processUsername utility and userstore prefix processing from core SDK#63janithjay wants to merge 1 commit into
processUsername utility and userstore prefix processing from core SDK#63Conversation
📝 WalkthroughWalkthroughThe profile APIs now return users with their attributes without username post-processing. The ChangesProfile response handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
packages/javascript/src/api/getUsersMe.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. packages/javascript/src/api/updateMeProfile.tsESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/javascript/src/api/getUsersMe.ts (1)
122-125: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd regression coverage for exact server-provided usernames.
The implementation removes client-side normalization in both profile response paths. Existing supplied coverage uses an unprefixed value and does not distinguish the old and new behavior.
packages/javascript/src/api/getUsersMe.ts#L122-L125: Assert that userstore-prefixedusernameanduserNamevalues remain unchanged.packages/javascript/src/api/updateMeProfile.ts#L126-L129: Add the same exact-preservation assertion.🤖 Prompt for 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. In `@packages/javascript/src/api/getUsersMe.ts` around lines 122 - 125, Add regression coverage for exact username preservation in the response paths at packages/javascript/src/api/getUsersMe.ts:122-125 and packages/javascript/src/api/updateMeProfile.ts:126-129. In both locations, assert that userstore-prefixed username and userName values are returned unchanged, using values that distinguish the current behavior from prior client-side normalization.
🤖 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.
Nitpick comments:
In `@packages/javascript/src/api/getUsersMe.ts`:
- Around line 122-125: Add regression coverage for exact username preservation
in the response paths at packages/javascript/src/api/getUsersMe.ts:122-125 and
packages/javascript/src/api/updateMeProfile.ts:126-129. In both locations,
assert that userstore-prefixed username and userName values are returned
unchanged, using values that distinguish the current behavior from prior
client-side normalization.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 62da43f4-4d14-475b-99a4-fe9c588147a9
📒 Files selected for processing (5)
packages/javascript/src/api/getUsersMe.tspackages/javascript/src/api/updateMeProfile.tspackages/javascript/src/index.tspackages/javascript/src/utils/__tests__/processUsername.test.tspackages/javascript/src/utils/processUsername.ts
💤 Files with no reviewable changes (3)
- packages/javascript/src/index.ts
- packages/javascript/src/utils/processUsername.ts
- packages/javascript/src/utils/tests/processUsername.test.ts
Purpose
Remove legacy
processUsernameutility and automatic userstore prefix stripping (DEFAULT/,ASGARDEO_USER/,PRIMARY/) from@thunderid/javascript. In ThunderID, user profiles return canonical user attributes that should not be regex-parsed or mutated at the client SDK layer.🔧 Summary of Breaking Changes
processUsernameutility and removedexport { default as processUsername }from@thunderid/javascript.getUsersMeandupdateMeProfileno longer modify returnedusername/userNameattributes.💥 Impact
processUsernamedirectly from@thunderid/javascriptwill encounter an import error.getUsersMe,updateMeProfile) will return exact server-provided values without regex stripping.🔄 Migration Guide
If your application relied on
processUsernamedirectly or expected client-side prefix stripping, clean usernames should be handled on the server side or formatted within application presentation logic.Approach
packages/javascript/src/utils/processUsername.tsandpackages/javascript/src/utils/__tests__/processUsername.test.ts.processUserUsernameprocessing wrapper ingetUsersMe(packages/javascript/src/api/getUsersMe.ts) andupdateMeProfile(packages/javascript/src/api/updateMeProfile.ts).processUsernamere-export frompackages/javascript/src/index.ts.Related Issues
Related PRs
Checklist
breaking changelabel added.Security checks
Summary by CodeRabbit
Bug Fixes
Refactor