Skip to content

fix(compose): reject missing option arguments in validate-compose-stack.sh - #6447

Closed
vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/validate-compose-option-args
Closed

vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/validate-compose-option-args

Conversation

@vaibhavsrv

@vaibhavsrv vaibhavsrv commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Why this matters

In ods/scripts/validate-compose-stack.sh, the CLI argument parsing loop unconditionally executed shift 2 when encountering --compose-flags or --env-file. When either option was passed as the final argument without a corresponding parameter value, executing shift 2 under set -euo pipefail caused Bash to halt abruptly with an unhandled exit 1 and an empty standard error. Consequently, the script's intended check (ERROR: --compose-flags required) was never reached. Furthermore, passing an option without a value immediately before another supported flag (such as --compose-flags --quiet or --env-file --compose-flags) caused the parser to mistakenly swallow the subsequent flag as the argument value, suppressing the flag's effect and forwarding invalid configuration to Docker Compose.

This change introduces pre-shift parameter presence validation for both --compose-flags and --env-file. If an argument is missing, empty, or set to another option flag, the parser outputs an informative diagnostic (ERROR: <option> requires an argument) to standard error and exits cleanly with usage status 1. Valid arguments, combined flags, and downstream Docker Compose invocation contracts remain intact.

Validation

  • Baseline reproduction: Running bash ods/scripts/validate-compose-stack.sh --compose-flags or --env-file halted with unhandled exit code 1 and an empty standard error; passing --compose-flags --quiet silently swallowed --quiet into COMPOSE_FLAGS and attempted an invalid compose config.
  • Post-fix verification: Running ods/tests/test_validate_compose_stack_option_args.py confirms that missing, empty, or option-hijacking invocations fail with exit code 1 and output the appropriate ERROR: <option> requires an argument diagnostic, while valid invocations dispatch cleanly.
  • Telemetry statement: Compose validation suites: 6 passed, caller suites (test_support_bundle_timeouts): 10 passed. New-test PyCompile, ShellCheck, and diff checks pass; new regressions wired into Linux CI.

Overlap check

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 #6432 at 8ef7c1a without conflicts. Production and test diffs passed together; compose validation and diagnostic bundle 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.

@vaibhavsrv
vaibhavsrv force-pushed the fix/validate-compose-option-args branch from ce21032 to 1d7dd88 Compare September 23, 2026 15:12
@vaibhavsrv vaibhavsrv changed the title Fix/validate compose option args fix(compose): reject missing option arguments in validate-compose-stack.sh Sep 23, 2026
@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for this contribution. public-beta was promoted into main on 2026-09-24 and no longer receives changes, so we're closing pull requests that target it. This isn't a judgment on the change itself. If it's still needed, please rebase onto main and open a focused PR. See #7253 for details and the contribution policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants