Skip to content

fix(build): deterministic echarts locale imports; fingerprint loaded config#42154

Open
rusackas wants to merge 3 commits into
masterfrom
fix/dev-echarts-i18n-locale-context
Open

fix(build): deterministic echarts locale imports; fingerprint loaded config#42154
rusackas wants to merge 3 commits into
masterfrom
fix/dev-echarts-i18n-locale-context

Conversation

@rusackas

Copy link
Copy Markdown
Member

SUMMARY

Two reliability fixes for issues that repeatedly broke the local dev stack while iterating on the frontend, both diagnosed from a live environment:

1. Flaky echarts locale resolution breaks webpack incremental rebuilds

plugin-chart-echarts loads chart locales with a template-literal dynamic import (import(`echarts/i18n/lang${locale}.js`)). A computed import forces the bundler to build a context module over the whole echarts/i18n directory, and resolving that directory through the echarts package exports map fails intermittently on webpack incremental rebuilds:

Module not found: Error: Package path ./i18n is exported from package .../echarts,
but no valid target file was found (see exports field in .../echarts/package.json)

When it hits, the emitted dev bundle is broken (in our case the login page stopped rendering) until a full rebuild. The fix replaces the computed import with an explicit per-locale loader map — no context module, deterministic resolution in every bundler, and code-splitting covers exactly the locales listed. Behavior is unchanged: unknown locales still fall back to English.

2. Config reloads can silently apply stale content

werkzeug's auto-reloader re-imports superset_config when the file changes. On some filesystems (notably macOS Docker VirtioFS mounts) the re-read can race a concurrent write and observe stale file content while still logging Loaded your LOCAL configuration at [...] — we caught a live instance where a feature flag silently reverted to its old value after a reload. With only the path logged, that skew is invisible.

This adds a short md5 fingerprint of the config bytes as actually read to the existing log line:

Loaded your LOCAL configuration at [/app/docker/pythonpath_dev/superset_config.py] (md5:1f2e3d4c5b6a)

Comparing it against md5 <path> on the host turns an hour of archaeology into a one-line diagnosis.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A (build/logging behavior).

TESTING INSTRUCTIONS

  1. npm run test -- plugins/plugin-chart-echarts/test/components/Echart.test.tsx — passes (4/4).
  2. npm run type — clean.
  3. Run the dev stack, switch Superset to a non-English locale, open any ECharts chart, and confirm axis/toolbox strings are localized (locale chunk loads on demand).
  4. Start the backend and confirm the config log line now includes the (md5:...) suffix; compare with md5 docker/pythonpath_dev/superset_config.py.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

…config

Two dev-stack reliability fixes:

- plugin-chart-echarts loaded locales via a template-literal dynamic
  import, which makes bundlers build a context module over echarts/i18n.
  Resolving that directory through the echarts package exports map fails
  intermittently in webpack incremental builds ("Package path ./i18n is
  exported ... but no valid target file was found"), leaving the dev
  bundle broken until a full rebuild. Replace the computed import with an
  explicit per-locale loader map: no context module, deterministic
  resolution in every bundler, and code-splitting covers exactly the
  locales listed.

- Log a short md5 fingerprint of the superset_config file bytes as read
  at import time, alongside the existing "Loaded your LOCAL
  configuration" line. Auto-reloaders re-import config on file change,
  and on some filesystems (notably macOS Docker mounts) the re-read can
  race the write and observe stale content while still loading
  "successfully" — with only the path logged, that skew is invisible.
  Comparing the logged digest against `md5 <path>` on the host makes it
  a one-line diagnosis.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dosubot dosubot Bot added change:backend Requires changing the backend change:frontend Requires changing the frontend viz:charts:echarts Related to Echarts labels Jul 18, 2026
@bito-code-review

bito-code-review Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #1d32ca

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 3459267..3459267
    • superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx
    • superset-frontend/plugins/plugin-chart-echarts/types/external.d.ts
    • superset/config.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • 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

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 15.21739% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.05%. Comparing base (ce8d439) to head (8289df1).
⚠️ Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
...ins/plugin-chart-echarts/src/components/Echart.tsx 15.62% 27 Missing ⚠️
superset/config.py 14.28% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42154      +/-   ##
==========================================
- Coverage   65.07%   65.05%   -0.02%     
==========================================
  Files        2758     2758              
  Lines      155222   155265      +43     
  Branches    35570    35572       +2     
==========================================
+ Hits       101008   101012       +4     
- Misses      52299    52338      +39     
  Partials     1915     1915              
Flag Coverage Δ
hive 38.94% <14.28%> (-0.01%) ⬇️
javascript 70.73% <15.62%> (-0.03%) ⬇️
mysql 57.62% <14.28%> (-0.01%) ⬇️
postgres 57.67% <14.28%> (-0.01%) ⬇️
presto 40.89% <14.28%> (-0.01%) ⬇️
python 59.09% <14.28%> (-0.01%) ⬇️
sqlite 57.29% <14.28%> (-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 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.

Comment thread superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx Outdated
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. In superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx, the LOCALE_LOADERS map uses the key SI for Slovenian, but the application normalizes the locale code to SL before lookup. This mismatch prevents the Slovenian locale from being loaded, causing ECharts to fall back to English.

To resolve this, update the key in LOCALE_LOADERS from SI to SL to match the normalized locale code.

superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx

RU: () => import('echarts/i18n/langRU.js'),
  SL: () => import('echarts/i18n/langSL.js'),
  SV: () => import('echarts/i18n/langSV.js'),

…g, ruff format

Address review-bot findings and CI failures:

- The LOCALE_LOADERS keys are Superset locale codes uppercased, but the
  Slovenian entry used echarts' file naming (SI) and could never match
  Superset's `sl`; key it SL -> langSI.js. Add the same-shaped mapping
  for pt_BR -> langPT-br.js. Both locales silently fell back to English
  on master as well (the old computed import requested langSL.js /
  langPT_BR.js, which don't exist), so this is a behavior fix, not just
  a map cleanup.
- Type the locale bundles as Parameters<typeof registerLocale>[1]
  instead of `object`: the per-package tsc build (stricter than the
  repo-root typecheck) rejects passing `object` to registerLocale.
- ruff-format whitespace in config.py.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread superset/config.py Outdated
@bito-code-review

bito-code-review Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #836469

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 3459267..a99002f
    • superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx
    • superset-frontend/plugins/plugin-chart-echarts/types/external.d.ts
    • superset/config.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • 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

Fingerprinting reopened the config file after exec_module, so it could
hash different bytes than what was actually loaded if the file changed
in between, defeating the point of the diagnostic. Read the bytes once
and reuse them for both execution and the digest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jul 18, 2026
@netlify

netlify Bot commented Jul 18, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 8289df1
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a5b8bd7baebf200088a01e6
😎 Deploy Preview https://deploy-preview-42154--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review

bito-code-review Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #92c7ae

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: a99002f..8289df1
    • superset/config.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:backend Requires changing the backend change:frontend Requires changing the frontend plugins size/L viz:charts:echarts Related to Echarts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant