Skip to content

Conversation

@nossila
Copy link
Member

@nossila nossila commented Jul 17, 2025

Make it send Current-Profile param on subscription/websocket connection

Summary by CodeRabbit

  • New Features

    • Added support for sending the "Current-Profile" parameter on subscription and websocket connections.
  • Chores

    • Updated package version to 1.3.2 in the changelog and package metadata.
    • Added a new dependency on the authentication module.

@changeset-bot
Copy link

changeset-bot bot commented Jul 17, 2025

⚠️ No Changeset found

Latest commit: e073737

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
Copy link

coderabbitai bot commented Jul 17, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

"""

Walkthrough

A new patch version (1.3.2) of the @baseapp-frontend/graphql package was released. The main change is the addition of sending a "Current-Profile" parameter containing the profile ID in the connection parameters for websocket/subscription connections. Related imports and logic were updated in the environment configuration.

Changes

File(s) Change Summary
packages/graphql/CHANGELOG.md, package.json Updated changelog and incremented package version to 1.3.2; added @baseapp-frontend/authentication as a dependency.
packages/graphql/config/environment.ts Updated websocket connection parameters to include "Current-Profile" header with profile ID.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant AuthModule
    participant WebSocketServer

    Client->>AuthModule: Retrieve auth token
    Client->>AuthModule: Retrieve current profile key
    AuthModule-->>Client: Return token and profile key
    Client->>AuthModule: Parse profile key to get profile ID
    AuthModule-->>Client: Return MinimalProfile (with id)
    Client->>WebSocketServer: Connect with Authorization and Current-Profile headers
    WebSocketServer-->>Client: Establish subscription connection
Loading

Poem

In the warren of webs and code so bright,
A profile now hops into websocket flight.
With tokens and headers, connections anew,
The changelog records what the rabbits do.
Version hops forward, 1.3.2—
A patchy delight from our burrow to you! 🐇✨
"""


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
packages/graphql/package.json (1)

26-29: Add missing authentication package to peerDependencies.

The code imports from @baseapp-frontend/authentication but this dependency is not declared in the package.json. This is likely causing the TypeScript compilation error.

Add the authentication package to peerDependencies:

 "peerDependencies": {
+  "@baseapp-frontend/authentication": "workspace:*",
   "@baseapp-frontend/utils": "workspace:*",
   "react": "catalog:react19"
 },
🧹 Nitpick comments (1)
packages/graphql/config/environment.ts (1)

104-110: Well-implemented profile parameter addition with good error handling.

The implementation correctly adds the Current-Profile parameter to websocket connections while maintaining backward compatibility. The code safely handles missing profile data and parsing errors.

Consider adding a type guard for extra safety:

 const CurrentProfile = parseString<MinimalProfile>(CurrentProfileStr)
+const profileId = CurrentProfile?.id && typeof CurrentProfile.id === 'string' ? CurrentProfile.id : undefined
 if (!Authorization) return {}
 return {
   Authorization,
-  'Current-Profile': CurrentProfile ? CurrentProfile.id : undefined,
+  'Current-Profile': profileId,
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ea9e55 and 86d6320.

📒 Files selected for processing (3)
  • packages/graphql/CHANGELOG.md (1 hunks)
  • packages/graphql/config/environment.ts (2 hunks)
  • packages/graphql/package.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/graphql/config/environment.ts (4)
packages/utils/functions/token/getToken/index.ts (1)
  • getToken (9-17)
packages/authentication/modules/profile/useCurrentProfile/constants.ts (1)
  • CURRENT_PROFILE_KEY_NAME (1-1)
packages/utils/functions/string/parseString/index.ts (1)
  • parseString (1-10)
packages/authentication/types/profile.ts (1)
  • MinimalProfile (1-6)
🪛 GitHub Actions: Main Workflow
packages/graphql/config/environment.ts

[error] 1-1: TypeScript error TS2307: Cannot find module '@baseapp-frontend/authentication' or its corresponding type declarations.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
packages/graphql/config/environment.ts (1)

102-111: Excellent implementation that follows established patterns.

The websocket connection parameter enhancement is well-designed:

  • Uses the same token retrieval pattern as Authorization
  • Safely handles missing or invalid profile data
  • Maintains backward compatibility
  • Follows the existing codebase patterns
packages/graphql/package.json (1)

4-4: Appropriate patch version bump for the new feature.

The version increment from 1.3.1 to 1.3.2 correctly follows semantic versioning for a backward-compatible feature addition.

packages/graphql/CHANGELOG.md (1)

3-7: Well-documented changelog entry.

The changelog entry accurately describes the feature addition and follows the established format.

Copy link
Contributor

@vitorguima vitorguima left a comment

Choose a reason for hiding this comment

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

Fix lint before merging @nossila

@sonarqubecloud
Copy link

@nossila nossila merged commit c29cb34 into master Jul 18, 2025
8 checks passed
@nossila nossila deleted the hotfix/BA-2593-unread-message-counter branch July 18, 2025 00:35
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.

5 participants