Conversation
…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.
…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.
Contributor
There was a problem hiding this comment.
🤖 AI Review
Both independent reviews were available. Verified all five findings against the checked-out code and trusted conventions: one major rollback race, two minor concerns, and two nits. No findings overlapped.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟠 MAJOR | packages/stack/src/StackHost.ts:584 |
concurrency |
codex | Startup rollback can overwrite mutations committed by an attaching client because RPC becomes available before startup can no longer fail. |
| 🟡 MINOR | packages/stack/src/StackHost.ts:584 |
error-handling |
codex | Restoration failures are silently discarded, so failed startup can leave changed endpoint intents or claims persisted without reporting that rollback failed. |
| 🟡 MINOR | packages/stack/src/StackHost.ts:511 |
correctness |
claude | An endpoint intent change can produce a port-change report whose from and to numbers are identical, including text such as api: 26199 → 26199 and a matching endpoint_changes entry. |
| ⚪ NIT | apps/cli/src/commands/experimental/stack/start/start.handler.ts:505 |
code-quality |
claude | A stopped existing stack that reaches the normal start path resolves requested creations twice, repeating Functions dotenv reads when Functions is enabled. |
| ⚪ NIT | packages/stack/src/composition/EndpointReplan.integration.test.ts:54 |
comments |
codex | The new test comment contains implementation audit-trail language and exceeds the trusted repository convention for concise fixture explanations. |
Stats
Claude findings: 2 · Codex findings: 3 · Confirmed: 5 · 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.
…tart A rejected config change that mixed an editable key (e.g. a port) with a non-editable one (a catalog-pinned artifact or Postgres build) suggested reverting the editable key and dropped the non-editable change, but reverting it alone can't unblock start. Use the destroy-only wording whenever any non-editable change is present, and lead the change-list message with a sentence so it reads standalone in text output. Also document the `stack_changes`/`recreate_command` JSON contract and the intentional `--yes` omission, and make several integration-test assertions that lived inside `if (error instanceof StackCommandStartError)` fail loudly instead of passing vacuously for a different error type.
A changed endpoint on an otherwise-compatible instance now re-plans inside the stack package's own owner startup, while the new owner alone holds the stack's lease, instead of rejecting the start. It saves the updated endpoint intent as one document with the old port claim dropped, just before its own normal endpoint binding claims the requested port or a freshly chosen automatic one, reusing every check a live composition bind already applies. Any startup failure or interruption from that save onward restores the saved state and claims as they read before the re-plan. The CLI passes the requested creations into owner startup through a private file and reports each changed endpoint's old and new port in text, JSON, and stream-json output. A changed artifact version or PostgreSQL major version still fails before modifying the stopped composition.
… attach The saved document and its new endpoint claims now commit, and the rollback scope ends, before the owner serves RPC or publishes its holder, so a later startup failure can no longer undo an attached client's own change along with the re-plan. A restore failure now logs and appends recovery guidance to the original error instead of being swallowed, and an automatic re-plan that resolves back to its previous port is no longer reported as a change. The stopped-stack start handler also reuses the creations already resolved for the re-plan instead of reading the Functions dotenv a second time.
catchCause never ran on interruption, so an external interrupt landing after the prepared document saved but before the claim finished skipped the restore entirely, leaving the saved document with new intents and missing or partial claims. The commit now runs interruptibly under an uninterruptible mask whose restore attempt always runs on any unsuccessful exit, including interruption, and still only extends a genuine typed failure's message with recovery guidance when the restore itself also fails. Updates the ADR, package README, and start command's side-effects doc to describe the rollback as covering only the save-and-claim commit, which finishes before the owner serves RPC or publishes its holder; a later startup failure keeps the committed state and the next start reuses it.
jgoux
force-pushed
the
juliengoux/cli-2587-apply-configtoml-port-changes-when-a-stopped-stack-starts
branch
from
October 2, 2026 17:54
525601f to
d5fc82b
Compare
Base automatically changed from
juliengoux/cli-2588-name-the-changed-setting-and-the-fix-when-a-saved-stack
to
develop
October 2, 2026 18:33
# Conflicts: # apps/cli/src/commands/experimental/stack/start/SIDE_EFFECTS.md # apps/cli/src/commands/experimental/stack/start/start.handler.ts # apps/cli/src/commands/experimental/stack/start/start.integration.test.ts
This branch has not been deployed
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.
With
[experimental] stackenabled, changing a port inconfig.toml(including removing the fixed ports a legacysupabase initwrites) used to make the nextsupabase startfail with "cannot change on the saved stack". The only way out was to destroy the stack and lose its data. Now, when a stopped stack starts, it applies endpoint port changes and prints each one, for exampleapi: 54321 → 26199.ADR 0017 is amended: saved ports stay stable unless the configuration deliberately changes them on a stopped stack.