Skip to content

Don't show the New messages marker above the user's own message on first open - #105113

Merged
mjasikowski merged 3 commits into
mainfrom
claude-unreadMarkerSkipSelfAuthoredAnchor
Oct 30, 2026
Merged

mjasikowski merged 3 commits into
mainfrom
claude-unreadMarkerSkipSelfAuthoredAnchor

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

When the same account is signed in on more than one device, a session can have a stale report.lastReadTime. On first open, usePaginatedReportActions then picks the user's own message (sent from another device) as the oldest unread "pagination anchor". The marker scan correctly refuses to place a fresh marker on a self-authored action, but useUnreadMarker fell back to the anchor whenever the scan returned null. The marker landed on the user's own message and then stuck, because it was stored as prevUnreadMarkerReportActionID.

This PR:

  • Adds isReportActionFromCurrentUser(reportAction, currentUserAccountID) to ReportActionsUtils. It uses childLastActorAccountID for report previews and actorAccountID for everything else.
  • Uses it in shouldDisplayNewMarkerOnReportAction in place of the inline isFromCurrentUser expression (no behavior change).
  • Uses it in useUnreadMarker so the pagination anchor is used as the marker only when the current user did not author it. Scroll positioning is unchanged.
  • Adds unit tests for the helper and for the self-authored anchor case.

Known edge case: if the stale anchor is the user's own message and a newer message from another user follows it, no marker is shown on that session. Before this change, the marker sat above the user's own message. Moving the marker to the other user's message would need a change to the scan's nextMessage handling, which is outside the approved proposal.

AI tests run locally:

  • jest tests/unit/useUnreadMarkerTest.ts tests/unit/ReportActionsUtilsTest.ts tests/ui/UnreadIndicatorsTest.tsx: passed (554 passed, 2 skipped)
  • npm run typecheck: passed
  • npm run lint-changed: passed
  • Not run: the formatter check (CI covers it), and a browser check. The automated browser session loaded a blank page, and the multi-session repro needs manual testing.

Fixed Issues

$ #104178
PROPOSAL: #104178 (comment)

Tests

Precondition: Sign in to the same account (User A) in three sessions: Session 1 (for example, the native app or a browser), Session 2 (another browser), and Session 3 (a third browser or an incognito window).

Own message from another device does not get the marker

  1. In Session 1, start a chat with User B and send a message.
  2. In Sessions 2 and 3, reload the page so the chat appears in the LHN. Do not open the chat.
  3. In Session 1, send another message to the chat.
  4. In Session 2, open the chat.
  5. Verify the "New messages" marker does not appear above User A's message.
  6. In Session 3, open the chat.
  7. Verify the "New messages" marker does not appear above User A's message.

Messages from other users still get the marker (regression)
8. In Sessions 1, 2, and 3, leave the chat with User B so it is not open.
9. Sign in as User B in a separate browser and send a message to User A.
10. In Session 2, open the chat with User B.
11. Verify the "New messages" marker appears above User B's message.

  • Verify that no errors appear in the JS console

Offline tests

N/A. This change only affects where the client places the "New messages" marker for report actions that are already loaded. It does not add or change any API calls.

QA Steps

Same as tests. To match the original report, use the Hybrid app for Session 1, mWeb Safari for Session 2, and mWeb Chrome for Session 3.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

…ed it

Add isReportActionFromCurrentUser and use it in useUnreadMarker and shouldDisplayNewMarkerOnReportAction.

Co-authored-by: Vinh Hoang <hoangzinh@users.noreply.github.com>
@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/hooks/useUnreadMarker.ts 98.52% <100.00%> (ø)
src/libs/ReportActionsUtils.ts 85.36% <100.00%> (+<0.01%) ⬆️
...box/report/shouldDisplayNewMarkerOnReportAction.ts 98.41% <100.00%> (ø)
... and 297 files with indirect coverage changes

@MelvinBot

MelvinBot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ⚠️ partial

On standalone Android NewDot, sending and leaving the chat worked, and the regression check passed: another account's unread message still gets the New marker. The PR's main fix could not be tested. That test needs a second signed-in session of the same account to create a stale lastReadTime, and the test setup supports only one session.

Green New marker line above Concierge's unread reply in the thread

Step Status
1. Sign in and send a message from the emulator in a chat with another userSigned in, opened the Concierge chat, and sent a test message. The message rendered normally.
✅
2. Leave the chat (back to LHN) so it's visible but not openReturned to the Inbox LHN. The chat was listed there while not open.
✅
3. From another session of the same account, send a new message to that chatNot run. The test setup supports only one session per device, so a second session of the same account was not available.
⚠️
4. Open the chat and confirm the New messages marker does NOT appear above the user's own messageNot run. This step depends on the stale-session setup from step 3, so the PR's main fix was not exercised.
⚠️
5. Regression: another account's unread message DOES show the New messages markerConcierge replied in a thread while the emulator was not viewing it. On reopening, the "New" marker appeared directly above Concierge's unread reply.
Green New marker line above Concierge's unread reply in the thread
✅
6. No red-box or JS errors during the flowThe app stayed in the foreground through sign-in, onboarding, messaging, and navigation. No crash or red-box screen appeared, and no console errors were captured.
✅

view run · view recording

@MelvinBot

MelvinBot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

On dev NewDot web, sending a message and leaving the chat worked. The PR's main fix and the regression check could not be tested: they need a second, separately signed-in session of the same account (or a reply from another account), and the test setup supports only one browser session. Concierge also did not reply within about a minute.

Concierge chat shows no auto-reply after waiting

Step Status
1. Create or open a chat with another user and send a message from the main sessionCreated a new 1:1 chat and sent a test message. It rendered normally with no "New messages" marker.
Message sent and visible in the new 1:1 chat
✅
2. Leave the chat so it is visible in LHN but not openMoved to the Concierge chat. The other chat stayed in the LHN with the preview "You: Hello from the main session…".
Other-party chat visible in LHN while Concierge chat is open
✅
3. From a separate session of the same account, send a new message to that chatNot run. The test setup has only one browser session. A second tab shares storage, so it would not reproduce the bug.
⚠️
4. Open the chat in the main session; the "New messages" marker does NOT appear above the user's own messageNot run. This step depends on step 3, so the PR's main fix was not exercised.
⚠️
5. Regression: another account's unread message DOES show the "New messages" markerNot run. Messaged Concierge and left the chat, but Concierge did not reply within about a minute in the dev environment, so no unread message from another account was available.
Concierge chat shows no auto-reply after waiting
⚠️
6. No errors appear in the JS consoleNot checked directly, because the web test tool cannot read the browser console. No error banners, crash screens, or broken UI appeared during the flow.
⚠️

view run · view recording

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing check is unrelated to this PR, so I didn't push a fix.

Analysis: validate-perf-tests failed on [ReportActionsList] should re-render when the report name changes with a render-count difference of 0.8. The allowed deviation is 0. This PR can't change that test's render count:

Evidence: At least 9 unrelated PRs failed the same ReportActionsList perf suite between 08:20 and 09:15 UTC today, with fractional differences from 0.6 to 0.9. A real regression gives a whole-number difference, so the fractional values point to a flaky test.

Other runs with the same failure
Branch Measurement Difference
vh/66386-parser-html-to-markdown-report-mentions unrelated report is written 0.7
claude-migrateSearchRowLongPressMenuToGlobalModal unrelated report is written 0.6
@GCyganek/fix-scan-expense-navigation-from-inbox report name changes 0.9
@GCyganek/mweb-landscape-mode/scrollable-main-screens report name changes 0.6
company-agents-beta-label report name changes 0.8
claude-reapplySingleExpenseTableViewBeta report name changes 0.7
claude-required2FAGotItLandsOnHome unrelated transaction is written 0.6
claude-createSubmitWorkspaceWhenDeletedOffline report name changes 0.8
refactor/66424-12 unrelated transaction is written 0.6

The other failing check, Check independent approval, only needs a reviewer's approval. You can re-run the perf workflow, or wait for a fix to the flaky test on main.


view run

@hoangzinh

Copy link
Copy Markdown
Contributor

@MelvinBot can you try add tests for this PR description?

@hoangzinh

Copy link
Copy Markdown
Contributor

@MelvinBot update PR author checklist with this

Details
  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I added test steps to the PR description, based on the repro in the linked issue.

  • Tests: the same account signed in on three sessions. Sending from Session 1 and then opening the chat in Sessions 2 and 3 should not show the "New messages" marker above your own message. A regression check confirms that a message from another user still gets the marker.
  • Offline tests: N/A. The change only affects where the client places the marker, with no API changes.
  • QA Steps: same as Tests, using the Hybrid app, mWeb Safari, and mWeb Chrome to match the original report.

I haven't run these steps. The setup needs several sessions on one account, which my test environment can't create. Please run them before you tick the checkboxes.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

✅ I updated the PR Author Checklist in the PR description to match your list. All 36 items are now checked, and I didn't change anything else in the description.


view run

@hoangzinh

Copy link
Copy Markdown
Contributor

@MelvinBot mark this PR ready for review

@MelvinBot
MelvinBot marked this pull request as ready for review October 29, 2026 10:08
@MelvinBot
MelvinBot requested a review from a team as a code owner October 29, 2026 10:08
@melvin-bot
melvin-bot Bot requested review from hoangzinh and removed request for a team October 29, 2026 10:08
@melvin-bot

melvin-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

@hoangzinh Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I marked this PR as ready for review.


view run

@melvin-bot
melvin-bot Bot requested review from heyjennahay and removed request for a team October 29, 2026 10:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T10:11:16.563455Z 6cb7dd0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@hoangzinh

hoangzinh commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Screen.Recording.2026-10-30.at.17.21.08.mov

@hoangzinh

Copy link
Copy Markdown
Contributor

@MelvinBot merge latest main to resolve "Reassure Performance Tests" failed

…ipSelfAuthoredAnchor

Co-authored-by: Vinh Hoang <hoangzinh@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner October 29, 2026 10:34
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I merged the latest main into this branch and pushed it in commit 14f1e5d. The merge had no conflicts, and it re-triggers CI, including "Reassure Performance Tests".

I could not run the tests locally, so CI will be the first check of the merged code.


view run

@melvin-bot
melvin-bot Bot requested a review from mjasikowski October 29, 2026 10:34
@melvin-bot
melvin-bot Bot removed the request for review from a team October 29, 2026 10:34
@melvin-bot

melvin-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

@mjasikowski Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing validate-perf-tests check is a flaky perf test, not a bug in this PR. I didn't push any changes.

What to do: Re-run the Reassure Performance Tests run. I couldn't trigger the re-run from here. Check independent approval will pass after a reviewer approves.

Why it's unrelated
  • The failure: [ReportActionsList] should re-render when an unrelated report is written rendered 0.6 more times on average than the baseline. The allowed difference is 0.
  • This PR doesn't reach that code path: the test seeds hasOnceLoadedReportActions: true (ReportActionsListRowWrites.perf-test.tsx:100-107). The new check in useUnreadMarker.ts:125-131 only runs when that flag is false. The shouldDisplayNewMarkerOnReportAction change is a refactor with identical output.
  • Other PRs fail the same tests the same way. These unrelated PRs failed tests in the same file today, each with a fractional render-count difference:
    • add-aba-withdrawal-account-setup: "report name changes" test, difference 0.8 (run). The same branch passed an hour earlier.
    • georgia-wise-bank-account-schema-story: "unrelated transaction" test, difference 0.7 (run)
    • insights/compare-average-polish: "unrelated transaction" test, difference 0.7 (run)

