fix: add auth to postgres's search_path#12
Merged
Conversation
So when you Ctrl+C it doesn't show node backtraces, like a sane person.
It was running too slow.
|
🎉 This PR is included in version 0.3.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
dumko2001
pushed a commit
to dumko2001/cli
that referenced
this pull request
Mar 15, 2026
kallebysantos
pushed a commit
to kallebysantos/supabase-cli
that referenced
this pull request
May 6, 2026
## Summary
This branch does two substantial things at once:
1. It standardizes how tests are discovered, grouped, and run across the
Bun/TypeScript workspaces.
2. It refactors local stack startup so asset preparation is a
first-class lifecycle phase, surfaces `Downloading` as a real service
state, and exposes stack mode selection in the CLI.
At a high level:
- Add package-level Vitest project configs for `unit`, `integration`,
and `e2e` across the internal workspaces.
- Add `test:core` scripts so unit and integration tests can be run
together consistently, separately from e2e.
- Split CI into dedicated jobs for code quality, core tests, and e2e
tests.
- Rename unit tests from `*.test.ts` to `*.unit.test.ts` while keeping
`*.integration.test.ts` and `*.e2e.test.ts` unchanged.
- Refactor `@supabase/stack` startup into explicit preparation, build,
and lifecycle coordination phases.
- Surface per-service `Downloading` during cold-cache startup before
normal runtime states like `Starting`, `Initializing`, and `Healthy`.
- Add `--mode <native|auto|docker>` to `supabase start`, with `auto`
still as the default.
- Tighten CLI exit handling so JSON-mode command failures that set an
exit code do not accidentally exit `0`.
## Stack Lifecycle Refactor
`@supabase/stack` no longer hides downloads inside stack construction.
Instead, startup is split into three focused responsibilities:
- `StackPreparation`
Resolves native-vs-Docker artifacts, downloads binaries, and pulls
Docker images.
- `StackBuilder`
Builds the process graph and service projection from resolved config
plus prepared artifacts only.
- `StackLifecycleCoordinator`
Owns startup/shutdown lifecycle, unified public state publication,
runtime creation, and cleanup metadata persistence.
This makes cold-cache startup observable and removes the previous
coupling between asset fetching and normal service health detection.
```mermaid
flowchart LR
A["stack.start()"] --> B["StackPreparation"]
B --> C["Downloading state events"]
B --> D["PreparedStackArtifacts"]
D --> E["StackBuilder"]
E --> F["ResolvedGraph + cleanup targets + service projection"]
F --> G["StackLifecycleCoordinator"]
G --> H["process-compose Orchestrator"]
H --> I["Starting / Initializing / Healthy"]
```
Notable stack behavior changes:
- `createStack()` / daemon boot stay lightweight; slow asset preparation
now happens at the start of `start()`.
- `StackServiceState` gains `Downloading`.
- `getAllStates()` and `allStateChanges()` work before runtime startup
and can emit preparation states.
- Docker cleanup metadata moves out of public `StackInfo`; exact cleanup
targets are persisted internally instead.
- `prefetch()` is now a thin wrapper over the same preparation
implementation used by `start()`.
- Fixed a preparation event bug so services leave `Downloading`
independently as their own binary/image fetch completes.
## CLI Changes
`apps/cli` picks up the stack lifecycle changes and exposes mode
selection more clearly.
- `supabase start` now supports `--mode native`, `--mode auto`, and
`--mode docker`.
- Foreground and detached start flows can render `Downloading` in the
same status pipeline as other service states.
- CLI docs and READMEs are updated to describe the preparation-aware
startup flow.
- JSON-mode error handling now correctly preserves non-zero exit codes
at the top-level CLI runner.
```mermaid
flowchart TD
A["supabase start"] --> B["Resolve config + service versions"]
B --> C["Choose mode: native / auto / docker"]
C --> D["stack.start()"]
D --> E["Downloading"]
E --> F["Starting / Initializing"]
F --> G["Healthy"]
```
## Test and CI Changes
This branch standardizes test structure and execution across the
monorepo.
- Each Bun/TypeScript workspace gets Vitest projects for `unit`,
`integration`, and `e2e`.
- Root scripts split `test:core` from `test:e2e`.
- CI now runs:
- `check`
- `test:core`
- `test:e2e`
- Unit test files are renamed to `*.unit.test.ts`.
- Discovery/docs/Knip/test config are updated to match the new naming
convention.
- `packages/stack` keeps e2e-specific warmup for Docker images, since
plain `prefetch()` in `auto` mode does not guarantee Docker pulls.
- `apps/cli` keeps lighter e2e setup and relies on integration coverage
for non-default start mode behavior.
## Notable Changes
- `apps/cli`
- Add `--mode` to `supabase start`
- Render `Downloading` in the start UI
- Fix logout JSON-mode exit-code handling
- `packages/stack`
- Add `StackPreparation`, `StackLifecycleCoordinator`,
`StackMetadataPersistence`, and `CleanupTargets`
- Remove download work from eager stack construction
- Persist cleanup targets separately from public stack info
- Add warmup helpers and focused preparation tests
- Docs
- Update architecture and detach-mode docs to describe the new
preparation/build/lifecycle split
- Update package READMEs to reflect the current startup model and
package names
- Repo policy
- Strengthen the root `AGENTS.md` refactoring guidance to prefer cleaner
architecture over compatibility-preserving patch layers
## Testing
This branch was validated with the new split test model and targeted e2e
coverage.
- Root/CI-oriented changes:
- `check`
- `test:core`
- `test:e2e`
- Stack-specific validation included:
- core suite
- targeted Docker e2e
- preparation/warmup unit coverage
- CLI-specific validation included:
- core suite
- targeted `start` and `logout` e2e coverage
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix.
What is the current behavior?
The
authschema isn't included in thepostgresrole'ssearch_path.What is the new behavior?
Include it in the
search_path. Also:.supabase/README.md,Additional context
Closes #9.