fix: config validates device/EP combination without system check#780
Merged
Conversation
added 2 commits
May 28, 2026 15:21
Collaborator
Code reviewFound 1 issue:
winml-cli/src/winml/modelkit/commands/config.py Lines 441 to 445 in dd79c41 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
timenick
reviewed
May 28, 2026
timenick
left a comment
Collaborator
There was a problem hiding this comment.
One nit on the new helper. The design intent is clear and well-documented in the PR description; only flagging this because the function returns the same tuple shape from two paths with different semantics.
Contributor
Author
for a resolved device, there should always be ep |
timenick
approved these changes
May 28, 2026
DingmaomaoBJTU
pushed a commit
that referenced
this pull request
Jun 5, 2026
## Summary - Adds `resolve_check_device_ep` helper that validates a (device, EP) combination without requiring the device/EP to actually exist on the system. Closes #765. - `commands/config.py` and `config/build.py` now use `resolve_check_device_ep` instead of `resolve_device` so `winml config` no longer hard-fails on hosts where the requested EP isn't installed. - When `device=auto` or `ep=None`, the helper delegates to the existing `resolve_device` + `resolve_eps` flow (system-aware behavior preserved). When both `device` and `ep` are explicit, it only validates against the static `EP_SUPPORTED_DEVICES` mapping. - CLI cleanup: `-m/--model`, `-c/--config`, `--device` for the config command now use the shared `cli_utils.*_option` decorators. ## Tests - New `TestResolveCheckDeviceEp` class in `tests/unit/sysinfo/test_device.py` covering both code paths (delegation and static-only) plus error cases (unknown EP, unsupported device, case-insensitivity). - Existing config-test mocks updated from `resolve_device` to `resolve_check_device_ep` (`tests/unit/config/conftest.py`, `tests/unit/config/test_build.py`, `tests/unit/config/test_build_onnx.py`, `tests/unit/commands/test_config_cli.py`) so the lazy import in `config/build.py` is intercepted. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: hualxie <hualxie@microsoft.com>
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.
Summary
resolve_check_device_ephelper that validates a (device, EP) combination without requiring the device/EP to actually exist on the system. Closes config: should not use resolve_device #765.commands/config.pyandconfig/build.pynow useresolve_check_device_epinstead ofresolve_devicesowinml configno longer hard-fails on hosts where the requested EP isn't installed.device=autoorep=None, the helper delegates to the existingresolve_device+resolve_epsflow (system-aware behavior preserved). When bothdeviceandepare explicit, it only validates against the staticEP_SUPPORTED_DEVICESmapping.-m/--model,-c/--config,--devicefor the config command now use the sharedcli_utils.*_optiondecorators.Tests
TestResolveCheckDeviceEpclass intests/unit/sysinfo/test_device.pycovering both code paths (delegation and static-only) plus error cases (unknown EP, unsupported device, case-insensitivity).resolve_devicetoresolve_check_device_ep(tests/unit/config/conftest.py,tests/unit/config/test_build.py,tests/unit/config/test_build_onnx.py,tests/unit/commands/test_config_cli.py) so the lazy import inconfig/build.pyis intercepted.🤖 Generated with Claude Code