Skip to content

fix(reports): keep body sized so standalone screenshots don't time out#39944

Merged
EnxDev merged 1 commit intoapache:masterfrom
EnxDev:enxdev/fix/alerts-reports-standalone-body-min-height
May 7, 2026
Merged

fix(reports): keep body sized so standalone screenshots don't time out#39944
EnxDev merged 1 commit intoapache:masterfrom
EnxDev:enxdev/fix/alerts-reports-standalone-body-min-height

Conversation

@EnxDev
Copy link
Copy Markdown
Contributor

@EnxDev EnxDev commented May 7, 2026

SUMMARY

Scheduled Reports on dashboards (especially with native filters that take a moment to hydrate) intermittently fail screenshot capture with:

Failed taking a screenshot Locator.wait_for: Timeout 60000ms exceeded.
Call log:
  - waiting for locator(".standalone") to be visible
  114 × locator resolved to hidden <body class="standalone">…</body>

The body element does have class="standalone" (server-rendered), but Playwright reports it hidden. Root cause: the SSR'd spa.html body only contains an absolutely-positioned spinner, so before React mounts, the body's content height is 0 and Playwright's wait_for(state="visible") keeps reporting "hidden" until React fills the layout. On slow first paints (cold webpack compile, complex native filter hydration, etc.), React mount can exceed the 60s wait and the report errors out.

This is a regression-class issue independent of the multi-tab urlParams fix in #39884: the URL is correct, the body has the right class, but the locator's visibility check fails on the empty body box.

Reproduced locally by blocking JS/CSS subresources after domcontentloaded:

  • Before: body bbox = 1584 × 0, Playwright says HIDDEN.
  • After: body bbox = 1600 × 2000, Playwright says VISIBLE.

The fix pins html, body.standalone to min-height: 100vh; margin: 0; in spa.html whenever standalone_mode is true. This is the screenshot/embed code path, so non-standalone navigations are untouched.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — change is in the SSR shell during a sub-second window before React mounts; not visually observable in the final report screenshot.

TESTING INSTRUCTIONS

  1. Set FEATURE_FLAGS["ALERT_REPORTS"] = True, ALERT_REPORT_TABS = True, ALERT_REPORTS_FILTER = True, PLAYWRIGHT_REPORTS_AND_THUMBNAILS = True, ALERT_REPORTS_NOTIFICATION_DRY_RUN = True.
  2. On any dashboard with tabs + native filters (e.g. Sales Dashboard), create a per-minute Report (PNG): pick a single tab, add a filter_select value (e.g. Country = USA).
  3. Watch report_execution_log — pre-fix, runs intermittently fail with Locator.wait_for: ... .standalone. Post-fix, the wait resolves immediately and screenshots succeed.

Automated coverage:

  • tests/unit_tests/extension_tests.py::test_spa_template_standalone_body_has_min_height renders the Jinja template and asserts the min-height: 100vh rule is present in standalone responses and absent otherwise. Removing the rule from spa.html makes this test fail.
  • All existing tests/unit_tests/commands/report/execute_test.py tests continue to pass — this PR does not touch the _get_tabs_urls / urlParams merge logic shipped in fix(reports): preserve urlParams in multi-tab report fan-out #39884.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: ALERT_REPORTS, PLAYWRIGHT_REPORTS_AND_THUMBNAILS (existing)
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

Screenshot capture (Playwright/Selenium) waits for body.standalone to
become visible, but the SSR'd page only contains an absolutely-positioned
spinner — body collapses to 0 height and the wait resolves "hidden" until
React mounts the dashboard. On slow first paints (cold webpack, complex
filter hydration), this exceeds the 60s wait and the report errors with
"Locator.wait_for: Timeout 60000ms exceeded ... .standalone".

Pin body.standalone to the viewport so the locator is measurable from
first paint and the wait sequence drives off React mount, not body box.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 7, 2026

Code Review Agent Run #82fd2b

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 0bfa4fe..0bfa4fe
    • superset/templates/superset/spa.html
    • tests/unit_tests/extension_tests.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added the alert-reports Namespace | Anything related to the Alert & Reports feature label May 7, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.88%. Comparing base (4aa4415) to head (0bfa4fe).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #39944   +/-   ##
=======================================
  Coverage   63.88%   63.88%           
=======================================
  Files        2583     2583           
  Lines      136602   136604    +2     
  Branches    31501    31502    +1     
=======================================
+ Hits        87274    87276    +2     
  Misses      47812    47812           
  Partials     1516     1516           
Flag Coverage Δ
hive 39.38% <ø> (-0.01%) ⬇️
mysql 59.06% <ø> (+<0.01%) ⬆️
postgres 59.13% <ø> (+<0.01%) ⬆️
presto 41.08% <ø> (-0.01%) ⬇️
python 60.57% <ø> (+<0.01%) ⬆️
sqlite 58.77% <ø> (+<0.01%) ⬆️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@EnxDev EnxDev added hold:testing! On hold for testing and removed hold:testing! On hold for testing labels May 7, 2026
@EnxDev EnxDev merged commit b5186d1 into apache:master May 7, 2026
71 of 73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alert-reports Namespace | Anything related to the Alert & Reports feature size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants