Skip to content

fix(stack): use shared local development defaults - #6705

Merged
jgoux merged 2 commits into
developfrom
fix/stack-development-defaults
Sep 23, 2026
Merged

jgoux merged 2 commits into
developfrom
fix/stack-development-defaults

Conversation

@jgoux

@jgoux jgoux commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Use the legacy local-development JWT secret and PostgreSQL encryption root key as defaults owned by @supabase/stack. The Effect API, Promise API, and experimental CLI use the same values when configuration is omitted; explicit overrides remain supported.

Apply these defaults consistently during database creation, composition, and restart, and supply the root key through a stack-owned file for native and container runtimes. This PR is limited to development defaults; new-stack snapshot reuse is deferred.

@jgoux
jgoux requested a review from a team as a code owner September 22, 2026 11:45
@jgoux jgoux self-assigned this Sep 22, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 AI Review

The 8 Claude findings and 1 Codex finding merge into 8 distinct findings. The shared migration finding is confirmed and raised to major: existing databases created without an explicit pgsodium root key can reopen with a different key, making encrypted data unreadable. Five maintainability or polish findings are confirmed, two findings are refuted by documented replacement semantics and Effect test behavior, and the timeout concern remains uncertain without runtime evidence.

Findings

Severity Location Category Sources Claim
🟠 MAJOR packages/stack/src/services/Database.ts:625 data-migration claude+codex Existing databases created without an explicit root key switch from their persisted generated pgsodium key to the static default on their next launch, potentially making Vault or pgsodium data unreadable.
⚪ NIT packages/stack/src/effect.ts:60 maintainability claude Database default normalization is duplicated across multiple API paths, including unknown-typed helpers, increasing the risk that the paths drift.
⚪ NIT packages/stack/src/Defaults.ts:2 duplication claude The new shared defaults leave byte-identical literals in the CLI, so the values can drift across packages.
⚪ NIT apps/cli/src/command-internal/stack-config.ts:940 readability claude The root-key fallback expression redundantly checks the same default outcome through separate empty-string and nullish branches.
⚪ NIT apps/cli/src/commands/experimental/stack/start/start.integration.test.ts:133 test-quality claude The fake stack duplicates production database-default normalization solely to adapt ServiceCreationInput to ServiceCreation, allowing the fixture to drift from the real stack API.
⚪ NIT packages/stack/src/defaults.integration.test.ts:37 test-reliability claude The 180-second timeout may be insufficient for each cold-cache native lifecycle test, which performs two PostgreSQL launch and readiness cycles.
Refuted findings (kept for transparency, not posted as review comments)
  • packages/stack/src/effect.ts:109 (api-design): Restarting with a database config that omits jwtSecret or rootKey incorrectly replaces existing custom values with package defaults instead of preserving them.
    Refuted: The documented contract treats a supplied restart config as a full replacement, not a patch, and explicitly assigns defaults to omitted secret inputs. Calling restart() without a config is the documented path that retains the stored configuration.
  • packages/stack/src/defaults.integration.test.ts:32 (test-quality): Throwing a raw Error in redactedValue produces an unhelpful Effect defect rather than a contextual test failure.
    Refuted: A throw inside Effect.gen and Effect.die are both represented as defects, so the surrounding examples do not establish different failure semantics. The thrown error also includes a descriptive message and stack location, and the trusted runtime-code convention does not prohibit a test-only narrowing helper.

Stats

Claude findings: 8 · Codex findings: 1 · Confirmed: 5 · Refuted: 2 · Uncertain: 1


Models: claude-opus-5 + gpt-5.6-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread packages/stack/src/services/Database.ts
Comment thread packages/stack/src/effect.ts
Comment thread packages/stack/src/Defaults.ts
Comment thread apps/cli/src/command-internal/stack-config.ts Outdated
Comment thread apps/cli/src/commands/experimental/stack/start/start.integration.test.ts Outdated
Comment thread packages/stack/src/defaults.integration.test.ts
@jgoux
jgoux added this pull request to the merge queue Sep 23, 2026
Merged via the queue into develop with commit 20773fd Sep 23, 2026
77 checks passed
@jgoux
jgoux deleted the fix/stack-development-defaults branch September 23, 2026 08:21
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.

2 participants