fix(build): deterministic echarts locale imports; fingerprint loaded config#42154
fix(build): deterministic echarts locale imports; fingerprint loaded config#42154rusackas wants to merge 3 commits into
Conversation
…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>
Code Review Agent Run #1d32caActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The flagged issue is correct. In To resolve this, update the key in superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx |
…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>
Code Review Agent Run #836469Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
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>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #92c7aeActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
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-echartsloads 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 wholeecharts/i18ndirectory, and resolving that directory through the echarts packageexportsmap fails intermittently on webpack incremental rebuilds: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_configwhen 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 loggingLoaded 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:
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
npm run test -- plugins/plugin-chart-echarts/test/components/Echart.test.tsx— passes (4/4).npm run type— clean.(md5:...)suffix; compare withmd5 docker/pythonpath_dev/superset_config.py.ADDITIONAL INFORMATION
🤖 Generated with Claude Code