Skip to content

[Due for payment 2026-08-25] Chat - Video link disappears when editing comment for the second time #98692

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.54-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #97935
Email or phone of affected tester (no customers): sdsiodjnosdjiodsj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Chat Report View

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to any chat.
  3. Go offline.
  4. Send a text with video attachment.
  5. Right click on the message > Edit comment.
  6. Edit the text and save it.
  7. Right click on the message > Edit comment.

Expected Result:

Video link will not disappear when editing comment for the second time.

Actual Result:

Video link disappears when editing comment for the second time.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7233919_1786740266451.3.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7233919

Issue OwnerCurrent Issue Owner: @brunovjk

Activity

  1. applause-bot commented on Aug 14, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/c17ed986ee4243d0f5d2c67bb42cde8a3331fc9edfaaa0cfac1791f904991592

  2. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 14, 2026
  3. melvin-bot commented on Aug 14, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #97935

  4. melvin-bot commented on Aug 14, 2026

    @melvin-bot

    @youssef-lr @brunovjk you have been assigned to this deploy blocker because you reviewed the offending PR: #97935

  5. melvin-bot commented on Aug 14, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  6. github-actions commented on Aug 14, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  7. MelvinBot commented on Aug 14, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #97935 - "Show Edit comment for text and attachment messages while the attachment uploads" by @mukhrr (High confidence)
    Related Issues: None

    Recommendation: REVERT

    PR #97935 is a self-contained, brand-new feature (not in production) that regresses a core chat action for video/<a>-type attachments; reverting cleanly removes the regression. A small targeted fix is also viable (see Root Cause) if the author prefers to roll forward quickly.

    Assigned: @mukhrr (PR author), @youssef-lr and @brunovjk (approving reviewers) from PR #97935
    Labels: No change. DeployBlockerCash is kept (App deploy is blocked by an App PR). DeployBlocker was not present, so nothing to remove.

    📋 Detailed Analysis

    Evidence

    • PR Show Edit comment for text and attachment messages while the attachment uploads #97935 is item 61 in the current StagingDeployCash checklist (#98677), merged 2026-08-14, in version 9.4.54-0.
    • It rewrites exactly the offline "edit a comment that has an uploading attachment" flow described in the repro, touching src/libs/ReportUtils.ts, src/libs/actions/Report/index.ts, and src/libs/actions/RequestConflictUtils.ts.
    • The bug is video-specific (the issue title is "Video link disappears"), which matches the root cause precisely: images are self-closing (<img ... />) and documents are handled by a separate <a>...</a> branch, but <video>...</video> is mishandled.
    • Reproducible on staging only, N/A on production (new feature) — consistent with a regression introduced by this staging PR.

    Verification

    Root Cause

    When you edit a comment whose attachment is still uploading, editReportComment re-appends the uploading attachment tag to the optimistic message so it keeps showing:

    optimisticHtml = ${htmlForNewComment}<br /><br />${uploadingAttachmentHtml} (Report/index.ts L3567-L3568).

    uploadingAttachmentHtml comes from getUploadingAttachmentHtmlFromComment, which extracts the tag with this regex (ReportUtils.ts L6726-L6729):

    <(?:img|video)\b[^>]*data-optimistic-src="[^"]*"[^>]*>|<a\b[^>]*data-optimistic-src="[^"]*"[^>]*>[\s\S]*?</a>
    

    For a video, getUploadingAttachmentHtml builds <video src="blob:X" data-optimistic-src="blob:X" data-expensify-source="blob:X" ...>clip.mp4</video> (ReportUtils.ts L6676-L6678). The img|video branch ends at [^>]*>, so it captures only the opening <video ...> tag and drops the clip.mp4</video> portion. Images are self-closing so this is fine for them, and documents use the dedicated <a>...</a> branch — but videos end up as an unclosed <video> tag.

    After the first edit, the stored optimistic HTML therefore contains an unclosed <video ...> element. When you open Edit the second time, the draft is generated via Parser.htmlToMarkdown(getActionHtml(reportAction)) (see ContextMenuActions.tsx editAction). ExpensiMark's video→markdown rule requires a closing </video> (.../<video[^><]*data-expensify-source...>([^><]*)<\/video>.../), so the unclosed tag does not convert back to attachment markdown and the blob: reference is dropped from the draft entirely.

    The second editReportComment then evaluates isUploadingAttachmentRemovedFromDraft(textForNewComment, originalCommentHTML) (Report/index.ts L3538). Because the draft no longer contains the data-optimistic-src blob: URI, it concludes the user deleted the attachment → shouldRemoveQueuedAttachment = true → uploadingAttachmentHtml = undefined (no re-append) and the queued file/attachmentID are stripped from the pending Add request (RequestConflictUtils.ts). Result: the video link disappears.

    Note the img/document unit tests added in the PR pass precisely because those forms round-trip correctly; there is no video round-trip test, so the gap went unnoticed.

    Targeted fix (if rolling forward): make the extraction capture the full non-void element, e.g. give <video> the same ...>[\s\S]*?</video> treatment the <a> branch already has (or capture <video\b[^>]*>[\s\S]*?</video>), so the re-appended optimistic HTML is well-formed and round-trips through htmlToMarkdown on the next edit. Adding a video round-trip case to the replaceLocalAttachmentReferences/getUploadingAttachmentHtmlFromComment tests would lock it in.

  8. mukhrr commented on Aug 15, 2026

    @mukhrr
    Contributor

    @brunovjk can we review and merge this before reverting pls? #98702 cc @youssef-lr

  9. brunovjk commented on Aug 17, 2026

    @brunovjk
    Contributor

    Reviewing now

  10. self-assigned this
    on Aug 17, 2026
  11. Beamanator commented on Aug 17, 2026

    @Beamanator
    Contributor

    thanks y'all! helping review and move forward

  12. m-natarajan commented on Aug 17, 2026

    @m-natarajan

    Not repro in Win11/Chrome, v9.4.54-3

    Recording.3377.mp4
  13. Beamanator commented on Aug 17, 2026

    @Beamanator
    Contributor

    Nice! CLosing this out!

  14. melvin-bot commented on Aug 18, 2026

    @melvin-bot

    @brunovjk

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.54-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-08-25. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

  15. changed the title [-]Chat - Video link disappears when editing comment for the second time[/-] [+][Due for payment 2026-08-25] Chat - Video link disappears when editing comment for the second time[/+] on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions