RocketChat / RocketChat/Rocket.Chat

fix: refactor callback-based async flow to async/await in SAML ServiceProvider

Open
#38,741 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: feature
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:
  1. Open apps/meteor/app/meteor-accounts-saml/server/lib/ServiceProvider.ts.
  2. Locate callback-based async methods such as logoutResponseToUrl(...).
  3. Observe callback nesting and mixed async styles.
  4. Refactor internals to Promise-based flow and async/await.
  5. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.