chore(setup): workspace dev data path + DB seed + force flags#1491
chore(setup): workspace dev data path + DB seed + force flags#1491
Conversation
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
📝 WalkthroughWalkthroughThis PR introduces environment-variable-driven configuration for Superset's home directory and enhances setup/teardown scripts with CLI argument parsing and new development workflow steps. Changes include: git ignore configuration for development data, local SQLite database seeding in setup, optional data cleanup in teardown, configurable home directory path in the desktop app, and extraction of event type mapping logic. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.superset/setup.sh:
- Around line 521-533: When --force removes $dev_data_dir but no $source_db
exists, the script returns early without recreating the directory; ensure
$dev_data_dir is recreated before returning when skipping seed. Update the
branch that handles [ ! -f "$source_db" ] to run mkdir -p "$dev_data_dir" (or
call the existing directory-creation logic) after the warning/step_skipped and
before return 0 so that variables/consumers expecting dev_data_dir (variables:
force_overwrite, dev_data_dir, source_db) still find the directory even when
seeding is skipped.
🧹 Nitpick comments (1)
.superset/teardown.sh (1)
245-268: Consider not recording astep_skippedentry when the flag is simply not set.When
-fis not passed,step_skipped "Remove superset-dev-data (flag not set)"fires on every normal teardown. This will cause the summary to always list a skipped step, which is a bit noisy for an opt-in feature — unlike the other skipped steps that reflect missing dependencies or config.A simple fix: return early without recording a skip when the flag isn't set, so the step is silently omitted from the summary.
Proposed diff
step_remove_dev_data() { local dev_data_dir="superset-dev-data" if [ "$REMOVE_DEV_DATA" != "1" ]; then - step_skipped "Remove superset-dev-data (flag not set)" return 0 fi
| if [ "$force_overwrite" = "1" ] && [ -d "$dev_data_dir" ]; then | ||
| warn "Force overwrite enabled — removing existing $dev_data_dir/" | ||
| if ! rm -rf "$dev_data_dir"; then | ||
| error "Failed to remove existing $dev_data_dir/" | ||
| return 1 | ||
| fi | ||
| fi | ||
|
|
||
| if [ ! -f "$source_db" ]; then | ||
| warn "No source local.db found at $source_db — skipping (app will create a fresh one)" | ||
| step_skipped "Seed local DB (no source DB)" | ||
| return 0 | ||
| fi |
There was a problem hiding this comment.
--force with no source DB deletes superset-dev-data/ without recreating it.
When --force is set but $HOME/.superset/local.db doesn't exist, the directory is removed (line 523) and then the function returns early at line 532 without calling mkdir -p (line 541). Downstream code or the app expecting superset-dev-data/ to exist could fail.
Consider ensuring the directory is recreated even when skipping the seed:
Proposed fix
if [ ! -f "$source_db" ]; then
warn "No source local.db found at $source_db — skipping (app will create a fresh one)"
+ mkdir -p "$dev_data_dir"
+ chmod 700 "$dev_data_dir"
step_skipped "Seed local DB (no source DB)"
return 0
fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if [ "$force_overwrite" = "1" ] && [ -d "$dev_data_dir" ]; then | |
| warn "Force overwrite enabled — removing existing $dev_data_dir/" | |
| if ! rm -rf "$dev_data_dir"; then | |
| error "Failed to remove existing $dev_data_dir/" | |
| return 1 | |
| fi | |
| fi | |
| if [ ! -f "$source_db" ]; then | |
| warn "No source local.db found at $source_db — skipping (app will create a fresh one)" | |
| step_skipped "Seed local DB (no source DB)" | |
| return 0 | |
| fi | |
| if [ "$force_overwrite" = "1" ] && [ -d "$dev_data_dir" ]; then | |
| warn "Force overwrite enabled — removing existing $dev_data_dir/" | |
| if ! rm -rf "$dev_data_dir"; then | |
| error "Failed to remove existing $dev_data_dir/" | |
| return 1 | |
| fi | |
| fi | |
| if [ ! -f "$source_db" ]; then | |
| warn "No source local.db found at $source_db — skipping (app will create a fresh one)" | |
| mkdir -p "$dev_data_dir" | |
| chmod 700 "$dev_data_dir" | |
| step_skipped "Seed local DB (no source DB)" | |
| return 0 | |
| fi |
🤖 Prompt for AI Agents
In @.superset/setup.sh around lines 521 - 533, When --force removes
$dev_data_dir but no $source_db exists, the script returns early without
recreating the directory; ensure $dev_data_dir is recreated before returning
when skipping seed. Update the branch that handles [ ! -f "$source_db" ] to run
mkdir -p "$dev_data_dir" (or call the existing directory-creation logic) after
the warning/step_skipped and before return 0 so that variables/consumers
expecting dev_data_dir (variables: force_overwrite, dev_data_dir, source_db)
still find the directory even when seeding is skipped.
Summary
SUPERSET_HOME_DIRwith fallback to~/.superset*SUPERSET_HOME_DIR=$PWD/superset-dev-datain setup-generated workspace.envlocal.db,-wal,-shm) intosuperset-dev-data/superset-dev-data/in git-f/--forceto setup: resetsuperset-dev-data/before seeding-f/--forceto teardown: removesuperset-dev-data/Scope
Only these files are changed:
.gitignore.superset/setup.sh.superset/teardown.shapps/desktop/src/main/lib/app-environment.tsValidation
bash -n .superset/setup.shbash -n .superset/teardown.shbun --cwd apps/desktop test(passes)bun run typecheckinapps/desktop(passes)Summary by CodeRabbit