#7866·superset

Scripts editor splits a multi-line teardown into per-line commands, and the runner silently executes none of it

Author: l16iCreated Sep 25, 2026Updated Sep 26, 2026
Labelsbug

Where did this happen?

Desktop app (macOS)

Version

1.30.2

What happened?

My teardown is a small bash script: it deletes the Xcode DerivedData folders that belong to the worktree being removed. It lived in .superset/config.json as a single teardown entry and worked. After I opened the project's scripts editor and saved an edit in the Teardown tab, it stopped doing anything. Workspace deletes still succeed, but every one leaves its multi-GB DerivedData behind.

The editor rewrote my one entry as one entry per line. toCommandsArray in V2ScriptsEditor.tsx splits the textarea on \n, trims every line and drops the empty ones, so the script became:

json
"teardown": [
  "#!/bin/bash",
  "# Deletes Xcode DerivedData directories associated with a given worktree path.",
  "set -euo pipefail",
  "for dir in \"$DERIVED_DATA\"/*/; do",
  "…",
  "done"
]

The runner then treats each entry as a complete command. resolveTeardownCommand in teardown.ts joins them with && and runs exec bash -c '<joined>'. The first entry is a shebang, so the joined line is #!/bin/bash && # Deletes … && set -euo pipefail && …: one comment from end to end. Bash executes nothing and exits 0, and the teardown is recorded as a success.

Without a leading comment it still couldn't work: if … then && echo …, or a for … do whose body is on the next entry, isn't valid shell once joined. So the editor presents a free-form script textarea, but only a list of self-contained one-liners survives a save and a delete. The placeholder (bun install / bun run db:migrate) hints at that, but nothing says so, and nothing catches it:

  • The editor accepts and saves the script without warning.
  • The teardown exits 0, so the delete succeeds and no output is shown (teardown output only surfaces on failure).
  • The only symptom is what the script didn't clean up, found much later.

What I'd like is for the editor and the runner to agree on what a teardown is. Either save the textarea as one entry, so a script round-trips intact and one-liners keep working the same way, or keep one-command-per-line and say so in the editor, rejecting or warning on content that can't run that way (a leading #, lines that end mid-construct). .superset/teardown.sh would be the obvious thing to point people to for anything longer. Today it is only reachable by leaving the Teardown tab empty, which nothing in the UI mentions.

Steps to reproduce

  1. Put a multi-line bash script with a leading comment in .superset/config.json as a single teardown entry, e.g. "#!/bin/bash\n# cleanup\ntouch /tmp/teardown-ran".
  2. Open Project Settings → Scripts → Teardown. The script shows as multiple lines. Make any edit and let it autosave.
  3. cat .superset/config.json: the teardown is now one entry per line, trimmed.
  4. Create a workspace, then delete it.
  5. /tmp/teardown-ran does not exist, and the delete reported success.

Logs, screenshots, or recordings

No log lines: the teardown exits 0, so nothing is surfaced. The relevant code:

  • V2ScriptsEditor.tsx, toCommandsArray: value.split("\n").map((line) => line.trim()).filter((line) => line.length > 0)
  • teardown.ts, resolveTeardownCommand: buildTeardownCommandFromShell(resolved.commands.join(" && ")) → exec bash -c '<joined>'
  • setup/config.ts, resolveScript: a non-empty teardown array takes precedence over .superset/teardown.sh

Setup presumably goes through the same editor and loader and has the same exposure. I only hit it on teardown.