Skip to content

fix(devcontainer): persist profile selection - #1271

Draft
skevetter wants to merge 6 commits into
mainfrom
fix/issue-1268-multi-profile-workspace
Draft

skevetter wants to merge 6 commits into
mainfrom
fix/issue-1268-multi-profile-workspace

Conversation

@skevetter

Copy link
Copy Markdown
Contributor

Summary

Fixes #1268.

Persist explicit --devcontainer id:<profile> selection in workspace state and reuse it across lifecycle/config reconstruction. Effective selector precedence is current source/path/id, persisted source/path/id, last resolved config path for compatibility, then discovery. Selector replacements clear stale alternatives.

Adds focused unit coverage and a minimal Docker Compose multi-profile lifecycle regression (up id:max, stop, selector-free restart, delete).

Validation

  • go test ./pkg/devcontainer/... ./pkg/workspace ./pkg/provider ./cmd/workspace/... ./cmd/ci/...
  • task cli:lint:ci
  • git diff --check
  • E2E package compilation passed.

The focused E2E body was blocked by the existing Docker provider setup (provider add returned no diagnostic); the repository E2E task also has a macOS ARM GoReleaser path mismatch (darwin_arm64_v1 expected vs darwin_arm64_v8.0 produced). Pre-commit Go formatting was stopped after hanging for over four minutes; gofmt and CI-parity lint passed.

@netlify

netlify Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit a204922
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ab5dd4959800a0008121899

@coderabbitai

coderabbitai Bot commented Sep 24, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit a204922
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ab5dd495d286400088e4002

@github-actions

Copy link
Copy Markdown

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

skevetter and others added 5 commits September 24, 2026 20:29
…ntics

A workspace with an embedded devcontainer config and a legacy last-resolved
path kept reading from the filesystem after profile selection was
introduced; the last-path fallback now applies only when no embedded
config exists, restoring the previous behavior.

Workspace.DevContainerPath is now documented and used consistently as
relative to the workspace folder (content root including the git
subpath), while the last resolved path stays relative to the content
root. The generic subpath-stripping shim corrupted persisted paths whose
first segment matched the subpath; the exact conversion now applies only
to the legacy last-path fallback. Both regressions are pinned by tests
that fail without this change.

Also drops the no-op DevContainerID pass-through in the build command
(no flag can set it) and adds the missing nil guard on the git subpath
lookup.
Splits the legacy last-config-path fallback out of
effectiveDevContainerSelection to satisfy the cyclomatic complexity
limit, names the repeated test subpath, and wraps lines golines flags.
@skevetter
skevetter force-pushed the fix/issue-1268-multi-profile-workspace branch from 14294f3 to a204922 Compare September 25, 2026 02:32
The stored subpath can carry a leading slash (@subpath:/x/y) while the
last resolved path is always repo-relative, so filepath.Rel failed and
the subpath was applied twice on recreate/reset. This is the failure
up-workspaces showed on c14b895, now pinned by a test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unable to delete workspace containing multiple devcontainer profiles

1 participant