Refactor Docker -e passthrough handling into shared envutil walker#6034
Merged
lpcox merged 7 commits intoMay 19, 2026
Merged
Conversation
4 tasks
Copilot
AI
changed the title
[WIP] Refactor based on semantic function clustering analysis findings
Refactor Docker May 19, 2026
-e passthrough handling into shared envutil walker
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates Docker -e VAR passthrough argument detection into a single helper in internal/envutil, then reuses it to keep environment expansion behavior and launcher passthrough logging consistent as the Docker arg handling evolves.
Changes:
- Added
envutil.WalkDockerEnvArgsto centralize traversal of Docker passthrough env args (-e VAR, excluding-e VAR=valueand trailing-e). - Refactored
envutil.ExpandEnvArgsto delegate passthrough detection to the shared walker. - Refactored launcher passthrough logging to use the shared walker and added coverage for empty-but-present env vars.
Show a summary per file
| File | Description |
|---|---|
| internal/launcher/log_helpers.go | Replaces bespoke -e scanning with envutil.WalkDockerEnvArgs and logs empty-but-present vars distinctly. |
| internal/launcher/log_helpers_test.go | Adds a test to cover logging behavior when a passthrough variable is present but empty. |
| internal/envutil/expand_env_args.go | Introduces WalkDockerEnvArgs and refactors ExpandEnvArgs to reuse it. |
| internal/envutil/expand_env_args_test.go | Adds walker-focused tests for set/empty/missing vars and ignores explicit assignments/trailing -e. |
| AGENTS.md | Updates project structure note to reflect Docker env-arg utilities living in internal/envutil/. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced May 19, 2026
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.
Semantic clustering flagged duplicated Docker
-e VARpassthrough scanning inlauncherandenvutil. This change consolidates that traversal into one helper so expansion and logging stay aligned as Docker env-arg handling evolves.Shared env-arg traversal
envutil.WalkDockerEnvArgs(args, fn)to centralize detection of Docker passthrough args in the form-e VAR.-e VAR=valueand incomplete trailing-eflags are ignored by construction.ExpandEnvArgsnow delegatesinternal/envutil/expand_env_args.goto use the shared walker when building expanded-e VAR=valuepairs.VAR=valueargs while removing the duplicated loop skeleton.Launcher logging now delegates
internal/launcher/log_helpers.goto use the same walker for passthrough logging.Focused coverage
Docs
AGENTS.mdto reflect thatinternal/envutil/now owns Docker env-arg helper behavior in addition to general env utilities.