Skip to content

fix: label self-conversations consistently across clients - #47

Merged
tmad4000 merged 4 commits into
mainfrom
fix/self-chat-label
Sep 2, 2026
Merged

tmad4000 merged 4 commits into
mainfrom
fix/self-chat-label

Conversation

@tmad4000

@tmad4000 tmad4000 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Intent

Fix OpenChat self-conversations displaying Unknown. The bug is client-side, not caused by a missing Google profile name: mobile list code looked only for a participant other than the signed-in user, which cannot exist in a self-only direct chat. Recognize self-only direct conversations explicitly, display the concise title 'Myself', retain the signed-in participant for avatar data, make the label consistent across native iOS, RN-web mobile/desktop, forwarding, search, empty state, chat header, and legacy web, preserve all ordinary DM/group behavior, add regression tests, then push through review and CI. Track the work as OpenChat-5mn6.

What Changed

  • Recognize self-only direct conversations across mobile, RN-web, and legacy web, consistently labeling them “Myself” while retaining the signed-in participant for avatar data.
  • Apply shared conversation display logic across lists, headers, empty states, forwarding, and search while preserving ordinary direct-message and group behavior.
  • Add regression coverage for self-chat display behavior and adjust Metro dependency resolution for RN-web bundling.

Risk Assessment

✅ Low: The change is well-bounded and now enforces the self-conversation title and avatar-participant invariant across the required mobile, RN-web, forwarding, search, empty-state, header, and legacy-web paths while preserving ordinary DM/group naming behavior.

Testing

After restoring missing locked dependencies, the focused web/mobile helper regressions passed, the RN-web production export bundled, and real desktop/mobile renders verified “Myself” across the list, retained self-avatar, header, empty state, and search while preserving ordinary DM/group labels; legacy web evidence also shows the corrected label, while native iOS could not run because Xcode and a simulator runtime are unavailable.

  • Evidence: RN-web mobile conversation list (local file: /var/folders/7w/cfzyk2q1135bh_qr4jsm7ft40000gp/T/no-mistakes-evidence/01M1GZ2MBX2WQZ8Y4R2EWYGA6D/rn-web-mobile-conversation-list.png)
  • Evidence: RN-web mobile self-chat header and empty state (local file: /var/folders/7w/cfzyk2q1135bh_qr4jsm7ft40000gp/T/no-mistakes-evidence/01M1GZ2MBX2WQZ8Y4R2EWYGA6D/rn-web-mobile-self-chat.png)
  • Evidence: RN-web mobile self-chat search results (local file: /var/folders/7w/cfzyk2q1135bh_qr4jsm7ft40000gp/T/no-mistakes-evidence/01M1GZ2MBX2WQZ8Y4R2EWYGA6D/rn-web-mobile-search-self-chat.png)
  • Evidence: RN-web desktop self-chat (local file: /var/folders/7w/cfzyk2q1135bh_qr4jsm7ft40000gp/T/no-mistakes-evidence/01M1GZ2MBX2WQZ8Y4R2EWYGA6D/rn-web-desktop-self-chat.png)
  • Evidence: Legacy web self-chat (local file: /var/folders/7w/cfzyk2q1135bh_qr4jsm7ft40000gp/T/no-mistakes-evidence/01M1GZ2MBX2WQZ8Y4R2EWYGA6D/legacy-web-self-chat.png)
  • Outcome: ⚠️ 1 warning across 2 runs (28m22s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 4 issues found → auto-fixed ✅
  • 🚨 apps/web/src/pages/ChatPage.tsx:97 - The required criterion “make the label consistent across … chat header, and legacy web” is absent here. Opening a self-only direct chat still selects the signed-in participant and renders userDisplayName(...), producing a profile-derived label such as “Jacob (You)” while the list says “Myself”. Use the self-conversation helper for the legacy header while retaining directParticipant for profile/avatar behavior.
  • 🚨 apps/mobile/src/screens/SearchScreen.tsx:169 - The required criterion “make the label consistent across … search” remains reachable. The new branch labels only conversation hits; a message hit from a self-chat still renders DM with ${senderName} here, and legacy web renders “Direct message”. Also, the conversation-hit avatar still discards the signed-in participant because other excludes self. Resolve the hit's conversation and apply the self label/participant invariant across both search clients.
  • 🚨 apps/mobile/src/components/ChatEmptyState.tsx:48 - The required criterion says the concise self-conversation label must be consistent in the empty state, but the changed self branch renders “Messages here are just for you” and never displays “Myself”. Use the shared self title in this copy, unless this intentionally different wording is explicitly approved.
  • 🚨 apps/mobile/src/utils/conversationDisplay.ts:30 - The criterion requires self-only direct conversations to display “Myself”, but this new helper returns an explicit conversation title before checking self identity. The server permits a title when creating a direct conversation, so a titled self-chat remains a reachable exception. Check self first; ordinary titled DMs and groups can retain their current behavior.

🔧 Fix: Fix self-chat labels across headers and search
✅ Re-checked - no issues remain.

⚠️ **Test** - 1 warning
  • ⚠️ apps/mobile - Native iOS and RN-web mobile/desktop were not visually demonstrated. The Expo web development server opened its port but stalled without serving a rendered page, so the available product-level screenshot covers only legacy web. Mobile helper regression tests pass and all required mobile call sites use the helper, but a reviewer must decide whether to proceed with CI/device validation or require additional native/RN-web visual evidence first.
  • Inspected git diff bfe67477d26219592dcf5d27f063b20c48962a25..80fd5c9dad6821bc78238ad11d6c687d507d9bf7 and every self-conversation helper call site.
  • Ran cd apps/server && npx vitest run test/conversationDisplay.test.ts; the first attempt exposed missing isolated-worktree dependencies.
  • Ran npm ci, then reran cd apps/server && npx vitest run test/conversationDisplay.test.ts successfully.
  • Launched apps/web with VITE_NOOS_URL=http://127.0.0.1:41851 npm run dev --workspace=apps/web -- --host 127.0.0.1 against a fixture API, authenticated through the client session flow, selected the self-chat, and verified the rendered list/header and preserved ordinary DM/group rows.
  • Ran the evidence capture script node /var/folders/7w/cfzyk2q1135bh_qr4jsm7ft40000gp/T/no-mistakes-evidence/01M1GZ2MBX2WQZ8Y4R2EWYGA6D/capture-legacy-web.mjs.
  • Attempted RN-web rendering with EXPO_PUBLIC_OPENCHAT_URL=http://127.0.0.1:41851 EXPO_PUBLIC_NOOS_URL=http://127.0.0.1:41851 npx expo start --web --port 19006; Metro opened the port but did not serve a page.
  • Removed generated node_modules and apps/mobile/.expo test artifacts, then confirmed the worktree remained clean with git status --short --branch.

🔧 Fix: Fix RN-web bundling and self-chat header crash
1 warning still open:

  • ⚠️ apps/mobile - Native iOS could not be visually exercised because this host has only Apple Command Line Tools and no Xcode or simulator runtime. The same React Native components were verified through the production RN-web export, including the list, retained self-avatar, chat header, empty state, and search surfaces, but a reviewer must decide whether that shared-code evidence is sufficient or require a later device/TestFlight check.
  • npx --yes vitest@2.1.9 run apps/server/test/conversationDisplay.test.ts (initial setup attempt; blocked by missing expo/tsconfig.base)
  • npm ci --ignore-scripts (restored locked test/build dependencies)
  • npx vitest run apps/server/test/conversationDisplay.test.ts
  • EXPO_PUBLIC_OPENCHAT_URL=http://127.0.0.1:41851 EXPO_PUBLIC_NOOS_URL=http://127.0.0.1:41851 npm run export:web:desktop --workspace=openchat-mobile
  • node …/mock-openchat-server.mjs plus node …/capture-rn-web.mjs (rendered RN-web desktop/mobile, opened the self-chat, and searched it)
  • Visual inspection of the RN-web desktop, mobile list, mobile chat, mobile search, and legacy-web screenshots
  • xcrun simctl list devices available and xcodebuild -version (confirmed native iOS testing unavailable on this host)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@tmad4000
tmad4000 merged commit e5719c1 into main Sep 2, 2026
2 checks passed
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.

1 participant