chore(infra): add Superset workspace setup/teardown scripts - #111
Conversation
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>
There was a problem hiding this comment.
💡 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".
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>
There was a problem hiding this comment.
💡 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".
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>
There was a problem hiding this comment.
💡 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".
`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>
There was a problem hiding this comment.
💡 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".
…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>
There was a problem hiding this comment.
💡 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".
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>
There was a problem hiding this comment.
💡 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".
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>
Re: the Codex review threadSix rounds of automated P2 comments have all drilled into one theme: ownership of the optional, dev-only I'm treating any further edge-case comments on
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. |
|
To use Codex here, create an environment for this repo. |
Summary
Adds
.superset/config.jsonso 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):
./.superset/setup.shpnpm install --frozen-lockfile(corepack-enabled) for reproducible installs.envonly if missing: prefers the root repo's.env(carriesHA_TOKEN), else falls back to the committed.env.examplepnpm dev— builds shared/analyzer/generator/ha-client, then runs server + web in watch mode (restartable, doesn't block workspace creation)docker compose -f dev/ha-stack.yml down— stops the local HA dev container if it was startedImplementation notes
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 withpnpm dev:ha; teardown still cleans it up.Risks / regression surface
.superset/directory. No existing files changed.Test evidence
config.jsonvalidated as parseable JSON.setup.shis committed executable (chmod +x).🤖 Generated with Claude Code