fix(investigations): Reveal report cells when results are ready - #124516
Conversation
Story previewsPreview the stories changed in this PR on the Vercel deployment: Preview deployment: https://sentry-4c82wxbbf.sentry.dev |
| export function shouldDisplayInvestigationBlock(block: InvestigationBlock) { | ||
| if (block.kind === 'text') { | ||
| return Boolean((getTextOutput(block.output) ?? block.content).trim()); | ||
| } |
There was a problem hiding this comment.
Bug: In shouldDisplayInvestigationBlock, an empty markdown output ('') incorrectly hides a text block, even if it has user-written content, due to improper use of the nullish coalescing operator.
Severity: MEDIUM
Suggested Fix
Modify the logic in shouldDisplayInvestigationBlock to correctly handle an empty string from getTextOutput. Change the condition to use a logical OR (||) instead of nullish coalescing (??), like (getTextOutput(block.output) || block.content).trim(). This will ensure that if getTextOutput returns a falsy empty string, it correctly falls back to block.content.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: static/app/views/investigations/detail/cell.tsx#L435-L438
Potential issue: The `shouldDisplayInvestigationBlock` function determines if a text
block should be visible. It uses the expression `(getTextOutput(block.output) ??
block.content).trim()`. The `getTextOutput` function can return an empty string (`''`)
if the API response contains `markdown: ''`. Because the nullish coalescing operator
(`??`) only provides a fallback for `null` or `undefined`, the expression evaluates to
`''` instead of falling back to `block.content`. Consequently, `Boolean(''.trim())`
becomes `false`, and the block is hidden from view, even if `block.content` contains
user-written text that should be displayed.
Also affects:
static/app/views/investigations/detail/cell.tsx:273~279
Did we get this right? 👍 / 👎 to inform future reviews.
5a2c9ef to
248163c
Compare
f654ed9 to
d379dcb
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d379dcb. Configure here.
| return Boolean( | ||
| output.tableMarkdown.trim() || | ||
| (output.preferredView === 'chart' && getRenderableChart(output.chart)) | ||
| ); |
There was a problem hiding this comment.
Awaiting-input cells stay hidden
Medium Severity
shouldDisplayInvestigationBlock only reveals cells that already have persisted text, a table, or a chart. A first-run cell in awaiting_input has none of those, so InvestigationCell never mounts and the pending-question UI cannot appear. The run stays blocked with no way to answer, while polling continues.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit d379dcb. Configure here.
Query refinements preserve saved data and its original time window. Presentation changes reuse the stored measurements and query links; changes that need another query keep the recorded dates unless the user explicitly requests a different period. Relative windows saved with an execution become absolute dates anchored to that execution, and report cells retain their original source context. Missing historical filters stay unknown rather than combining today's duration with an old timestamp. Explicit linked-parameter edits are supplied separately from the saved settings and carried into subsequent refinements, so changing an environment or date parameter takes precedence without treating current page filters as an edit. Regression coverage includes refining ten days later, stable request fingerprints, report cells without saved filters, and environment/date edits across successive refinements. Rebased onto master after #124334 merged. The frontend counterpart is #124516, which reveals ready cells and removes Rerun.


Investigation report cells now appear when they have usable text, a table, or a chart. Waiting, pending, failed-without-output, and empty query cells stay out of the report, while polling continues to reveal new results. Query evidence opens expanded so it is visible as soon as it arrives.
The cell menu offers Refine and Delete, with Rerun removed. Existing results remain visible while a refinement is running.
Based on #124334. The backend counterpart, #124607, preserves query provenance and the original time window during refinement.