Skip to content

fix(event-log): match embedded routes precisely in logger middleware#41942

Merged
michael-s-molina merged 1 commit into
apache:masterfrom
luizotavio32:update-event-logger-path-logic
Jul 13, 2026
Merged

fix(event-log): match embedded routes precisely in logger middleware#41942
michael-s-molina merged 1 commit into
apache:masterfrom
luizotavio32:update-event-logger-path-logic

Conversation

@luizotavio32

@luizotavio32 luizotavio32 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

This implements a suggestion raised by a review bot on PR #41938.

The embedded-dashboard detection in loggerMiddleware classified events by checking whether the URL contained the substring /embedded/. That check is too broad: a regular dashboard whose slug is literally embedded (URL /dashboard/embedded/) also contains /embedded/, so its events were incorrectly tagged with source: 'embedded_dashboard' instead of source: 'dashboard'.

This replaces the generic substring check with a regular expression that matches only the actual embedded route shapes:

  • /dashboard/:idOrSlug/embedded/
  • /embedded/:uuid/

As a result, regular dashboard events are no longer misclassified as embedded, while genuine embedded routes continue to be detected correctly.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — internal event-logging metadata change only.

TESTING INSTRUCTIONS

Unit tests were added in superset-frontend/src/middleware/logger.test.ts covering source classification across paths:

  • /dashboard/123/embedded/ -> embedded_dashboard
  • /embedded/abc-def-uuid/ -> embedded_dashboard
  • /dashboard/123/ -> dashboard
  • /dashboard/embedded/ (slug is literally embedded) -> dashboard

Run:

cd superset-frontend
npm run test -- src/middleware/logger.test.ts

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

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.79%. Comparing base (5b8e94d) to head (1fcf9ec).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #41942   +/-   ##
=======================================
  Coverage   64.79%   64.79%           
=======================================
  Files        2740     2740           
  Lines      153125   153126    +1     
  Branches    35124    35125    +1     
=======================================
+ Hits        99219    99220    +1     
  Misses      52009    52009           
  Partials     1897     1897           
Flag Coverage Δ
javascript 69.79% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@luizotavio32 luizotavio32 changed the title feat: add new path validation on embedded logging fix(event-log): match embedded routes precisely in logger middleware Jul 10, 2026
@luizotavio32 luizotavio32 marked this pull request as ready for review July 10, 2026 21:05
@dosubot dosubot Bot added the embedded label Jul 10, 2026
@bito-code-review

bito-code-review Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #539aa5

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 1fcf9ec..1fcf9ec
    • superset-frontend/src/middleware/logger.test.ts
    • superset-frontend/src/middleware/loggerMiddleware.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ 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

@michael-s-molina michael-s-molina merged commit 029d495 into apache:master Jul 13, 2026
121 checks passed
@luizotavio32 luizotavio32 deleted the update-event-logger-path-logic branch July 13, 2026 12:55
luizotavio32 added a commit to luizotavio32/superset that referenced this pull request Jul 13, 2026
Cherry-picks the AI-suggested fix from apache#41942. The embedded-dashboard
detection classified events by checking whether the URL contained the
substring `/embedded/`, which misclassified a regular dashboard whose
slug is literally `embedded` (URL `/dashboard/embedded/`). Replace the
generic substring check with a regex that matches only the actual
embedded route shapes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
luizotavio32 added a commit to luizotavio32/superset that referenced this pull request Jul 13, 2026
React Router matches the embedded routes without a trailing slash too, so
`/dashboard/:idOrSlug/embedded` and `/embedded/:uuid` are valid embedded
URLs. The regex introduced in apache#41942 required a trailing slash, so those
events were classified with the wrong source. Make the trailing slash
optional in both branches and add test coverage for the no-slash variants.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants