Skip to content

fix(passport-x): declare passport-oauth1 exports for TS7#41311

Open
ggazzo wants to merge 1 commit into
developfrom
chore/ts7-passport-x
Open

fix(passport-x): declare passport-oauth1 exports for TS7#41311
ggazzo wants to merge 1 commit into
developfrom
chore/ts7-passport-x

Conversation

@ggazzo

@ggazzo ggazzo commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the ambient passport-oauth1 declaration in passport-x so InternalOAuthError resolves under TypeScript 7.

Why

The declaration mixed export = OAuthStrategy with a separate export { InternalOAuthError, ... }. TS7 rejects that combination, so import OAuthStrategy, { InternalOAuthError } from 'passport-oauth1' failed with TS2305 (no exported member). The runtime module does export it (exports.InternalOAuthError = ...).

Move the named members into a namespace OAuthStrategy merged with the default class — the canonical way to type a CommonJS module that has both module.exports = X and exports.Y. Green on both TS5.x and TS7.

Draft — part of the TS7-readiness set.

Review in cubic

Task: ARCH-2244

Summary by CodeRabbit

  • Bug Fixes
    • Corrected OAuth strategy type definitions for improved compatibility with TypeScript projects.
    • Organized OAuth-related types under the strategy namespace and aligned internal property typing.

… for TS7

The ambient declaration mixed `export =` with `export { ... }`, which TS7
rejects (InternalOAuthError resolved as no exported member). Move the named
members into a namespace merged with the default export.
@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ea054f5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fd8964b7-238f-4460-b9bf-215c65339077

📥 Commits

Reviewing files that changed from the base of the PR and between 4186deb and ea054f5.

📒 Files selected for processing (1)
  • packages/passport-x/src/passport-oauth1.d.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: CodeRabbit / Review
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
  • GitHub Check: 📦 Build Packages
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • packages/passport-x/src/passport-oauth1.d.ts
🧠 Learnings (3)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • packages/passport-x/src/passport-oauth1.d.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • packages/passport-x/src/passport-oauth1.d.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • packages/passport-x/src/passport-oauth1.d.ts
🔇 Additional comments (2)
packages/passport-x/src/passport-oauth1.d.ts (2)

4-20: LGTM!


22-42: 🩺 Stability & Availability

No change needed for passport-oauth1 imports
The merged namespace works with the existing import OAuthStrategy, { InternalOAuthError, type OAuthClient } from 'passport-oauth1' shape in this package.


Walkthrough

The OAuth1 TypeScript declarations now namespace related types under OAuthStrategy, update _oauth accordingly, and retain only the export = OAuthStrategy module export.

Changes

OAuth1 declaration namespace

Layer / File(s) Summary
Namespace and internal type references
packages/passport-x/src/passport-oauth1.d.ts
OAuthGetCallback, OAuthError, OAuthClient, and InternalOAuthError are declared within OAuthStrategy; _oauth references OAuthStrategy.OAuthClient, and the previous named exports are removed.

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

Suggested labels: type: chore

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the TS7-related passport-oauth1 declaration/export fix in passport-x.
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.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • ARCH-2244: Request failed with status code 401

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.

@dionisio-bot

dionisio-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@ggazzo ggazzo added this to the 8.7.0 milestone Jul 10, 2026
@ggazzo

ggazzo commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

/jira ARCH-2200

@ggazzo ggazzo marked this pull request as ready for review July 10, 2026 17:31
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.91%. Comparing base (6f85f55) to head (ea054f5).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41311      +/-   ##
===========================================
- Coverage    68.98%   68.91%   -0.07%     
===========================================
  Files         3755     3755              
  Lines       147158   147593     +435     
  Branches     26309    26304       -5     
===========================================
+ Hits        101510   101718     +208     
- Misses       41147    41375     +228     
+ Partials      4501     4500       -1     
Flag Coverage Δ
unit 70.40% <ø> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 1 file

Re-trigger cubic

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.

1 participant