Skip to content

Rename shadowed --version on sagemaker image version waiters - #10756

Open
GarrettBeatty wants to merge 1 commit into
v2from
sagemaker-waiter-version-rename
Open

GarrettBeatty wants to merge 1 commit into
v2from
sagemaker-waiter-version-rename

Conversation

@GarrettBeatty

Copy link
Copy Markdown

Summary

aws sagemaker wait image-version-created and aws sagemaker wait image-version-deleted
exposed the DescribeImageVersion Version member as --version. The CLI resolves
global options before command arguments, so --version is always captured by the
global --version option and the waiter parameter can never be used:

$ aws sagemaker wait image-version-created --image-name my-image --version 3
aws-cli/2.x.x Python/3.x ...   # prints the CLI version and exits

The corresponding operations (describe-image-version, delete-image-version,
update-image-version, list-aliases) already rename this parameter to
--version-number in argrename.py. Waiter commands emit
building-argument-table.wait.<waiter-name> rather than
building-argument-table.sagemaker.<operation>, so that rename never applied to the
waiters.

Changes

  • Add ARGUMENT_RENAMES entries for the two waiters (--version -> --version-number).
  • Add matching entries to handlers_registry.py so the lazily initialized
    register_arg_renames handler is loaded for these waiter events.
  • Add functional tests that both waiters accept --version-number and send it as
    Version.

This is not backwards-incompatible: the waiters' --version was unreachable, so no
working invocation changes.

Context

Found by the extended builtin-shadowing audit in #10700 (CLI-9380), which now walks the
full command tree, including waiters. #10700 is stacked on this PR, so it can be merged
without needing an allowlist for these two commands.

Testing

  • tests/functional/sagemaker/test_waiters.py: new tests fail before this change
    (Unknown options: --version-number) and pass after.
  • tests/unit/customizations/test_argrename.py, tests/unit/test_lazy_emitter.py,
    tests/functional/test_handlers_registry.py, tests/functional/test_lazy.py,
    tests/functional/docs: 11,871 passed.

The `sagemaker wait image-version-created` and `image-version-deleted`
waiters exposed the DescribeImageVersion `Version` member as `--version`,
which is captured by the global `--version` option before the waiter's
arguments are parsed, so it could never be used. The corresponding image
version operations already rename it to `--version-number`, but waiter
argument tables emit `building-argument-table.wait.<waiter>`, so that
rename never applied to them.

Add the waiter renames (and their lazy handler registry entries) so the
waiters accept `--version-number`, consistent with the operations.
@GarrettBeatty
GarrettBeatty force-pushed the sagemaker-waiter-version-rename branch from fe4c4de to 635d844 Compare October 14, 2026 16:50

This branch has not been deployed

No deployments
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