fix: forward tolerance flags from get_jumpstart_configs - #6137
Conversation
get_jumpstart_configs accepted no tolerate_vulnerable_model or tolerate_deprecated_model argument. It called verify_model_region_and_return_specs without them, so the callee fell back to its False defaults and re-ran the model gate. A caller that had asked to tolerate a flagged model still got VulnerableJumpStartModelError or DeprecatedJumpStartModelError, which made both flags unusable for that model. Add both parameters, default them to False to keep current behavior for existing callers, and forward them to verify_model_region_and_return_specs. Pass them from ModelBuilder._ensure_metadata_configs, which resolves the same configs lazily and had no way to opt out of the gate. --- X-AI-Prompt: Can you fix the dropped JumpStart tolerance flags in v3 too? X-AI-Tool: claude-code
|
Claude finished @evakravi's task in 44s —— View job PR Review: forward tolerance flags from
|
Issue #, if available: #6130
Description of changes:
Problem
get_jumpstart_configsaccepted notolerate_vulnerable_modelortolerate_deprecated_modelargument. It calledverify_model_region_and_return_specswithout them, so the callee fell back to itsFalsedefaults and re-ran the model gate. A caller that had asked to tolerate a flagged model still gotVulnerableJumpStartModelErrororDeprecatedJumpStartModelError, so both flags were unusable for exactly the models they exist to allow.In v3 the reachable caller is
ModelBuilder._ensure_metadata_configs, which resolves the same configs lazily and had no way to opt out of the gate. AModelBuildercarryingtolerate_vulnerable_model=Truestill failed on a flagged model, even though every other lookup in that class already forwards the flag.This blocks any release pipeline that deploys JumpStart models for validation. Such a pipeline has to deploy a model that is flagged, precisely because its job is to test that model.
The same gap exists in 2.x and is fixed by #6136. This PR is the v3 half.
Solution
Add
tolerate_vulnerable_modelandtolerate_deprecated_modeltoget_jumpstart_configsand forward both toverify_model_region_and_return_specs. Both default toFalse, so every existing caller keeps its current behavior and the gate still fires by default.Pass both from
_ensure_metadata_configs, using the samegetattridiom the surrounding call sites already use for these two flags, normalized to a bool so an unset attribute means "do not tolerate". A flagged model then resolves empty configs and the caller proceeds, which is the same outcome the flags already produce elsewhere.Testing done:
Six tests in
TestGetJumpstartConfigs. Two assert the flags reach the spec lookup that runs the gate, on the inference and training scopes. Two exercise the gate end to end throughJumpStartModelsAccessor.get_model_specs, confirming a vulnerable model and a deprecated model resolve configs instead of raising. Two are regression guards: the gate still raises for a vulnerable model by default, and the default forwarded value isFalse.Two more in
TestEnsureMetadataConfigscover theModelBuildercaller: tolerance reaches the lookup when set, and defaults toFalsewhen unset.Five of the six new
sagemaker-coretests fail before the change, on the dropped argument:Both new
sagemaker-servetests fail before the change:All pass after, with no regressions in either package:
Lint introduces nothing new.
flake87.1.2 reports the same 135 findings on the touched files before and after this change, all pre-existing and on lines this diff does not touch. Underblack26.3.1 the added lines are already formatted. All four touched files are reformatted by that version on unmodifiedmaster, so this diff deliberately leaves that pre-existing formatting alone rather than mixing an unrelated reformat into a bug fix.No integration test is included. Reproducing this requires a model whose published specs carry a vulnerability or deprecation flag, which is not something a test can provision, and the fix is a pure argument-forwarding change fully covered by unit tests.
Merge Checklist
General
Tests
unique_name_from_baseto create resource names in integ tests (if appropriate)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.