Skip to content

Remove legacy processUsername utility and userstore prefix processing from core SDK - #63

Open
janithjay wants to merge 1 commit into
thunder-id:mainfrom
janithjay:main
Open

Remove legacy processUsername utility and userstore prefix processing from core SDK#63
janithjay wants to merge 1 commit into
thunder-id:mainfrom
janithjay:main

Conversation

@janithjay

@janithjay janithjay commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Purpose

Remove legacy processUsername utility 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.


⚠️ Breaking Changes

🔧 Summary of Breaking Changes

  • Deleted processUsername utility and removed export { default as processUsername } from @thunderid/javascript.
  • getUsersMe and updateMeProfile no longer modify returned username / userName attributes.

💥 Impact

  • Applications importing processUsername directly from @thunderid/javascript will encounter an import error.
  • Profile API responses (getUsersMe, updateMeProfile) will return exact server-provided values without regex stripping.

🔄 Migration Guide

If your application relied on processUsername directly or expected client-side prefix stripping, clean usernames should be handled on the server side or formatted within application presentation logic.


Approach

  1. Deleted packages/javascript/src/utils/processUsername.ts and packages/javascript/src/utils/__tests__/processUsername.test.ts.
  2. Removed processUserUsername processing wrapper in getUsersMe (packages/javascript/src/api/getUsersMe.ts) and updateMeProfile (packages/javascript/src/api/updateMeProfile.ts).
  3. Removed processUsername re-export from packages/javascript/src/index.ts.

Related Issues

  • N/A

Related PRs

  • N/A

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards.
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

Summary by CodeRabbit

  • Bug Fixes

    • User profile data is now returned directly without altering username values.
    • Improved consistency when retrieving and updating the current user profile.
  • Refactor

    • Removed the username-processing utility and its public export.
    • Removed related username-processing tests.

Copilot AI lite review requested due to automatic review settings August 11, 2026 06:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The profile APIs now return users with their attributes without username post-processing. The processUsername utility, its tests, and its public export were removed.

Changes

Profile response handling

Layer / File(s) Summary
Direct profile user returns
packages/javascript/src/api/getUsersMe.ts, packages/javascript/src/api/updateMeProfile.ts
Both APIs return the merged user and attributes directly. Username prefix normalization was removed.
Username utility removal
packages/javascript/src/index.ts, packages/javascript/src/utils/processUsername.ts, packages/javascript/src/utils/__tests__/processUsername.test.ts
The processUsername export, implementation, and tests were deleted.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: senthalan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes removal of the legacy utility and userstore prefix processing.
Description check ✅ Passed The description follows the template and documents the purpose, breaking changes, impact, migration, approach, checklist, and security checks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/javascript/src/api/getUsersMe.ts

ESLint 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.ts

ESLint 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/javascript/src/api/getUsersMe.ts (1)

122-125: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add 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-prefixed username and userName values 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5a7cc88 and 9c2d300.

📒 Files selected for processing (5)
  • packages/javascript/src/api/getUsersMe.ts
  • packages/javascript/src/api/updateMeProfile.ts
  • packages/javascript/src/index.ts
  • packages/javascript/src/utils/__tests__/processUsername.test.ts
  • packages/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants