Skip to content

Conversation

@rf2tsl
Copy link
Contributor

@rf2tsl rf2tsl commented Oct 28, 2025

Acceptance Criteria
As a user with multiple profiles, I want my interactions (such as comments) to reflect the currently active profile, so that others can correctly identify which profile performed the action.

Acceptance Criteria

When a user with multiple profiles performs an action (e.g., posts a comment), the system should associate the interaction with the currently active profile, not the main account.

The profile name and avatar displayed in the UI should correspond to the active profile that performed the action.

The system must validate that a secondary profile is active at the moment of the interaction to associate it properly.

If no profile is explicitly active, default to the main user profile.

Backend APIs should store and return the correct profile ID associated with each interaction.

The change should apply to all user-generated interactions across the platform where profile attribution is relevant.

Examples: comments, posts, messages, likes.

When switching profiles, the system must update the session or context accordingly, ensuring all subsequent interactions use the new profile that they switched to.

Approvd
https://app.approvd.io/projects/BA/stories/43026

Summary by CodeRabbit

  • New Features

    • Comments now display profile-based name, avatar and profile links.
  • Improvements

    • Chat rooms and messaging queries load for the selected profile.
    • Current-Profile header included in network requests.
    • Switching profiles triggers a full page reload.
    • Group chat members layout adjusted.
    • Added a MinimalProfile type for profile data.
  • Tests

    • Mocks and tests updated for profile-aware behavior; some profile-switch steps marked TODO.
  • Chores

    • Package versions and changelogs updated.

@changeset-bot
Copy link

changeset-bot bot commented Oct 28, 2025

⚠️ No Changeset found

Latest commit: 0fb1949

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 Oct 28, 2025

Walkthrough

Comment and messaging code now use profile fields; fetch adds a server/client-aware Current-Profile header using a MinimalProfile; CURRENT_PROFILE_KEY_NAME constant moved to utils and imports updated; profile switch forces a full reload; tests, mocks, changelogs and package versions updated. (49 words)

Changes

Cohort / File(s) Summary
Comment rendering with profile data
packages/components/modules/comments/common/graphql/queries/CommentItem.ts, packages/components/modules/comments/web/CommentItem/index.tsx
Add profile { id, pk, name, image(width:50,height:50){ url }, urlPath{ path } } to comment fragment; component now reads comment.profile for URL, display name, avatar src/alt and renames render function accordingly.
Chat rooms query parameterization
packages/components/modules/messages/common/graphql/queries/ChatRoomsQuery.ts, packages/components/modules/messages/web/AllChatRoomsList/index.tsx
ChatRoomsQuery gains $profileId: ID! and queries profile(id: $profileId) instead of me { profile { ... } }; caller now passes targetRef?.profile as data key.
Current profile header & types
packages/utils/functions/fetch/baseAppFetch/index.ts, packages/utils/constants/profile.ts, packages/utils/types/profile.ts
Add CURRENT_PROFILE_KEY_NAME and MinimalProfile type; baseAppFetch retrieves current profile (SSR/client), parses it and injects Current-Profile header with profile id when present.
Centralized current-profile import updates
packages/authentication/modules/profile/*, packages/authentication/modules/tests/*, packages/authentication/modules/access/useLogout/index.ts, packages/graphql/config/environment.ts, packages/authentication/modules/tests/utils/providers/withAuthenticationTestProviders/index.tsx
Replace local CURRENT_PROFILE_KEY_NAME imports with @baseapp-frontend/utils/constants/profile; update test imports. Runtime behavior unchanged.
Profile switching behavior
packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx, packages/components/modules/navigations/web/Header/AccountMenu/AccountPopover/__tests__/AccountPopover.cy.tsx
After switching profiles and showing toast, call window.location.reload() before closing submenu; Cypress tests were commented/TODOed where reload interferes.
UI layout tweak
packages/components/modules/messages/web/GroupChatEdit/index.tsx
Wrap GroupChatMembersList in a Box applying grid layout; DOM/layout change only.
Tests & mocks updated for profile data
packages/components/modules/comments/web/Comments/__tests__/__mocks__/requests.ts, packages/components/modules/comments/web/Comments/__tests__/__mocks__/resolvers.ts, packages/components/modules/comments/web/Comments/__tests__/__mocks__/constants.ts, packages/utils/functions/fetch/baseAppFetch/__tests__/baseAppFetch.test.ts, packages/authentication/modules/profile/useCurrentProfile/__tests__/useCurrentProfile.test.tsx
Add MOCK_PROFILE; inject profile: MOCK_PROFILE into comment/reply mocks and resolvers; adjust getTokenSSR mock sequence and CURRENT_PROFILE_KEY_NAME test import paths.
Changelogs & package versions
packages/*/CHANGELOG.md, packages/*/package.json
Add/update changelog entries and bump package versions for authentication, components, design-system, graphql, provider, utils, wagtail.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as UI Components
  participant Fetch as baseAppFetch
  participant Storage as TokenStore (SSR / client)
  participant API as GraphQL/API

  UI->>Fetch: request(url, options)
  Fetch->>Storage: getTokenSSR/getToken(CURRENT_PROFILE_KEY_NAME)
  alt profile found
    Storage-->>Fetch: "stringified MinimalProfile"
    Fetch->>Fetch: parseString<MinimalProfile>()
    Fetch->>API: request with header "Current-Profile": profile.id
  else no profile
    Storage-->>Fetch: null
    Fetch->>API: request without Current-Profile header
  end
  API-->>Fetch: response
  Fetch-->>UI: response
Loading
sequenceDiagram
  autonumber
  participant ProfilesUI as ProfilesList
  participant Browser as Browser

  ProfilesUI->>ProfilesUI: switch profile + show toast
  ProfilesUI->>Browser: window.location.reload()
  Note right of Browser: full reload to rehydrate app under new profile
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay extra attention to:
    • Call sites still expecting comment.user vs new comment.profile.
    • baseAppFetch SSR vs client token retrieval and parseString<MinimalProfile> usage.
    • Tests/mocks consistency for the profile shape.
    • All updated import paths for CURRENT_PROFILE_KEY_NAME.

Possibly related PRs

Suggested labels

needs review

Suggested reviewers

  • priscilladeroode
  • deboracosilveira
  • anicioalexandre
  • nossila
  • luciobj

Poem

🐰
I hopped through fragments, headers, and name,
Switched user to profile, and leapt through the frame,
A tiny header carries the profile id,
A reload wakes the app so state can be rid,
Small paws, big hops — the change is now named.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description provides comprehensive acceptance criteria detailing the requirements for profile interaction attribution, but does not follow the repository's changelog-based template structure. Update description to follow the template format with package names and versions, or clarify if acceptance criteria are sufficient for this repository's standards.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main change: updating profile interaction accuracy to ensure interactions are attributed to the currently active profile.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/BA-2717-ba-multiple-user-interaction-profile-accuracy

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ed8d02 and 0fb1949.

📒 Files selected for processing (1)
  • packages/components/modules/comments/web/Comments/__tests__/__mocks__/requests.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/components/modules/comments/web/Comments/tests/mocks/requests.ts
⏰ 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). (3)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Component Test Packages
  • GitHub Check: Build and Lint Packages

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 and usage tips.

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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/components/modules/comments/web/CommentItem/index.tsx (1)

90-100: Reply name will be undefined if profile data is missing.

Line 96 sets the reply name from comment.profile?.name, but the function only checks hasUser (line 91). If a comment was created before the profile migration or if profile data is unavailable, users will see "Replying to undefined" in the UI.

Consider adding fallback logic:

  const replyToComment = () => {
    if (hasUser) {
      onReplyClick?.()
      setCommentReply({
        commentItemRef,
        inReplyToId: comment.id,
-       name: comment.profile?.name,
+       name: comment.profile?.name ?? comment.user?.fullName ?? 'User',
      })
    }
    showReplies()
  }
packages/components/modules/messages/web/AllChatRoomsList/index.tsx (1)

111-111: Add null safety check for data.id access.

Accessing data.id without a null check will throw a runtime error if data is undefined or null. Given the transition to profile-based data fetching and the potential for loading/error states, this is a critical issue.

Apply this diff to add a safe fallback:

-  useRoomListSubscription({ profileId: data.id, connections: [] })
+  useRoomListSubscription({ profileId: data?.id, connections: [] })

Alternatively, consider whether the subscription should be conditional on data availability:

useRoomListSubscription({ 
  profileId: data?.id ?? '', 
  connections: [] 
})

Or skip the subscription entirely when data is unavailable:

if (data?.id) {
  useRoomListSubscription({ profileId: data.id, connections: [] })
}
🧹 Nitpick comments (2)
packages/utils/functions/fetch/baseAppFetch/index.ts (1)

94-101: Consider refactoring the window check for better readability.

The pattern typeof window === typeof undefined works but is less conventional than typeof window === 'undefined'. While this matches the existing pattern in lines 125 and 161, consider refactoring all occurrences for improved clarity.

Apply this diff to improve readability:

-  if (typeof window === typeof undefined) {
+  if (typeof window === 'undefined') {
     const { getTokenSSR } = await import('../../token/getTokenSSR')
     currentProfile = await getTokenSSR('CurrentProfile')
   } else {
packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx (1)

42-49: Image path workaround should be addressed.

The TODO comment indicates this image path handling is temporary and should be moved to the backend. This client-side URL construction is fragile and duplicates logic that belongs in the API layer.

Consider creating a backend ticket to return absolute image URLs from the API. This would eliminate the need for environment variable access and URL manipulation on the client.

If you'd like, I can help create an issue to track moving this logic to the backend.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 171f751 and 928297f.

📒 Files selected for processing (6)
  • packages/components/modules/comments/common/graphql/queries/CommentItem.ts (1 hunks)
  • packages/components/modules/comments/web/CommentItem/index.tsx (3 hunks)
  • packages/components/modules/messages/common/graphql/queries/ChatRoomsQuery.ts (1 hunks)
  • packages/components/modules/messages/web/AllChatRoomsList/index.tsx (1 hunks)
  • packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx (1 hunks)
  • packages/utils/functions/fetch/baseAppFetch/index.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/utils/functions/fetch/baseAppFetch/index.ts (3)
packages/utils/functions/token/getTokenSSR/index.ts (1)
  • getTokenSSR (3-8)
packages/utils/functions/token/getToken/index.ts (1)
  • getToken (9-17)
packages/utils/functions/fetch/baseAppFetch/types.ts (1)
  • RequestOptions (39-42)
⏰ 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). (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Component Test Packages
🔇 Additional comments (4)
packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx (1)

40-61: Authentication headers are properly updated via the Current-Profile cookie header.

The profile switching mechanism correctly aligns with PR objectives. When setCurrentProfile() is called, it updates the Zustand store and persists the profile to cookies. The baseAppFetch utility then includes the Current-Profile header on every subsequent request by reading from cookies. This ensures subsequent interactions use the newly active profile as required.

However, the window.location.reload() on line 58 suggests the full page reload is being used as a workaround to reinitialize app state. Since profile changes are already handled reactively through the Zustand store and properly propagated via headers for backend requests, consider whether the reload is truly necessary or if it can be removed to provide a smoother user experience.

packages/components/modules/comments/common/graphql/queries/CommentItem.ts (1)

12-22: Profile fields added correctly to support profile-based attribution.

The profile field block includes all necessary data for UI rendering and is actively consumed for display (name, image URL, profile URL path). The user field serves as a deleted-user indicator only—it checks account existence via Boolean(comment?.user) to conditionally render "Deleted User" and control reply permissions, but no user data fields (fullName, avatar) are consumed. This design correctly separates primary data (profile) from deletion status (user existence).

packages/components/modules/messages/web/AllChatRoomsList/index.tsx (1)

30-46: All callers of AllChatRoomsList have been properly updated to match the new targetRef shape.

Only one consumer of AllChatRoomsList exists in the codebase: ChatRoomsComponent (line 105 of packages/components/modules/messages/web/ChatRoomsComponent/index.tsx). It correctly passes targetRef={chatRoomsQueryData} where both the prop and the passed value are typed as ChatRoomsQuery$data. The types are consistently aligned with the component's internal usage of targetRef?.profile (line 45).

packages/components/modules/messages/common/graphql/queries/ChatRoomsQuery.ts (1)

3-11: Based on my verification through web search and codebase analysis, I cannot conclusively determine where the ChatRoomsQuery is executed and how the profileId parameter is validated. Here's what I found:

Verified:

  • The query requires authentication early, tenant isolation in the data layer, and verification that the requesting user has access to the requested profile
  • Suspense boundaries are in place in the messages module for error handling
  • The query definition correctly enforces $profileId: ID! as a required parameter
  • Component types are properly defined to handle the query data

Unable to verify:

  • Where ChatRoomsQuery is actually executed (useQueryLoader/useLazyLoadQuery call site)
  • How profileId is obtained and validated before query execution
  • Whether backend authorization checks are implemented for the profile lookup

The query receives chatRoomsQueryData as a prop in ChatRoomsComponent but the actual query loading happens at a parent layer not visible in the component files. The ChatRoomProvider context might be involved but needs manual verification.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 928297f and da5b30c.

📒 Files selected for processing (10)
  • packages/authentication/modules/access/useLogout/index.ts (1 hunks)
  • packages/authentication/modules/profile/useCurrentProfile/__tests__/useCurrentProfile.test.tsx (1 hunks)
  • packages/authentication/modules/profile/useCurrentProfile/constants.ts (0 hunks)
  • packages/authentication/modules/profile/useCurrentProfile/store.ts (1 hunks)
  • packages/authentication/modules/profile/utils.ts (1 hunks)
  • packages/authentication/modules/tests/utils/providers/withAuthenticationTestProviders/index.tsx (1 hunks)
  • packages/graphql/config/environment.ts (1 hunks)
  • packages/utils/constants/profile.ts (1 hunks)
  • packages/utils/functions/fetch/baseAppFetch/index.ts (2 hunks)
  • packages/utils/types/profile.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/authentication/modules/profile/useCurrentProfile/constants.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/utils/functions/fetch/baseAppFetch/index.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: nossila
Repo: silverlogic/baseapp-frontend PR: 300
File: packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx:57-59
Timestamp: 2025-10-29T13:48:38.345Z
Learning: In packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx, the full page reload via window.location.reload() when switching profiles is intentional and required due to websockets connections and data loading patterns that don't yet support reactive profile switching. This is a known technical debt that will be addressed with a larger refactoring in the future.
📚 Learning: 2025-10-29T13:48:38.345Z
Learnt from: nossila
Repo: silverlogic/baseapp-frontend PR: 300
File: packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx:57-59
Timestamp: 2025-10-29T13:48:38.345Z
Learning: In packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx, the full page reload via window.location.reload() when switching profiles is intentional and required due to websockets connections and data loading patterns that don't yet support reactive profile switching. This is a known technical debt that will be addressed with a larger refactoring in the future.

Applied to files:

  • packages/authentication/modules/profile/useCurrentProfile/store.ts
⏰ 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). (2)
  • GitHub Check: Component Test Packages
  • GitHub Check: Build and Lint Packages
🔇 Additional comments (9)
packages/utils/constants/profile.ts (1)

1-1: LGTM! Centralized constant improves maintainability.

Centralizing CURRENT_PROFILE_KEY_NAME into a shared constants module is a best practice that reduces duplication and ensures consistency across the codebase.

packages/authentication/modules/tests/utils/providers/withAuthenticationTestProviders/index.tsx (1)

3-3: LGTM! Import path updated for centralized constant.

The import path change aligns with the centralization of CURRENT_PROFILE_KEY_NAME. Functionality remains unchanged.

packages/authentication/modules/profile/useCurrentProfile/__tests__/useCurrentProfile.test.tsx (1)

5-5: LGTM! Import path correctly updated.

The import path change for CURRENT_PROFILE_KEY_NAME is consistent with the centralization effort. The test logic remains unchanged and should continue to function properly.

packages/graphql/config/environment.ts (2)

103-115: LGTM! Websocket connection properly includes current profile.

The logic correctly:

  • Retrieves the current profile token
  • Safely parses it with error handling
  • Only includes the Current-Profile header when both authentication and a valid profile exist
  • Properly extracts just the profile ID for the header

This ensures websocket connections are properly associated with the active profile.


1-1: Current import is correct—no changes needed.

The MinimalProfile import from @baseapp-frontend/authentication in packages/graphql/config/environment.ts is the proper pattern. While @baseapp-frontend/utils maintains its own internal copy of MinimalProfile, it does not export it publicly. Only @baseapp-frontend/authentication re-exports it in its index.ts (export type * from './types/profile'), making it the canonical public import. Internal code within the utils package uses relative imports to their own copy, while external packages correctly source from the authentication package's public API.

Likely an incorrect or invalid review comment.

packages/authentication/modules/profile/useCurrentProfile/store.ts (1)

1-2: LGTM! Import path updated for centralized constant.

The import path change for CURRENT_PROFILE_KEY_NAME aligns with the centralization effort. All usages throughout the file remain functionally unchanged.

packages/authentication/modules/access/useLogout/index.ts (2)

8-8: LGTM! Import path updated for centralized constant.

The import path change aligns with the centralization of profile-related constants.


24-34: Excellent addition! Current profile cleared on logout.

Adding removeTokenAsync(CURRENT_PROFILE_KEY_NAME) to the logout flow ensures that the active profile selection is properly cleared when a user logs out. This prevents stale profile data from persisting and aligns with the PR's objective of accurate profile attribution.

packages/authentication/modules/profile/utils.ts (1)

2-2: LGTM! Import path updated for centralized constant.

The import path change for CURRENT_PROFILE_KEY_NAME is consistent with the centralization effort. The function behavior remains unchanged.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da5b30c and fc7bd2a.

📒 Files selected for processing (2)
  • packages/components/modules/messages/web/GroupChatEdit/index.tsx (1 hunks)
  • packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: nossila
Repo: silverlogic/baseapp-frontend PR: 300
File: packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx:57-59
Timestamp: 2025-10-29T13:48:38.345Z
Learning: In packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx, the full page reload via window.location.reload() when switching profiles is intentional and required due to websockets connections and data loading patterns that don't yet support reactive profile switching. This is a known technical debt that will be addressed with a larger refactoring in the future.
🧬 Code graph analysis (1)
packages/components/modules/messages/web/GroupChatEdit/index.tsx (1)
packages/components/modules/messages/web/__shared__/GroupChatMembersList/types.ts (1)
  • GroupChatMembersListProps (14-37)
⏰ 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). (2)
  • GitHub Check: Component Test Packages
  • GitHub Check: Build and Lint Packages
🔇 Additional comments (1)
packages/components/modules/messages/web/GroupChatEdit/index.tsx (1)

173-190: Layout change unrelated to PR objectives.

The PR objectives focus on ensuring interactions use the currently active profile. This layout wrapper change doesn't affect profile handling or interaction accuracy. Consider whether this UI change belongs in a separate PR focused on layout improvements.

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: 0

🧹 Nitpick comments (1)
packages/utils/functions/fetch/baseAppFetch/index.ts (1)

105-105: Consider optional chaining for safer property access.

If parseString receives malformed JSON (e.g., a plain string), it returns that string cast as MinimalProfile. Accessing .id on a string returns undefined, which would set the header to undefined rather than an empty string. While this likely works in practice, optional chaining provides clearer intent and guarantees the fallback.

Apply this diff for improved type safety:

-  const parsedCurrentProfile = parseString<MinimalProfile>(currentProfile ?? undefined)
+  const parsedCurrentProfile = parseString<MinimalProfile>(currentProfile ?? undefined)

   const fetchOptions: RequestOptions = {
     ...options,
     headers: {
       Accept: 'application/json, text/plain, */*',
-      'Current-Profile': parsedCurrentProfile ? parsedCurrentProfile.id : '',
+      'Current-Profile': parsedCurrentProfile?.id || '',
       ...options.headers,
     },
   }

Also applies to: 111-111

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc7bd2a and 453b0f0.

📒 Files selected for processing (2)
  • packages/utils/functions/fetch/baseAppFetch/__tests__/baseAppFetch.test.ts (1 hunks)
  • packages/utils/functions/fetch/baseAppFetch/index.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: nossila
Repo: silverlogic/baseapp-frontend PR: 300
File: packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx:57-59
Timestamp: 2025-10-29T13:48:38.345Z
Learning: In packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx, the full page reload via window.location.reload() when switching profiles is intentional and required due to websockets connections and data loading patterns that don't yet support reactive profile switching. This is a known technical debt that will be addressed with a larger refactoring in the future.
🧬 Code graph analysis (1)
packages/utils/functions/fetch/baseAppFetch/index.ts (6)
packages/utils/functions/token/getTokenSSR/index.ts (1)
  • getTokenSSR (3-8)
packages/utils/constants/profile.ts (1)
  • CURRENT_PROFILE_KEY_NAME (1-1)
packages/utils/functions/token/getToken/index.ts (1)
  • getToken (9-17)
packages/utils/functions/string/parseString/index.ts (1)
  • parseString (1-10)
packages/utils/types/profile.ts (1)
  • MinimalProfile (1-6)
packages/utils/functions/fetch/baseAppFetch/types.ts (1)
  • RequestOptions (39-42)
⏰ 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). (3)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Component Test Packages
  • GitHub Check: Build and Lint Packages
🔇 Additional comments (3)
packages/utils/functions/fetch/baseAppFetch/index.ts (2)

7-8: LGTM: Clean imports following established patterns.

The imports for profile constant, type, and parsing utility are well-organized and follow the centralized import pattern requested by the team.

Also applies to: 11-11


96-103: LGTM: Environment-aware token retrieval is correctly implemented.

The SSR vs client detection and dynamic imports for token retrieval properly handle both server-side and client-side execution contexts.

packages/utils/functions/fetch/baseAppFetch/__tests__/baseAppFetch.test.ts (1)

428-428: Test correctly accounts for new profile token retrieval.

The added mock value ensures the test passes with the new getTokenSSR(CURRENT_PROFILE_KEY_NAME) call in the implementation. Note that the string value 'Current-Profile' (not valid JSON) effectively tests the error-handling path where malformed profile data is gracefully handled.

… feature/BA-2717-ba-multiple-user-interaction-profile-accuracy
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: 0

🧹 Nitpick comments (1)
packages/utils/CHANGELOG.md (1)

7-7: Capitalize the changelog entry and consider adding more descriptive detail.

Changelog conventions typically capitalize verbs in bullet points. Additionally, based on the PR scope, this entry could benefit from more detail about what was updated and why, particularly since the change involves SSR/client-aware profile header injection and introduces new infrastructure (constants, types).

Consider updating the entry:

- update to baseAppFetch and tests to include 'Current-Profile' in request headers
+ Updated `baseAppFetch` to inject `Current-Profile` header from stored MinimalProfile (SSR and client-aware); centralized `CURRENT_PROFILE_KEY_NAME` constant; updated related tests

This provides more context about the infrastructure changes and why they matter to consumers of this package.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f70d6a6 and 1db1085.

📒 Files selected for processing (14)
  • packages/authentication/CHANGELOG.md (1 hunks)
  • packages/authentication/package.json (1 hunks)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/package.json (1 hunks)
  • packages/design-system/CHANGELOG.md (1 hunks)
  • packages/design-system/package.json (1 hunks)
  • packages/graphql/CHANGELOG.md (1 hunks)
  • packages/graphql/package.json (1 hunks)
  • packages/provider/CHANGELOG.md (1 hunks)
  • packages/provider/package.json (1 hunks)
  • packages/utils/CHANGELOG.md (1 hunks)
  • packages/utils/package.json (1 hunks)
  • packages/wagtail/CHANGELOG.md (1 hunks)
  • packages/wagtail/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (6)
  • packages/provider/package.json
  • packages/utils/package.json
  • packages/components/CHANGELOG.md
  • packages/components/package.json
  • packages/graphql/package.json
  • packages/design-system/package.json
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: nossila
Repo: silverlogic/baseapp-frontend PR: 300
File: packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx:57-59
Timestamp: 2025-10-29T13:48:38.345Z
Learning: In packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx, the full page reload via window.location.reload() when switching profiles is intentional and required due to websockets connections and data loading patterns that don't yet support reactive profile switching. This is a known technical debt that will be addressed with a larger refactoring in the future.
⏰ 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). (2)
  • GitHub Check: Component Test Packages
  • GitHub Check: Build and Lint Packages
🔇 Additional comments (7)
packages/provider/CHANGELOG.md (1)

3-8: Changelog entry looks good.

The new version 2.0.18 entry is properly formatted, follows the established changelog pattern, and correctly documents the dependency update to @baseapp-frontend/utils@4.0.4.

packages/graphql/CHANGELOG.md (1)

3-10: Changelog entry is accurate and appropriately formatted.

The new 1.3.6 entry correctly documents the import refactoring and dependency updates. The version bump is appropriate for a patch-level change, and the dependency versions align with the coordinated updates across the monorepo (moving CURRENT_PROFILE_KEY_NAME from authentication to a centralized utils module). Based on learnings.

packages/authentication/package.json (1)

4-4: Patch version bump is appropriate for the refactoring work.

The version bump from 5.0.4 to 5.0.5 is semantically correct for the internal refactoring of moving CURRENT_PROFILE_KEY_NAME to the utils package, with updated imports and peer dependency declaration remaining compatible via workspace:*.

packages/authentication/CHANGELOG.md (1)

3-9: Changelog entry is accurate and complete.

The 5.0.5 patch entry correctly documents the constant relocation and coordinated dependency update. Version numbering and formatting are consistent with the existing changelog.

packages/wagtail/package.json (1)

4-4: Version bump looks good.

