Skip to content

Conversation

@kgabryje
Copy link
Member

@kgabryje kgabryje commented Nov 9, 2025

SUMMARY

Supplement of #36027

Simplify the logic around taking tile screenshots with playwright.
This PR removes calculations based on getBoundingClientRect. Instead, we take tile screenshots by simply calculating the (x,y) coordinates of the clip window based on tile index and viewport height.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

Unit tests should pass. For manual testing, create a large dashboard (longer than SCREENSHOT_TILED_HEIGHT_THRESHOLD from config.py) and run a report.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Functionality Missing comma in JavaScript object literal ▹ view
Files scanned
File Path Reviewed
superset/utils/screenshot_utils.py

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #662b7a

Actionable Suggestions - 1
  • superset/utils/screenshot_utils.py - 1
Additional Suggestions - 3
  • tests/unit_tests/utils/test_screenshot_utils.py - 3
    • Missing return type annotation for method · Line 177-177
      Missing return type annotation for `test_logs_dashboard_info` method on line 177. Similar issues exist for methods on lines 204, 236, and 268. Add `-> None` return type annotation.
      Code suggestion
       @@ -177,1 +177,1 @@
      -    def test_logs_dashboard_info(self, mock_page):
      +    def test_logs_dashboard_info(self, mock_page) -> None:
    • Nested with statements should be combined · Line 179-179
      Multiple nested `with` statements on lines 179-180 should be combined into a single `with` statement for better readability. Similar issue exists on lines 243-246.
      Code suggestion
       @@ -179,2 +179,1 @@
      -        with patch("superset.utils.screenshot_utils.logger") as mock_logger:
      -            with patch("superset.utils.screenshot_utils.combine_screenshot_tiles"):
      +        with patch("superset.utils.screenshot_utils.logger") as mock_logger, patch("superset.utils.screenshot_utils.combine_screenshot_tiles"):
    • Commented out code should be removed · Line 232-232
      Found commented-out code on line 232: `# height=1000 (remaining)`. Consider removing commented code or converting to proper documentation.
      Code suggestion
       @@ -231,3 +231,2 @@
                    # Tile 3: y=4100 (dashboard_top + 2*viewport_height)
      -            # height=1000 (remaining)
                    assert screenshot_calls[2][1]["clip"]["y"] == 4100
Review Details
  • Files reviewed - 2 · Commit Range: d2e3853..d2e3853
    • superset/utils/screenshot_utils.py
    • tests/unit_tests/utils/test_screenshot_utils.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 Default Agent 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

@codecov
Copy link

codecov bot commented Nov 9, 2025

Codecov Report

❌ Patch coverage is 6.25000% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.71%. Comparing base (c42e3c6) to head (bd4b949).
⚠️ Report is 333 commits behind head on master.

Files with missing lines Patch % Lines
superset/utils/screenshot_utils.py 9.09% 10 Missing ⚠️
superset/utils/webdriver.py 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #36051       +/-   ##
===========================================
+ Coverage        0   68.71%   +68.71%     
===========================================
  Files           0      622      +622     
  Lines           0    45752    +45752     
  Branches        0     4978     +4978     
===========================================
+ Hits            0    31438    +31438     
- Misses          0    13068    +13068     
- Partials        0     1246     +1246     
Flag Coverage Δ
hive 44.17% <6.25%> (?)
mysql 67.79% <6.25%> (?)
postgres 67.84% <6.25%> (?)
presto 47.73% <6.25%> (?)
python 68.68% <6.25%> (?)
sqlite 67.45% <6.25%> (?)
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.

Copy link
Member

@Antonio-RiveroMartnez Antonio-RiveroMartnez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, my comments/questions are non-blocking

logger.debug(
"Scrolled window to %s for tile %s/%s", scroll_y, i + 1, num_tiles
)
y = dashboard_top + (i * tile_height)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I preferred the larger names on these variables, i.e, y and x probably not as readable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, they're x and y coordinates, but it might not be obvious from first glance. I'll change that

height: rect.height
}};
}}""")
page.wait_for_timeout(1000)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I know this code is like this from before, but should we make that timeout a const at the top? so we can change/play with it later if needed without having o chase it down here?

combined_screenshot = combine_screenshot_tiles(screenshot_tiles)

# Reset window scroll position
page.evaluate("window.scrollTo(0, 0)")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this intended?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it wasn't really necessary. scrollTo takes absolute coordinates, not relative, so we don't need to scroll back to the top after each loop

@kgabryje kgabryje merged commit 63dfd95 into apache:master Nov 10, 2025
58 checks passed
@sadpandajoe sadpandajoe added the v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch label Nov 10, 2025
sadpandajoe pushed a commit that referenced this pull request Nov 10, 2025
sadpandajoe pushed a commit that referenced this pull request Nov 10, 2025
sadpandajoe pushed a commit that referenced this pull request Nov 10, 2025
aminghadersohi pushed a commit to aminghadersohi/superset that referenced this pull request Nov 17, 2025
kshi020302 pushed a commit to jl141/superset that referenced this pull request Nov 30, 2025
@github-actions github-actions bot added 🍒 6.0.0 Cherry-picked to 6.0.0 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch 🍒 6.0.0 Cherry-picked to 6.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants