Skip to content

chore(infra): add Superset workspace setup/teardown scripts - #111

Merged
akadlec merged 8 commits into
mainfrom
chore/superset-workspace-scripts
May 31, 2026
Merged

chore(infra): add Superset workspace setup/teardown scripts#111
akadlec merged 8 commits into
mainfrom
chore/superset-workspace-scripts

Conversation

@akadlec

@akadlec akadlec commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds .superset/config.json so Superset workspaces provision this repo automatically on creation and clean up on deletion.

Commands were derived by inspecting the repo (pnpm workspace monorepo, Node 24+, Fastify server + Vite web, Docker-based HA dev stack):

  • setup./.superset/setup.sh
    • pnpm install --frozen-lockfile (corepack-enabled) for reproducible installs
    • Seeds .env only if missing: prefers the root repo's .env (carries HA_TOKEN), else falls back to the committed .env.example
  • runpnpm dev — builds shared/analyzer/generator/ha-client, then runs server + web in watch mode (restartable, doesn't block workspace creation)
  • teardowndocker compose -f dev/ha-stack.yml down — stops the local HA dev container if it was started

Implementation notes

  • Env seeding lives in a shell script (not inline) because it needs fallback logic.
  • The HA Docker stack is intentionally not in setup: its first-run flow is interactive (create an admin account, generate a long-lived token, save to .env), so it can't be brought up unattended. Developers start it on demand with pnpm dev:ha; teardown still cleans it up.

Risks / regression surface

  • None to application code or packaging — only adds a new .superset/ directory. No existing files changed.

Test evidence

  • config.json validated as parseable JSON.
  • setup.sh is committed executable (chmod +x).

🤖 Generated with Claude Code

Add .superset/config.json with setup, run, and teardown commands for
Superset workspaces:

- setup: ./.superset/setup.sh installs pnpm workspace deps with a frozen
  lockfile and seeds .env (root repo .env if present, else .env.example)
- run: pnpm dev (builds shared deps, runs server + web in watch mode)
- teardown: stops the local Home Assistant dev container if started

The HA Docker stack is intentionally left out of setup because its
first-run flow is interactive (account creation + long-lived token).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9fe4965e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .superset/config.json Outdated
@akadlec akadlec self-assigned this May 31, 2026
akadlec and others added 2 commits May 31, 2026 10:11
A blanket `docker compose -f dev/ha-stack.yml down` in teardown used the
default compose project (`dev`) and the hardcoded `lovelacer-dev-ha`
container, so deleting any workspace could stop the shared HA container
started by the main repo or another worktree.

Teardown now only stops HA when this workspace started it, tracked via a
gitignored `.superset/.ha-started` marker. Add `.superset/ha.sh up|down`
as the workspace-aware way to control the singleton HA stack and manage
the marker.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 120f566651

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .superset/ha.sh
The manual `./.superset/ha.sh down` path ran `docker compose down`
unconditionally, bypassing the `.superset/.ha-started` marker check and
risking stopping the shared lovelacer-dev-ha container owned by the main
repo or another workspace. It now refuses unless this workspace owns the
marker, and points to `pnpm dev:ha:down` as the explicit force path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06ae25a321

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .superset/ha.sh Outdated
`ha.sh up` wrote the ownership marker unconditionally, so running it while
the shared lovelacer-dev-ha singleton was already up (from the main repo
or another worktree) falsely claimed ownership — and a later guarded
down/teardown would then stop that other checkout's container. It now
bails out without touching Compose or the marker if the container is
already running, so the marker only ever reflects a container this
workspace actually started.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a8ed4bec0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .superset/setup.sh
…oken

setup.sh copies the root .env's HA_TOKEN, which is correct when the
workspace reuses the shared HA at localhost:8123 but stale if the
workspace starts its own fresh HA (empty per-worktree dev/ha-config).
ha.sh up now detects a fresh config and warns that the copied token
won't authenticate and must be regenerated; setup.sh documents the same
so the stale-token case is surfaced instead of failing silently.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a08bd49e92

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .superset/teardown.sh Outdated
A bare marker could go stale: if the workspace-owned container was
force-stopped (pnpm dev:ha:down) and another checkout later started
lovelacer-dev-ha, teardown would stop that other container. The marker
now stores the started container id; ha.sh down (and teardown, which
delegates to it) compares the stored id against the running container
and only stops it on an exact match, clearing the marker otherwise.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a3e71ce8d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .superset/ha.sh Outdated
The up guard used `docker ps` (running only), so a stopped/exited
lovelacer-dev-ha from another checkout slipped through: `compose up`
would restart it and this workspace would claim ownership of another
checkout's container. up now inspects for the container in ANY state and
only creates + claims ownership when none exists; if one already exists
it is left untouched, unless this workspace's marker already names that
exact container id (in which case it simply restarts its own).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@akadlec

akadlec commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

Re: the Codex review thread

Six rounds of automated P2 comments have all drilled into one theme: ownership of the optional, dev-only lovelacer-dev-ha singleton across worktrees. They've been useful — the wrapper now tracks ownership by container id and is safe across the running/stopped/stale-marker/force-stop permutations.

I'm treating any further edge-case comments on ./.superset/ha.sh ownership as out of scope / won't-fix for this PR, for these reasons:

  • ha.sh is a convenience wrapper developers may use instead of pnpm dev:ha. The project's own pnpm dev:ha / dev:ha:down scripts on main have no cross-worktree ownership guards at all, so this wrapper is already strictly safer than the existing baseline.
  • setup.sh never starts HA, so the default workspace lifecycle touches no shared container. Teardown only acts on a container this workspace provably created (id-verified) and is otherwise a no-op.
  • The remaining hypotheticals require a developer to manually mix ha.sh with out-of-band docker stop/pnpm dev:ha:down across multiple worktrees — at which point the documented pnpm dev:ha:down escape hatch is the right tool.

Happy to revisit if a reviewer flags a concrete failure in the default setup/run/teardown path. Thanks @chatgpt-codex-connector for the thorough pass.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@akadlec
akadlec merged commit 7f9b87c into main May 31, 2026
4 checks passed
@akadlec
akadlec deleted the chore/superset-workspace-scripts branch May 31, 2026 09:13
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