Clean patch-level version increment (1.0.39 → 1.0.40) consistent with dependency updates documented in CHANGELOG.md.

packages/wagtail/CHANGELOG.md (1)

3-10: Changelog entry is well-formatted and consistent.

Version 1.0.40 entry correctly documents the three dependency updates in proper format, matching the established pattern from previous releases.

packages/design-system/CHANGELOG.md (1)

3-8: The changelog entry is correct and complete.

Design-system received only a dependency update (utils 4.0.3 → 4.0.4); no component source files were modified in this package. The changelog accurately documents this change. The AI summary's mention of "Comment and messaging components now use profile-centric fields" refers to changes in other packages, not design-system.

Likely an incorrect or invalid review comment.

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

♻️ Duplicate comments (2)
packages/components/modules/navigations/web/Header/AccountMenu/AccountPopover/__tests__/AccountPopover.cy.tsx (2)

96-103: Critical: Profile list interaction test disabled.

Step 2's test assertions are partially disabled—the test claims to verify profile list scrolling and interaction, but the menu click and operation resolution are commented out. This compounds the test coverage gap.

The same stubbing approach from the previous comment would resolve this. Without these assertions, the scrolling verification (lines 105-109) may be testing against stale or incorrect data.


125-128: Critical: Profile switch verification incomplete.

