Skip to content

fix(cli): name the changed setting and the fix when a saved stack rejects a config change - #6944

Open
jgoux wants to merge 5 commits into
developfrom
juliengoux/cli-2588-name-the-changed-setting-and-the-fix-when-a-saved-stack
Open

jgoux wants to merge 5 commits into
developfrom
juliengoux/cli-2588-name-the-changed-setting-and-the-fix-when-a-saved-stack

Conversation

@jgoux

@jgoux jgoux commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

When supabase start (with [experimental] stack) refuses a change to a saved stack, the error now says which setting changed and what to do about it. It used to report internal paths such as endpoints.http with a generic suggestion.

  • Each rejected change is reported as the config.toml key, or the SUPABASE_* environment variable that set it, with the saved and requested values. For example: [db] major_version: saved 17, requested 15, or [api] port: saved 54321, requested automatic.
  • Changes across all affected services are reported together in one error. A shared [api] port appears once.
  • The suggestion offers two ways out: revert the setting to keep the stack and its data, or run supabase stack destroy --stack-id <id> to recreate it. It warns that recreating deletes the local database data. The ID is used so the command targets this stack regardless of the current directory.
  • JSON and stream-json errors carry the same details in structured form (stack_changes with service, path, key, saved and requested values, plus recreate_command), so agents don't have to parse prose.

Port settings are now defined once in stack-config.ts, shared by config translation and error attribution, so a new port can't be added to one and missed in the other. The tests use the real composition planner.

jgoux added 2 commits October 1, 2026 10:17
…ects a config change

Maps each incompatible plan path (endpoint port, db major version) to the
config.toml key or SUPABASE_*_PORT env var that set it, shows the saved and
requested values, and suggests reverting it or running the stack's exact
destroy command with a data-loss warning.
…mplete

Always suggest the exact --stack-id destroy command instead of an unquoted
--stack <name> that re-resolves against the caller's current workdir, carry
structured per-change records (service, path, key, saved, requested) plus
the recreate command on the JSON/stream-json error envelope via
MachineErrorContext, and collect every incompatible member into one error
instead of reporting only the first, deduplicating shared API port lines.

Use the production planSupabaseComposition planner in the start handler's
integration tests instead of a hand-rolled approximation, and derive the
port-setting table and createCreations' env-override calls from one shared
definition per port to prevent drift.
@jgoux
jgoux requested a review from a team as a code owner October 1, 2026 13:02
@jgoux jgoux self-assigned this Oct 1, 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

Verified all 10 supplied findings against the checked-out code and trusted conventions. Three overlapping pairs merge into seven confirmed findings: two minor error-guidance issues and five nits. Full PostgreSQL pins can produce identical displayed major versions despite an incompatibility, and artifact-version mismatches receive advice to revert a setting the CLI does not expose. No critical or major issue was established. Locations below use the actual new-side line numbers.

Findings

Severity Location Category Sources Claim
🟡 MINOR apps/cli/src/commands/experimental/stack/start/start.handler.ts:229 error-messages claude When saved and requested PostgreSQL pins differ within the same major version, the error displays identical major versions and suggests reverting a major_version setting that already matches.
🟡 MINOR apps/cli/src/commands/experimental/stack/start/start.handler.ts:328 error-handling claude+codex Artifact-version mismatches receive instructions to revert a setting that has no config.toml key or environment override in the CLI.
⚪ NIT apps/cli/src/commands/experimental/stack/start/start.handler.ts:328 wording claude+codex Multiple changed settings produce the grammatically incorrect suggestion 'Revert the settings above to its saved value', although the changes are joined inline.
⚪ NIT apps/cli/src/command-internal/stack-config.ts:173 documentation claude+codex The PortSetting comment promises automatic consistency between creation wiring and endpoint-setting lookup that the implementation does not enforce.
⚪ NIT packages/stack/src/effect.ts:71 api-surface claude The PR adds a planner re-export to the main Effect entrypoint for a new consumer that exists only in a CLI integration-test fake.
⚪ NIT apps/cli/src/commands/experimental/stack/start/start.handler.ts:299 code-quality claude destroyCommandFor accepts an unused name property, and the same rejection constructs the destroy command separately for prose and structured output.
⚪ NIT apps/cli/src/commands/experimental/stack/start/start.handler.ts:177 comment-style codex The new internal-helper comments narrate implementation mechanics prohibited by the trusted repository comment policy.

Stats

Claude findings: 6 · Codex findings: 4 · Confirmed: 7 · Refuted: 0 · Uncertain: 0


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

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

Comment thread apps/cli/src/commands/experimental/stack/start/start.handler.ts Outdated
Comment thread apps/cli/src/commands/experimental/stack/start/start.handler.ts Outdated
Comment thread apps/cli/src/commands/experimental/stack/start/start.handler.ts Outdated
Comment thread apps/cli/src/command-internal/stack-config.ts Outdated
Comment thread packages/stack/src/effect.ts Outdated
Comment thread apps/cli/src/commands/experimental/stack/start/start.handler.ts Outdated
Comment thread apps/cli/src/commands/experimental/stack/start/start.handler.ts Outdated
jgoux added 3 commits October 1, 2026 15:18
…name-the-changed-setting-and-the-fix-when-a-saved-stack
…in the stack error

Same-major Postgres version differences and catalog-pinned artifact versions have
no config.toml key or env var, so the incompatible-stack error no longer suggests
reverting major_version or an editable setting for them: it names the full saved
and requested builds, drops the revert sentence when nothing is editable, and
explains the fix in plain language. Mixed rejections keep the revert advice for
the editable keys only, with singular/plural grammar matching their count.

destroyCommandFor now takes only the stack id (it never read the name) and is
computed once per rejection, reused for both the error suggestion and the
JSON/stream-json envelope's recreate_command.

Move planSupabaseComposition's export from the main @supabase/stack/effect
entrypoint to @supabase/stack/testing, since the CLI only needs it to build a
realistic test double for its own composition plan.

This branch has not been deployed

No deployments
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