view run

@hoangzinh hoangzinh 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.

🚢

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing validate-perf-tests check is a flaky test, not a problem with this PR, so I didn't push a fix. Re-running the check should clear it. The other failure, Check independent approval, just needs a reviewer to approve.

Why this failure is unrelated
  • What failed: In [ReportActionsList] should re-render when an unrelated report is written, the average render count went from 8.10 to 8.70. The allowed deviation is 0.
  • This PR's code doesn't run in that test. The new self-author check only runs when !hasOnceLoadedReportActions (src/hooks/useUnreadMarker.ts:125). The perf suite sets hasOnceLoadedReportActions: true before every test (tests/perf-test/ReportActionsListRowWrites.perf-test.tsx:100-107), so the check is skipped.
  • The render counts are noisy on main too. Baseline averages such as 8.10, 27.10, and 27.50 aren't whole numbers. In the same run, another test in this suite rendered fewer times than on main (27.50 → 27.10).
  • Unrelated PRs fail the same way. Today the same suite failed with the same error on claude-fixLandscapeCardFlexBasis, war-in/fix-iphone-duo-nav-layout, and fix/no-cycle-part21-small-leaf-cuts, by 0.6 to 0.7 renders.
  • A fix for the flaky test is in review: [No QA] Mock fetch in ReportActionsListRowWrites perf test.

Comment thread src/hooks/useUnreadMarker.ts Outdated
Comment on lines +127 to +128
// Another session can have a stale lastReadTime, so the anchor may be the user's own message sent from a
// different device. Leave that case to the scan, which never places a fresh marker on a self-authored action.

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.

Suggested change
// Another session can have a stale lastReadTime, so the anchor may be the user's own message sent from a
// different device. Leave that case to the scan, which never places a fresh marker on a self-authored action.
// A stale lastReadTime can make a message sent by the current user on another device the pagination anchor.
// Use the scan result instead when the current user authored that action.

Comment thread tests/unit/ReportActionsUtilsTest.ts Outdated
// Given a comment written by the current user
const action = {...createRandomReportAction(1), actionName: CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT, actorAccountID: currentUserAccountID} as ReportAction;

// When / Then the action is attributed to the current user through actorAccountID

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.

Suggested change
// When / Then the action is attributed to the current user through actorAccountID
// When checking whether the action is from the current user
// Then it matches because actorAccountID equals currentUserAccountID

Comment thread tests/unit/ReportActionsUtilsTest.ts Outdated
// Given a comment written by someone else
const action = {...createRandomReportAction(1), actionName: CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT, actorAccountID: otherUserAccountID} as ReportAction;

// When / Then the action is not attributed to the current user

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.

Suggested change
// When / Then the action is not attributed to the current user
// When checking whether the action is from the current user
// Then it does not match because actorAccountID belongs to another user

Comment thread tests/unit/ReportActionsUtilsTest.ts Outdated
});

it('uses childLastActorAccountID for a report preview', () => {
// Given a report preview created by someone else whose latest child action came from the current user

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.

Suggested change
// Given a report preview created by someone else whose latest child action came from the current user
// Given a report preview where actorAccountID belongs to another user
// and childLastActorAccountID belongs to the current user

Comment thread tests/unit/ReportActionsUtilsTest.ts Outdated
childLastActorAccountID: currentUserAccountID,
} as ReportAction;

// When / Then the preview is attributed to the child report's last actor, not to the preview's own actor

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.

Suggested change
// When / Then the preview is attributed to the child report's last actor, not to the preview's own actor
// When checking whether each preview is from the current user
// Then childLastActorAccountID determines the result, regardless of actorAccountID

Comment thread tests/unit/ReportActionsUtilsTest.ts Outdated
});

