Skip to content

chore(setup): workspace dev data path + DB seed + force flags#1491

Merged
Kitenite merged 4 commits intomainfrom
kitenite/worktree-dev-data-minimal
Feb 14, 2026
Merged

chore(setup): workspace dev data path + DB seed + force flags#1491
Kitenite merged 4 commits intomainfrom
kitenite/worktree-dev-data-minimal

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Feb 14, 2026

Summary

  • move desktop workspace home path to env-driven SUPERSET_HOME_DIR with fallback to ~/.superset*
  • write SUPERSET_HOME_DIR=$PWD/superset-dev-data in setup-generated workspace .env
  • seed local SQLite DB files (local.db, -wal, -shm) into superset-dev-data/
  • ignore superset-dev-data/ in git
  • add -f/--force to setup: reset superset-dev-data/ before seeding
  • add -f/--force to teardown: remove superset-dev-data/

Scope

Only these files are changed:

  • .gitignore
  • .superset/setup.sh
  • .superset/teardown.sh
  • apps/desktop/src/main/lib/app-environment.ts

Validation

  • bash -n .superset/setup.sh
  • bash -n .superset/teardown.sh
  • bun --cwd apps/desktop test (passes)
  • bun run typecheck in apps/desktop (passes)

Summary by CodeRabbit

  • New Features
    • Added force-overwrite flag (-f/--force) and help option (-h/--help) to setup and teardown scripts.
    • Added local database seeding capability during setup.
    • Added optional development data directory cleanup during teardown.
    • Made Superset home directory configurable via environment variable.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 14, 2026

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) View Branch
Fly.io Electric (Fly.io) View App
Fly.io Streams (Fly.io) View App
Vercel API (Vercel) Open Preview
Vercel Web (Vercel) Open Preview
Vercel Marketing (Vercel) Open Preview
Vercel Admin (Vercel) Open Preview
Vercel Docs (Vercel) Open Preview

Preview updates automatically with new commits

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 14, 2026

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
Development Data Management
.gitignore
Added superset-dev-data/ to ignore list in Generated by setup.sh section.
Setup Script Enhancement
.superset/setup.sh
Added CLI argument parsing (-f/--force, -h/--help) with print_usage and parse_args functions. Introduced step_seed_local_db to seed local.db from $HOME/.superset/local.db with WAL checkpoint support. Updated step_write_env to export SUPERSET_HOME_DIR. Integrated seeding as Step 4 before Neon setup.
Teardown Script Enhancement
.superset/teardown.sh
Added CLI argument parsing with print_usage and parse_args functions. Introduced step_remove_dev_data to conditionally remove superset-dev-data/ directory. Added step tracking scaffolding for skipped/failed steps and summary printing.
Home Directory Configuration
apps/desktop/src/main/lib/app-environment.ts
Changed SUPERSET_HOME_DIR from hardcoded constant to environment-variable-driven with fallback to default path. Now reads and sets SUPERSET_HOME_DIR environment variable.
Event Type Mapping Refactoring
apps/desktop/src/main/lib/notifications/map-event-type.ts, apps/desktop/src/main/lib/notifications/server.ts, apps/desktop/src/main/lib/notifications/server.test.ts
Extracted mapEventType function into dedicated map-event-type.ts module. Updated server.ts to import from new module and removed inline implementation. Updated test imports accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • AviPeltz

Poem

🐰 A setup script hops with newfound grace,
Environment variables find their place,
Seeds the database, tears it down with care,
Home directory paths configured fair!
✨ Our warren of code, now cleaner and bright! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.79% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (23 files):

⚔️ .github/workflows/build-desktop.yml (content)
⚔️ .github/workflows/release-desktop-canary.yml (content)
⚔️ .github/workflows/release-desktop.yml (content)
⚔️ .gitignore (content)
⚔️ .superset/setup.sh (content)
⚔️ .superset/teardown.sh (content)
⚔️ apps/api/src/app/api/auth/desktop/connect/route.ts (content)
⚔️ apps/api/src/proxy.ts (content)
⚔️ apps/desktop/BUILDING.md (content)
⚔️ apps/desktop/RELEASE.md (content)
⚔️ apps/desktop/create-release.sh (content)
⚔️ apps/desktop/electron-builder.canary.ts (content)
⚔️ apps/desktop/electron-builder.ts (content)
⚔️ apps/desktop/src/lib/trpc/routers/auth/index.ts (content)
⚔️ apps/desktop/src/main/lib/app-environment.ts (content)
⚔️ apps/desktop/src/main/lib/auto-updater.ts (content)
⚔️ apps/desktop/src/main/lib/notifications/server.test.ts (content)
⚔️ apps/desktop/src/main/lib/notifications/server.ts (content)
⚔️ apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/WindowControls/WindowControls.tsx (content)
⚔️ apps/streams/src/routes/chunks.ts (content)
⚔️ apps/web/src/app/auth/desktop/success/components/DesktopRedirect/DesktopRedirect.tsx (content)
⚔️ apps/web/src/app/auth/desktop/success/page.tsx (content)
⚔️ packages/auth/src/server.ts (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main changes: environment-driven workspace dev data path, database seeding, and force flags added to setup/teardown scripts.
Description check ✅ Passed The description follows the template structure with clear summary, scope, and validation sections, but lacks explicit Type of Change selection and Testing section details.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/worktree-dev-data-minimal
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch kitenite/worktree-dev-data-minimal
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 a step_skipped entry when the flag is simply not set.

When -f is 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

Comment thread .superset/setup.sh
Comment on lines +521 to +533
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

--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.

Suggested change
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.

@Kitenite Kitenite merged commit 6885369 into main Feb 14, 2026
14 checks passed
@Kitenite Kitenite deleted the kitenite/worktree-dev-data-minimal branch February 14, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant