Skip to content

refactor(driver): dedupe docker lifecycle guards and command helpers - #1512

Merged
skevetter merged 1 commit into
mainfrom
refactor/docker-driver-lifecycle-helpers
Oct 17, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/docker-driver-lifecycle-helpers

Conversation

@skevetter

@skevetter skevetter commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add requireDevContainer for the container-not-found guard and use it in CommandDevContainer, StartDevContainer, StopDevContainer, GetDevContainerLogs, and UpdateContainerUserUID.
  • Add runLoggedDockerCommand for the log writer, debug line, and docker run block and use it in PushDevContainer, TagDevContainer, and CommitContainer.
  • CommitContainer keeps its container not found: workspaceID=%s message inline.
  • Error strings and rendered log text are unchanged.

Why

The Docker driver repeats the "container not found" guard six times and the log-writer plus docker-run block three times; a single requireDevContainer and runLoggedDockerCommand helper removes the duplication and mirrors the apple driver's requireDevContainer, without changing any error text or behaviour.

Validation

  • mkdir -p dist then task cli:format: pass, no files changed beyond the two in scope.
  • task cli:lint:ci: pass, 0 issues.
  • go test ./pkg/driver/docker/...: pass.
  • GOOS=windows go vet ./pkg/driver/docker/ and GOOS=linux go vet ./pkg/driver/docker/: pass.

CodeRabbit CLI

coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main): completed, 0 findings on pkg/driver/docker/lifecycle.go and pkg/driver/docker/useruid.go.

Auto-merge

Eligible: yes. 2 files, under 600 changed lines, no tests touched, no excluded paths, no //nolint added, no CLI/output/config/wire changes.

Summary by CodeRabbit

  • Bug Fixes
    • Docker container commands now handle missing containers consistently, with clearer error reporting.
    • Docker image push, tag, and commit operations provide consistent progress output while retaining operation-specific error details.

Add requireDevContainer for the container-not-found guard and runLoggedDockerCommand for the log-writer and docker run block used by push, tag, and commit. Error and log text are unchanged.
@skevetter skevetter added the auto-refactor Automated refactor PR label Oct 16, 2026
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a3074a57-4ad5-4810-b5ef-0787fda752bd
📥 Commits

Reviewing files that changed from the base of the PR and between 02aa279 and 9d7df77.

📒 Files selected for processing: 2
  • pkg/driver/docker/lifecycle.go
  • pkg/driver/docker/useruid.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The Docker driver now centralizes container lookup and logged Docker command execution. Lifecycle operations use the shared lookup helper. Push, tag, and commit use the shared command helper.

Changes: Docker lifecycle

Layer / File(s) Summary
Centralized container lookup
pkg/driver/docker/lifecycle.go, pkg/driver/docker/useruid.go
requireDevContainer handles lookup errors and missing containers. Lifecycle operations and UpdateContainerUserUID use it.
Logged Docker command execution
pkg/driver/docker/lifecycle.go
runLoggedDockerCommand logs command arguments and streams output to an info-level log writer. Push, tag, and commit use it while retaining their arguments and wrapped errors.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 9d7df

The Docker lifecycle refactor preserves the inspected behavior, with no concrete merge-blocking risk identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main changes: deduplicating Docker lifecycle guards and command helpers.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 Oct 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 9d7df77
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad2a3e157bf69a6c0943864

@netlify

netlify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

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

@skevetter
skevetter marked this pull request as ready for review October 17, 2026 02:07
@mergify

mergify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter
skevetter merged commit f265048 into main Oct 17, 2026
111 checks passed
@skevetter
skevetter deleted the refactor/docker-driver-lifecycle-helpers branch October 17, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-refactor Automated refactor PR size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant