Skip to content

fix(load-backend): reject missing option value for backend in load-backend-contract.sh - #5558

Open
vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/load-backend-contract-missing-value-guard
Open

vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/load-backend-contract-missing-value-guard

Conversation

@vaibhavsrv

@vaibhavsrv vaibhavsrv commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Why this matters

In ods/scripts/load-backend-contract.sh, the CLI argument parsing loop unconditionally executes shift 2 when encountering --backend. If --backend is passed as the final option without a value (for instance in automated scripts, test harnesses, or operator typos), Bash under set -euo pipefail halts with an unhandled shift count must be <= $# failure before reaching the explicit $BACKEND_ID validation check. This leaves callers with an empty diagnostic stderr and a confusing internal shell abort.

This patch adds an explicit parameter presence guard [[ $# -ge 2 ]] for --backend, writing an actionable diagnostic Missing value for argument: --backend to standard error and exiting with usage code 1. Existing options, contract file lookups, and Python environment extraction logic remain untouched.

Validation

  • Baseline: Invoking bash ods/scripts/load-backend-contract.sh --backend failed with internal shell shift error and empty diagnostic output.
  • Post-fix: Exits with code 1 and writes Missing value for argument: --backend to stderr; valid contracts continue to load and output expected shell exports.
  • Backend contract loader suites: 2 passed. New-test Ruff, 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 #6322 at 5662f0d without conflicts. Production and test diffs passed together; backend contract loader 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.

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.

1 participant