it('returns false for an undefined action', () => {
// Given no action / When / Then nothing is attributed to the current user

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.

Suggested change
// Given no action / When / Then nothing is attributed to the current user
// Given no report action
// When checking whether it is from the current user
// Then the check returns false because there is no author to match

Comment thread tests/unit/useUnreadMarkerTest.ts Outdated
});

it('does not use the oldestUnread anchor on first open when the current user authored the anchored action', () => {
// Given another session whose stale lastReadTime makes the user's own message (sent from a different device) the oldest unread

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.

Suggested change
// Given another session whose stale lastReadTime makes the user's own message (sent from a different device) the oldest unread
// Given an action from the current user that is newer than the session's lastReadTime

Comment thread tests/unit/useUnreadMarkerTest.ts Outdated
hasOnceLoadedReportActions: false,
});

// Then no marker is shown, because the user has already seen their own message

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.

Suggested change
// Then no marker is shown, because the user has already seen their own message
// Then no marker is shown because the current user authored the anchor action

Comment thread tests/unit/useUnreadMarkerTest.ts Outdated
});

it('does not use the oldestUnread anchor on first open when the current user is the last actor of the anchored report preview', () => {
// Given a report preview anchor whose own actor is someone else but whose latest child action came from the current user

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.

Suggested change
// Given a report preview anchor whose own actor is someone else but whose latest child action came from the current user
// Given a report preview anchor where actorAccountID belongs to another user
// and childLastActorAccountID belongs to the current user

@mjasikowski mjasikowski 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.

Need some comment changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Nothing has changed since my last comment, so I didn't push a fix. The failure is still the same flaky validate-perf-tests run on the same commit, and nobody has re-run it yet. This PR's code doesn't cause it.

To clear it: someone with permission needs to re-run the failed job in the Reassure run. I don't have permission to re-run it here. The fix for the flaky test, [No QA] Mock fetch in ReportActionsListRowWrites perf test, is still open. After it merges, you can merge main into this branch to make the check stable.

Check independent approval and checklist are pending reviewer actions, not code failures.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Nothing has changed since my earlier analysis, so there's no code fix to push. validate-perf-tests is still showing the same failed run from before. It hasn't been re-run since.

What to do: Open the failed perf test run and select Re-run failed jobs. I don't have permission to re-run it myself.

The failure is a flaky render count in ReportActionsListRowWrites.perf-test.tsx. Today it also failed unrelated PRs with the same error. The fix for the flaky test, [No QA] Mock fetch in ReportActionsListRowWrites perf test, is still open. After it merges, you can merge main into this branch to stop the flakiness.

Check independent approval only needs a reviewer's approval.

@hoangzinh

Copy link
Copy Markdown
Contributor

@MelvinBot can you check @mjasikowski's feedbacks above?

Co-authored-by: Vinh Hoang <hoangzinh@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I applied all 9 of mjasikowski's suggestions in 964408df. Each one used the reviewer's exact wording:

  • src/hooks/useUnreadMarker.ts:127-128: the anchor comment now uses the shorter wording.
  • tests/unit/ReportActionsUtilsTest.ts (5 suggestions) and tests/unit/useUnreadMarkerTest.ts (3 suggestions): the // Given, // When and // Then comments are now on separate lines.

Only comments changed, so the code behaves the same. I couldn't run Jest in this environment, so CI will run the tests on this commit.

@mjasikowski
mjasikowski merged commit 7f6e5f6 into main Oct 30, 2026
45 of 46 checks passed
@mjasikowski
mjasikowski deleted the claude-unreadMarkerSkipSelfAuthoredAnchor branch October 30, 2026 12:57
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mjasikowski has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mjasikowski in version: 9.5.27-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed. This bug fix stops the "New messages" marker from appearing above your own message sent from another device, which is what users already expect, and no help article describes that marker.


view run

@OSBotify

OSBotify commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/blimpich in version: 9.5.27-2 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants