RocketChat / RocketChat/Rocket.Chat
fix: refactor callback-based async flow to async/await in SAML ServiceProvider
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
Refactor callback-based asynchronous operations in the SAML service provider module to use modern async/await internally, without changing external behavior.
Target module:
apps/meteor/app/meteor-accounts-saml/server/lib/ServiceProvider.ts
Optional related utility:apps/meteor/app/meteor-accounts-saml/server/lib/Utils.ts
Current code uses callback-style async flows (e.g., zlib.deflateRaw and callback chaining).
Goal is to improve readability and error handling by converting internals to Promise-based patterns and async/await, while preserving public contracts and expected outputs.
Steps to reproduce:
- Open
apps/meteor/app/meteor-accounts-saml/server/lib/ServiceProvider.ts. - Locate callback-based async methods such as
logoutResponseToUrl(...). - Observe callback nesting and mixed async styles.
- Refactor internals to Promise-based flow and
async/await. - Run related unit tests to confirm no behavior change.
Expected behavior:
- Module keeps the same external behavior and response values.
- Async logic is easier to read/maintain.
- Error paths are handled consistently.
- Existing tests continue to pass, and tests are added/updated where needed.
Actual behavior:
- Callback-based async logic is currently used in key paths, making control flow and error handling harder to follow.
Server Setup Information:
- Version of Rocket.Chat Server: N/A (development branch)
- License Type: N/A
- Number of Users: N/A
- Operating System: N/A
- Deployment Method: N/A
- Number of Running Instances: N/A
- DB Replicaset Oplog: N/A
- NodeJS Version: N/A
- MongoDB Version: N/A
Client Setup Information
- Desktop App or Browser Version: N/A
- Operating System: N/A
Additional context
This is a minor refactor task (non-architectural) intended to modernize asynchronous code style and improve maintainability.
Relevant logs:
N/A (refactor/code-quality task, not a runtime production bug)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in apps/meteor/app/meteor-accounts-saml/server/lib/ServiceProvider.ts, especially logoutResponseToUrl(...), and inspect the callback-based zlib.deflateRaw flow. Review apps/meteor/app/meteor-accounts-saml/server/lib/Utils.ts only if the related utility is involved, then run the related unit tests. Done means the internal flow uses async/await while external behavior, response values, error handling, and existing tests remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication, backend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100