Repository navigation
fix(compose): prevent silent flag consumption and shift crashes in stack resolver - #6797
Closed
vaibhavsrv wants to merge 1 commit into
Closed
vaibhavsrv wants to merge 1 commit into
vaibhavsrv wants to merge 1 commit into
Conversation
Collaborator
|
Thanks for this contribution. |
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.
Why this matters
In
ods/scripts/resolve-compose-stack.sh, flags expecting parameter values (--script-dir,--tier,--gpu-backend,--profile-overlays,--gpu-count,--ods-mode, and--skip-gpu-overlays) unconditionally performshift 2inside the argument parser without validating parameter existence. Underset -euo pipefail, omitting an argument causes the shell to fail abruptly onshift 2with an unhandled exit code 1 and no error output. Even worse, when a parameter-less flag is immediately followed by a boolean switch (for instance,resolve-compose-stack.sh --tier --env),${2:-$TIER}assigns the flag name"--env"toTIER, and the subsequentshift 2silently consumes--env, completely bypassing environment-variable emission mode and producing standard compose flags.This change inserts a surgical guard in the option loop verifying that parameter-requiring options have an actual value that does not start with a hyphen. If an argument is missing, empty, or another switch is passed, the script prints an informative diagnostic to stderr (
Option <flag> requires an argument) and exits cleanly with code 1. Existing resolution flows, valid flag combinations, and fallback defaults are completely preserved.Validation
ods/scripts/resolve-compose-stack.sh --tieraborted with unhandled status 1 onshift 2with no output. Executingods/scripts/resolve-compose-stack.sh --tier --envswallowed--env, assigned--envtoTIER, and exited 0 emitting compose arguments instead of environment variables.Option <flag> requires an argumenton stderr.test-resolve-compose-resilient.sh. New-test Ruff, ShellCheck, and diff checks pass; new regressions wired into Linux CI.Overlap check
resolve-compose-stack.sh.Risk / AI disclosure
AI-assisted investigation, implementation and CLI regressions. This strengthens a CLI check, not runtime admission. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.
Follow-up integration evidence
Composed with #6796 at e7f7869f948bfbc5ff0337e7d6beab964ebcff92 without conflicts. Production and test diffs passed together; preflight and compose resolver checks remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.