Step 4's test title states "should not show the success toast when profile is not changed," but the profile switch action is commented out, making the assertion impossible to verify.

This is the third instance of disabled profile switching tests in this file. The pattern suggests the test approach needs to be reconsidered rather than leaving critical assertions disabled.

Recommendation: Either stub window.location.reload() as suggested earlier, or convert these to E2E tests if component tests cannot adequately handle the reload behavior. Leaving the assertions commented out undermines the value of the test suite.

🧹 Nitpick comments (1)
packages/components/modules/comments/web/Comments/__tests__/__mocks__/constants.ts (1)

1-12: MOCK_PROFILE shape looks good; consider making it typed/readonly.

The structure matches the way profile is used in the mocks; if you have a shared Profile/MinimalProfile type for comments, you might optionally annotate MOCK_PROFILE with it or use as const to keep the shape aligned with the schema over time.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54396b9 and 2ed8d02.

📒 Files selected for processing (6)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/comments/web/Comments/__tests__/__mocks__/constants.ts (1 hunks)
  • packages/components/modules/comments/web/Comments/__tests__/__mocks__/requests.ts (8 hunks)
  • packages/components/modules/comments/web/Comments/__tests__/__mocks__/resolvers.ts (3 hunks)
  • packages/components/modules/navigations/web/Header/AccountMenu/AccountPopover/__tests__/AccountPopover.cy.tsx (2 hunks)
  • packages/components/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/components/package.json
  • packages/components/modules/comments/web/Comments/tests/mocks/resolvers.ts
  • packages/components/CHANGELOG.md
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-29T13:48:38.345Z
Learnt from: nossila
Repo: silverlogic/baseapp-frontend PR: 300
File: packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx:57-59
Timestamp: 2025-10-29T13:48:38.345Z
Learning: In packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx, the full page reload via window.location.reload() when switching profiles is intentional and required due to websockets connections and data loading patterns that don't yet support reactive profile switching. This is a known technical debt that will be addressed with a larger refactoring in the future.

Applied to files:

  • packages/components/modules/navigations/web/Header/AccountMenu/AccountPopover/__tests__/AccountPopover.cy.tsx
🧬 Code graph analysis (1)
packages/components/modules/comments/web/Comments/__tests__/__mocks__/requests.ts (1)
packages/components/modules/comments/web/Comments/__tests__/__mocks__/constants.ts (1)
  • MOCK_PROFILE (1-12)
🔇 Additional comments (1)
packages/components/modules/comments/web/Comments/__tests__/__mocks__/requests.ts (1)

1-1: Import and profile: MOCK_PROFILE wiring look correct; verify coverage vs API shape.

The new import and all added profile: MOCK_PROFILE fields are consistent and should help exercise the active‑profile behavior in tests. One thing to double‑check: several other comment nodes in this file still have no profile (only user). If the updated GraphQL/API contract always includes a profile for comments created under any profile, you may want mocks to reflect that uniformly; if some comments are intentionally “no profile” (fallback scenarios), this asymmetry is fine.

Also applies to: 17-17, 39-39, 168-168, 201-201, 284-284, 317-317, 965-965

@sonarqubecloud
Copy link

@rf2tsl rf2tsl merged commit 00d707a into master Nov 19, 2025
8 checks passed
@rf2tsl rf2tsl deleted the feature/BA-2717-ba-multiple-user-interaction-profile-accuracy branch November 19, 2025 22:22
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.

4 participants