Skip to content

feat(cli): use stack EphemeralPostgres for schema-tooling shadows - #6540

Draft
avallete wants to merge 15 commits into
developfrom
feat/stack-ephemeral-postgres
Draft

feat(cli): use stack EphemeralPostgres for schema-tooling shadows#6540
avallete wants to merge 15 commits into
developfrom
feat/stack-ephemeral-postgres

Conversation

@avallete

@avallete avallete commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

When [experimental].stack / SUPABASE_EXPERIMENTAL_STACK is on, db diff, db pull, declarative generate/sync, and migration squash use the project stack for --local and provision throwaway shadow Postgres through a new public @supabase/stack EphemeralPostgres API. Flag off keeps the legacy Docker SQL-template shadows.

The cluster is a scoped second instance (native host PGDATA or a named volume), not a listStacks identity. Snapshots are runtime-kind specific. Cache files live under stack-shadow-baseline-*.tar with the same keep-3 / 2-day TTL as the legacy namespace. The stack backend requires in-process pg-delta; --use-migra, --use-pgadmin, --use-pg-schema, and --diff-engine migra are rejected.

db reset --local and declarative --apply/--reset wipe Postgres through resetDatabase and then migrate or seed on stack credentials.

Stacked on #6517.

@avallete
avallete requested a review from a team as a code owner September 9, 2026 09:25
@avallete avallete added the run-ci Run full develop CI (tests) on drafts and non-develop PRs. label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@bcc62728d19c93a1cd748e7dd832c2a3c9c05f25

Preview package for commit bcc6272.

Comment thread apps/cli/src/commands/experimental/stack/stack-backend.ts Outdated
@avallete
avallete changed the base branch from feat/stack-command-options to feat/stack-options-develop September 11, 2026 15:46
When [experimental].stack is on, db diff/pull, declarative generate/sync,
and migration squash provision throwaway shadows through @supabase/stack
instead of legacy Docker SQL-template containers.
@avallete
avallete marked this pull request as draft September 11, 2026 16:10
The stack backend resolved --local through stack credentials, but only
pg-delta and squash runtimes provided the API, so migration up failed as
not running. Move shared stack helpers out of the experimental command
family, fail closed on local reset, skip Docker image inspect, and use
stack credentials for declarative --local.
When [experimental].stack is on, db start/reset/dump/test and squash use
stack credentials and resetDatabase instead of Compose. Native engines
use PATH pg_dump/pg_prove; docker engines keep the tool container.
…Postgres

Restored snapshots skip bootstrap, so the cache key now uses the same
internal database constants. Interrupt owns the cluster on the start
fiber so Postgres cannot stay bound, and remaining oxfmt drift is
formatted.
Base automatically changed from feat/stack-options-develop to develop September 11, 2026 17:04
…urces

Reuse the shadow-cache JSON helper, snapshot new error tags, and mask
container create-to-ID so Ctrl-C cannot orphan Docker/Podman objects.
@avallete
avallete force-pushed the feat/stack-ephemeral-postgres branch from bcc6272 to d34d089 Compare September 11, 2026 17:15
Keep develop's Effect-valued stack lifecycle API and re-apply resetDatabase,
postgres-only db start, and EphemeralPostgres on top of it.
db/migration and db-bootstrap cannot import experimental command internals,
and knip flagged an unused local-running probe.
Omitted runtime now probes Docker. Declarative local ensure uses the
postgres-only start helper so it cannot undo db start's overlay.
A failed first db start leaves an unconfigured identity; the retry must not
compile the full default stack.
Include the new command-internal stack modules in Effect lint, make
ephemeral Postgres start/stop Effect properties, and report PATH
pg_dump/pg_prove failures instead of a container exit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci Run full develop CI (tests) on drafts and non-develop PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants