fix: reject blank model names before registration - #2607
Open
loyce-cheng wants to merge 1 commit into
Open
loyce-cheng wants to merge 1 commit into
loyce-cheng wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Description
When a model is configured through environment variables without
MLSERVER_MODEL_NAME, it can be loaded successfully under an empty name and cannot be addressed through the model API. Reject empty and whitespace-only names before model initialisation, load hooks, or registry changes.Name validation happens at registration so that file-based loading can still infer a missing or empty name from its directory, preserving the behaviour introduced in #190.
ModelSettings.nameremains optional until that resolution has taken place; valid names are not modified.Changes Made
InvalidModelName, anMLServerErrorwith status 422 and configuration guidance.MultiModelRegistry.load().Related Issues
Fixes #2382.
Validation
SIGQUITimport and non-uvloop event-loop-policy fixture issues. These launcher changes are not part of this PR.git diff --check, and mypy on the two changed production modules with--follow-imports=silentpassed.Checklist
Additional Notes
The real-server repository test is blocked locally by Windows
add_signal_handlersupport. Linux process/signal behaviour, the full runtime suites and the Python 3.9–3.12 CI matrix have not been validated locally.