Skip to content

feat(stack): require an explicit stack ID instead of guessing one - #2146

Merged
martin-helmich merged 2 commits into
masterfrom
feat/require-explicit-stack-id
Oct 7, 2026
Merged

martin-helmich merged 2 commits into
masterfrom
feat/require-explicit-stack-id

Conversation

@patrickhilker

@patrickhilker patrickhilker commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

TL;DR: Stack-aware commands no longer guess a stack. The stack ID must be passed via --stack-id/-s (or argument) or set in the context. The default-stack special handling is removed. This is a breaking change and will result in a major release.

Motivation

Projects no longer get a default stack, and existing default stacks can now be deleted. The CLI used to rely on the default stack in two ways:

  • container run, volume create and volume delete fell back to the project ID as stack ID when no stack was given. Without a default stack this fails with an opaque API error.
  • stack delete only emptied a project's default stack instead of deleting it.

The root cause is a design flaw in the CLI, not in the API: the API modelled stacks from the very beginning, so that the stack feature could later be introduced properly without breaking the API. The CLI, however, wrongly relied on every project always having a default stack (with the project ID as its stack ID). This change removes that assumption.

Additionally, all stack-aware commands silently picked a project's stack if it was the only one. Implicitly choosing a stack (e.g. for volume delete) is risky, and scripts relying on it break as soon as a second stack is created.

Changes

  • Remove optionalStackFlags / withStackIdOrDefault; container run, volume create and volume delete now use the regular stackFlags / withStackId
  • Remove the auto-selection of a project's only stack from withStackId
  • stack delete always calls deleteStack; --with-volumes is deprecated and has no effect
  • volume create checks that the stack belongs to the given project (the project ID was only used for the default-stack fallback before)

Breaking changes

  • container run, volume create, volume delete, stack deploy, stack ps, stack delete and stack template install fail with No stack ID given. Please specify one with --stack-id or set a default stack with 'mw context set --stack-id <stack-id>' if no stack ID is given via flag, argument or context — even if the project has only a single stack.
  • stack delete removes a project's default stack instead of emptying it.

Testing

yarn lint, yarn compile and yarn test pass. There are no existing tests covering stack resolution or the affected commands; the change was not tested against the live API. The docs in docs/*.md will be regenerated by the README workflow.

🤖 Generated with Claude Code

@patrickhilker
patrickhilker marked this pull request as ready for review September 29, 2026 19:25
@patrickhilker
patrickhilker requested a balanced review from Copilot September 29, 2026 19:25

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@martin-helmich martin-helmich changed the title feat(stack)!: require an explicit stack ID instead of guessing one feat(stack): require an explicit stack ID instead of guessing one Oct 7, 2026
@martin-helmich

Copy link
Copy Markdown
Member

Unclassified this as a breaking change; this is a breaking change in the product, not the CLI. Tagging this as a 2.x release will not magically keep the old 1.x releases working.

patrickhilker and others added 2 commits October 7, 2026 15:21
Commands operating on a container stack no longer pick a stack on their
own. The stack ID has to be passed via --stack-id/-s (or as argument) or
set in the context with `mw context set --stack-id`.

- remove the fallback to the project's default stack (project ID used as
  stack ID) from `container run`, `volume create` and `volume delete`
- remove the automatic selection of a project's only stack from all
  stack-aware commands
- `stack delete` now always deletes the stack, including a former default
  stack, instead of only emptying it; --with-volumes is deprecated and
  has no effect anymore
- `volume create` verifies that the stack belongs to the given project

BREAKING CHANGE: Commands that operate on a stack (`container run`,
`volume create`, `volume delete`, `stack deploy`, `stack ps`,
`stack delete`, `stack template install`) fail if no stack ID is given
via flag, argument or context, even if the project has only a single
stack. `stack delete` now removes a project's default stack instead of
emptying it.
@martin-helmich
martin-helmich force-pushed the feat/require-explicit-stack-id branch from ce5ed56 to eec1b8b Compare October 7, 2026 13:21
@martin-helmich
martin-helmich enabled auto-merge (squash) October 7, 2026 13:22
@martin-helmich
martin-helmich merged commit 18433d2 into master Oct 7, 2026
11 checks passed
@martin-helmich
martin-helmich deleted the feat/require-explicit-stack-id branch October 7, 2026 13:24
mittwald-machine added a commit that referenced this pull request Oct 8, 2026
# [2.0.0](v1.25.0...v2.0.0) (2026-10-08)

### Bug Fixes

* **deps:** pin @yarnpkg/core to 4.9.1 for npm installs ([#2154](#2154)) ([3b31935](3b31935))

### Features

* **stack:** require an explicit stack ID instead of guessing one ([#2146](#2146)) ([18433d2](18433d2))

### BREAKING CHANGES

* **stack:** and will result in a major release.

## Motivation

Projects no longer get a default stack, and existing default stacks can
now be deleted. The CLI used to rely on the default stack in two ways:

- `container run`, `volume create` and `volume delete` fell back to the
project ID as stack ID when no stack was given. Without a default stack
this fails with an opaque API error.
- `stack delete` only emptied a project's default stack instead of
deleting it.

The root cause is a design flaw in the CLI, not in the API: the API
modelled stacks from the very beginning, so that the stack feature could
later be introduced properly without breaking the API. The CLI, however,
wrongly relied on every project always having a default stack (with the
project ID as its stack ID). This change removes that assumption.

Additionally, all stack-aware commands silently picked a project's stack
if it was the only one. Implicitly choosing a stack (e.g. for `volume
delete`) is risky, and scripts relying on it break as soon as a second
stack is created.

## Changes

- Remove `optionalStackFlags` / `withStackIdOrDefault`; `container run`,
`volume create` and `volume delete` now use the regular `stackFlags` /
`withStackId`
- Remove the auto-selection of a project's only stack from `withStackId`
- `stack delete` always calls `deleteStack`; `--with-volumes` is
deprecated and has no effect
- `volume create` checks that the stack belongs to the given project
(the project ID was only used for the default-stack fallback before)

## Breaking changes

- `container run`, `volume create`, `volume delete`, `stack deploy`,
`stack ps`, `stack delete` and `stack template install` fail with `No
stack ID given. Please specify one with --stack-id or set a default
stack with 'mw context set --stack-id <stack-id>'` if no stack ID is
given via flag, argument or context — even if the project has only a
single stack.
- `stack delete` removes a project's default stack instead of emptying
it.

## Testing

`yarn lint`, `yarn compile` and `yarn test` pass. There are no existing
tests covering stack resolution or the affected commands; the change was
not tested against the live API. The docs in `docs/*.md` will be
regenerated by the README workflow.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

3 participants