Skip to content

feat(cli): enable lazy local stack startup - #6071

Closed
jgoux wants to merge 3 commits into
lazy-stack-v2/02-runtimefrom
lazy-stack-v2/03-cli-lazy-startup
Closed

feat(cli): enable lazy local stack startup#6071
jgoux wants to merge 3 commits into
lazy-stack-v2/02-runtimefrom
lazy-stack-v2/03-cli-lazy-startup

Conversation

@jgoux

@jgoux jgoux commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Replacement stack 3 of 3, based on #6070.

Stack: #6069#6070#6071

Makes lazy startup the policy for CLI-managed stacks while keeping the package default eager:

  • maps CLI start, branch switching, and Functions development through the shared lazy stack configuration
  • treats a completed lazy startup phase as sufficient to display connection details
  • keeps one gated live test for the real daemon, proxy, Docker, and first-request activation boundary
  • documents that Realtime remains eager while HTTP services activate through the proxy

The separate test-only commit isolates the legacy SSO integration suite from host keyring state discovered during the full regression run; it does not affect runtime behavior.

Supersedes #6047

@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: 6f3f0aeea9

ℹ️ 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".

home: home.dir,
});
expect(before.exitCode, `stdout:\n${before.stdout}\nstderr:\n${before.stderr}`).toBe(0);
expect(before.stdout).toContain("auth: Pending");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Expect Dormant for lazy services before activation

In the live lazy-start scenario, supabase status reads the stack's projected service states, and lazy services that have not been activated are normalized from raw inactive Pending/Stopped into Dormant (see StackStateProjection and the lazy startup unit tests that assert auth is Dormant after stack.start()). After this start --detach, auth should therefore be printed as auth: Dormant, so this assertion will fail the live suite before it ever exercises the first proxied request.

Useful? React with 👍 / 👎.

"keeps an HTTP service dormant until its first proxied request",
{ timeout: START_TIMEOUT_MS + 120_000 },
async () => {
project = await makeTempStackProject("supabase-lazy-start-live-");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Initialize the live stack project through the CLI

For local-dev-stack live tests, the workspace guidance expects creating a temp project and running runSupabaseLive(["init"], { cwd }) before start, so the test covers the real generated supabase/config.toml and normal project setup path. This path seeds only .supabase/stacks/default/stack.json via makeTempStackProject, so the live test can pass while regressions in initialized-project config loading or startup setup are missed; please create a temp dir and invoke init before starting.

AGENTS.md reference: apps/cli/AGENTS.md:L445-L445

Useful? React with 👍 / 👎.

@jgoux
jgoux marked this pull request as ready for review August 5, 2026 07:18
@jgoux
jgoux force-pushed the lazy-stack-v2/02-runtime branch from f5a641c to b874f95 Compare August 5, 2026 07:34
@jgoux
jgoux force-pushed the lazy-stack-v2/03-cli-lazy-startup branch from 9ff0201 to e55f7a3 Compare August 5, 2026 07:34

jgoux commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Consolidated into #6072 to simplify review and merging.

@jgoux jgoux closed this Aug 5, 2026
pull Bot pushed a commit to oogalieboogalie/cli that referenced this pull request Aug 5, 2026
Consolidates the complete lazy-stack v2 implementation and its
architecture hardening into one reviewable change.

The implementation replaces the earlier user-space coordination
protocols with explicit ownership boundaries and operating-system
primitives:

- centralizes Docker and native artifact policy in one service catalog
- publishes complete native caches through private staging directories
and atomic rename
- models lifecycle intent directly on each service as inactive, running,
or explicitly stopped
- activates HTTP services at the existing proxy boundary while keeping
direct-listener services eager
- reserves real TCP ports until each service reaches its spawn boundary
- gives foreground and detached stacks the same allocation, readiness,
and lifecycle behavior
- enables lazy startup for CLI-managed local stacks while preserving
eager startup as the package default

The hardening pass makes each service's stable state stream the single
lifecycle coordination primitive, removes generation-specific waiter and
relaunch machinery, keeps healthy requests off the global lifecycle
lock, starts independent eager roots concurrently, recovers incomplete
artifact-cache destinations, and makes service port mappings exhaustive.

This keeps the simpler v2 architecture while closing the highest-impact
concurrency, recovery, and shutdown races identified during review.
Realtime remains eager because the HTTP proxy does not bridge its
WebSocket traffic, and concurrent artifact downloaders may duplicate
work while still publishing through an atomic winner.

Supersedes supabase#6041
Supersedes supabase#6042
Supersedes supabase#6043
Supersedes supabase#6044
Supersedes supabase#6045
Supersedes supabase#6046
Supersedes supabase#6047
Supersedes supabase#6069
Supersedes supabase#6070
Supersedes supabase#6071
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