fix: close two workspace-delete volume leaks - #1112
Conversation
✅ Deploy Preview for devsydev canceled.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
✅ Deploy Preview for images-devsy-sh canceled.
|
|
If you're new to commit signing, there are different ways to set it up: Sign commits with
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 8 |
| Duplication | 3 |
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
Problem
devsy workspace deleteleaks docker volumes in two independent ways:DockerHelper.Removerunsdocker rmwithout-v, so any anonymous volume attached to the container (imageVOLUMEdirectives, unnamed devcontainer.json mounts) survives.cleanupDeliveryVolumelogs cleanup failures at Debug level, so a failed volume removal is indistinguishable from success unless--debugwas already on.A third suspected leak (imported/attached-container workspaces never cleaning up the agent volume) was investigated and ruled out: that volume is only ever created for newly-created containers (via
resolveNewContainer's pre-start delivery), never for imported ones (which use shell-basedlegacyInjectinstead), so there is nothing to leak there.Fix
docker rm -vinpkg/docker/helper.go.Tests
Each fix has a dedicated test written first against the pre-fix code to confirm it reproduces the issue, then passing after the fix:
e2e/tests/down/down.go(workspace delete removes anonymous volumes declared by the image)pkg/devcontainer/delete_test.go(TestCleanupDeliveryVolume_LogsWarningOnFailure)Verification note
This sandbox has no docker daemon available, so the new e2e spec could only be verified by compilation (
go build/go vetclean) and static review against existing e2e conventions (e2e/tests/down,e2e/tests/up), not by an actual RED→GREEN run. Thepkg/dockerandpkg/devcontainerunit test suites (no real daemon required) all pass, including the newTestCleanupDeliveryVolume_LogsWarningOnFailure. Please confirm the e2e spec flips from failing to passing with fix #1 in an environment with docker before merging.