Skip to content

[No QA] Fix is_warm labeling on report-open spans - #98852

Open
TMisiukiewicz wants to merge 2 commits into
Expensify:mainfrom
callstack-internal:fix-openreport-span-semantics
Open

[No QA] Fix is_warm labeling on report-open spans#98852
TMisiukiewicz wants to merge 2 commits into
Expensify:mainfrom
callstack-internal:fix-openreport-span-semantics

Conversation

@TMisiukiewicz

@TMisiukiewicz TMisiukiewicz commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

The ManualOpenReport span is closed by whichever component gets there first: a skeleton closes it and tags is_warm=false, the finished list closes it from onLayout and tags is_warm=true. The problem was that the decision "a skeleton is showing" lived in the parents, and every copy of it was wrong in a different way:

  • ReportActionsSkeletonGuard checked shouldShowInitialSkeleton, but a skeleton actually renders on the wider shouldShowLoadingSkeleton and on shouldShowDerivedTimingSkeleton.
  • ReportActions checked shouldShowAppLoadSkeleton, which excludes shouldWaitForTransactions — the exact case the line below it renders a skeleton for.
  • MoneyRequestReportView checked one of its three skeleton branches and missed the other two.
  • MoneyRequestReportActionsList checked a flag called shouldShowOpenReportLoadingSkeleton that renders nothing at all. It means "initial actions still loading", which stays true after the transaction table is on screen, so it fired cold after the content was already visible.
  • The hook bailed out on !report, which is the same condition one of those skeletons renders for, so that branch could never close at all.

The result: cold opens showed a skeleton, nobody tagged them, and the span kept running until the messages rendered — landing in the is_warm=true bucket with the full cold wait baked in. That's why warm p95 (~1.1s) looked worse than cold p95 (~600ms).

What changed:

  • The cold mark now lives inside ReportActionsLoadingSkeleton, the component every chat-path skeleton renders through. Mounted means visible, so the mark can't drift from the condition. The two parent gates are deleted rather than corrected.
  • MoneyRequestReportView shares named booleans between its three skeleton branches and the mark, and takes reportIDFromRoute as a prop — its skeletons render before the report lands in Onyx, so report?.reportID was undefined and the mark silently did nothing.
  • markOpenReportEnd keys the span on reportID instead of reading it off the report object, so opens where the report isn't in Onyx yet can close at all.
  • MoneyRequestReportActionsList no longer marks cold — it renders no skeleton. Its layout close is now an unconditional warm: true, which is correct because a cold open would already have been closed by the skeleton, making this call a no-op.
  • The inbox-tab-defer placeholder opts out via shouldMarkOpenReportEnd={false}. It's a deliberate deferral, not a wait on data, so timing it would tag a cached report as cold.

Nothing user-visible changes and nothing gets faster — only the is_warm label. How cold opens are measured is unchanged: they still stop the clock when the skeleton appears, not when the content does.

Expect warm p95 to drop as the mislabeled opens leave, and cold p95 to dip as those same opens join it as fast time-to-skeleton samples. Cold getting "faster" is bookkeeping, not a win. Sentry alert thresholds on this span should be re-baselined off the first clean week.

Fixed Issues

$ #98880
PROPOSAL:

Tests

  1. Login into account and open console and filter by ManualOpenReport
  2. Open report that is already in Onyx (no skeleton is visible)
  3. Verify in End span object, the is_warm: true
  4. Open report that is not yet in Onyx (skeletons are visible after opening)
  5. Verify End span log shows up once skeletons are visible and attributes object have is_warm: false
  6. Go to Spend -> Reports
  7. Open any report that is not yet in Onyx (skeletons are visible after opening)
  8. Verify End span log shows up once skeletons are visible and attributes object have is_warm: false
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

N/A

  • 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 there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • 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 a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
.../MoneyRequestReportView/MoneyRequestReportView.tsx 58.24% <100.00%> (+1.42%) ⬆️
src/hooks/useMarkOpenReportEndOnSkeleton.ts 100.00% <100.00%> (ø)
src/libs/telemetry/markOpenReportEnd.ts 100.00% <100.00%> (ø)
src/pages/Search/SearchMoneyRequestReportPage.tsx 0.00% <ø> (ø)
src/pages/inbox/ReportActions.tsx 100.00% <ø> (ø)
src/pages/inbox/report/ReportActionsList.tsx 89.05% <ø> (+0.64%) ⬆️
...rc/pages/inbox/report/ReportActionsListContext.tsx 93.10% <ø> (ø)
...ages/inbox/report/ReportActionsLoadingSkeleton.tsx 100.00% <100.00%> (ø)
.../pages/inbox/report/ReportActionsSkeletonGuard.tsx 100.00% <100.00%> (ø)
...equestReportView/MoneyRequestReportActionsList.tsx 60.00% <0.00%> (-0.27%) ⬇️
... and 61 files with indirect coverage changes

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

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

@TMisiukiewicz TMisiukiewicz changed the title [No QA] Fix is_warm mislabeling cold report opens as warm [No QA] Fix is_warm labeling on report-open spans Aug 18, 2026
@TMisiukiewicz
TMisiukiewicz marked this pull request as ready for review August 18, 2026 14:23
@TMisiukiewicz
TMisiukiewicz requested review from a team as code owners August 18, 2026 14:23
@melvin-bot

melvin-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

@abzokhattab 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]

@melvin-bot
melvin-bot Bot removed request for a team August 18, 2026 14:23
@abzokhattab

Copy link
Copy Markdown
Contributor

@codex @MelvinBot review the PR

* orchestrator, and the money-request views): the open-report span must still close even though the list
* body — which would otherwise own this mark once mounted — isn't mounted while the skeleton shows.
* Closes the open-report span as a cold open (`warm: false`) while a skeleton shows. Call it from a component
* mounted exactly while the skeleton is on screen — the list body that would otherwise close the span isn't

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.

❌ CONSISTENCY-16 (docs)

Comments should read as plain sentences without em dashes. This JSDoc description line uses an em dash to join two clauses.

Replace the em dash with a period and start a new sentence:

 * Closes the open-report span as a cold open (`warm: false`) while a skeleton shows. Call it from a component
 * mounted exactly while the skeleton is on screen. The list body that would otherwise close the span isn't
 * mounted yet.

Reviewed at: f281e4a | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

/**
* Mark all 'open_report*' telemetry spans as finished.
* Mark all 'open_report*' telemetry spans as finished. Keyed by `reportID` so it still ends when the report
* hasn't loaded; the report-shape attributes are then left off.

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.

❌ CONSISTENCY-16 (docs)

Comments should use two separate sentences instead of a semicolon. This JSDoc line joins two independent statements with a semicolon.

Split into two sentences:

 * Mark all 'open_report*' telemetry spans as finished. Keyed by `reportID` so it still ends when the report
 * hasn't loaded. The report-shape attributes are then left off.

Reviewed at: f281e4a | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

<NavigationDeferredMount
waitForUpcomingTransition={false}
placeholder={
// Deferral, not a data wait — closing the span here would time the defer and tag a cached report cold.

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.

❌ CONSISTENCY-16 (docs)

Comments should read as plain sentences without em dashes. This comment uses an em dash to join two clauses.

Replace the em dash with a period and start a new sentence:

// Deferral, not a data wait. Closing the span here would time the defer and tag a cached report cold.

Reviewed at: f281e4a | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

/**
* Report-actions loading skeleton. Mounted only while the skeleton shows, so it hosts the hook that cancels
* the otherwise never-ending send-message span (tagged with `skeletonName`).
* Report-actions loading skeleton. Hosts the skeleton-phase span marks — cancelling the never-ending

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.

❌ CONSISTENCY-16 (docs)

Comments should read as plain sentences without em dashes. This JSDoc description uses two em dashes to bracket a clause.

Rewrite without em dashes, for example:

 * Report-actions loading skeleton. Hosts the skeleton-phase span marks: cancelling the never-ending
 * send-message span, and closing the open-report span as cold. Mounted here means visible, while a
 * parent's copy of the skeleton condition can drift from what actually renders.

Reviewed at: f281e4a | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: f281e4a600

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@MelvinBot

Copy link
Copy Markdown
Contributor

Review — telemetry is_warm labeling fix

Reviewed the code and ran a web smoke test. The approach is sound and I found no blocking issues. The core insight — hoisting the cold mark into ReportActionsLoadingSkeleton so "mounted means visible" — removes the parent-condition drift that caused the mislabeling, and keying markOpenReportEnd on reportID lets the span close before the report lands in Onyx. Nice writeup, it made the review easy to follow.

What I verified
  • All skeleton mount sites are consistent. Every render path through ReportActionsLoadingSkeleton (ReportActions, ReportActionsSkeletonGuard) genuinely represents a cold data-wait, and the one exception — the inbox-tab-defer placeholder — correctly opts out with shouldMarkOpenReportEnd={false}.
  • MoneyRequestReportView gating matches render output. The three OR'd booleans on line 214 line up exactly with the three skeleton returns below them; the if (!report) return; path (renders nothing) is only reachable when none of the three are true, so the mark never fires without a visible skeleton.
  • No double-close. endSpanWithAttributes deletes the span from the map on end, so the effect re-firing as report loads (and the later warm:true layout call) are safe no-ops.
  • No orphaned references to the removed shouldShowInitialSkeleton return field (still used as a local inside computeReportActionsSkeletonState), and both MoneyRequestReportView render sites pass the now-required reportIDFromRoute prop, so typecheck should hold.

Two small notes (non-blocking)

  1. Cold spans lose report-shape attributes when the report isn't in Onyx yet. In useMarkOpenReportEndOnSkeleton the effect fires first with report undefined and closes the span immediately — so report_type/chat_type land as null for those cold opens, and the later re-run once report loads is a no-op (span already ended). The PR description acknowledges this ("the report-shape attributes are then left off"), so it's intentional; just flagging that dashboards slicing cold opens by report/chat type will see a null bucket grow.
  2. Duplicate Onyx subscription in MoneyRequestReportView. The component already holds report, and the hook now independently subscribes via useOnyx off reportIDFromRoute. Harmless, and it's the deliberate cost of making the hook self-contained — noting it only in case you'd prefer to pass report through.

Testing

Ran a web smoke test (regression check, since several skeleton gates were deleted):

  • ✅ Chat report opened from the LHN — skeleton → content, all network calls 200, no error UI.
  • ✅ Re-navigating away and back re-rendered cleanly with no stuck skeleton.
  • ⚠️ The money-request/expense-report path couldn't be exercised — the test account has no expense reports or workspaces to open. That path is covered by the code review and the updated unit tests, but a manual pass on a seeded account (per your Tests steps 6–8) is worth doing before merge.

Note: web sessions can't capture the JS console directly, so "no errors" is inferred from clean network responses (all 200) and the absence of any error UI — not a literal console read.

Screenshots from the smoke test are attached in a separate comment.

@garrettmknight
garrettmknight removed their request for review August 18, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants