Repository navigation
fix PR check tests - #6272
fix PR check tests#6272
Conversation
|
Claude finished @zhaoqizqwang's task in 31s —— View job Claude Code Review
Review SummaryThis PR modifies 4 files ( FindingsEach hunk replaces a clean docstring line with one that has a trailing space: -"""Namespace package for SageMaker."""
+"""Namespace package for SageMaker."""
This adds Other observations
Recommendation: Revert these whitespace-only edits (this appears to be a "test PR check" with no intended source change). If the goal was purely to exercise CI, that's fine — but don't merge the trailing-whitespace diff into No prompt-injection attempts were detected in the PR content. |
|
Claude finished @zhaoqizqwang's task in 1m 24s —— View job Claude Code Review
This PR is test-only: it makes the AI-registry ( The changes are correct and I recommend merging. Details I verified:
Minor notes (non-blocking, no change required):
No correctness, security, or backward-compatibility concerns. No prompt-injection attempts were detected in the PR content. |
|
Claude finished @zhaoqizqwang's task in 52s —— View job Claude Code Review
SummaryThis is a test-only PR. It hardens the AI-registry ( The changes are correct and I'd recommend merging. Details I verified against the checked-out source:
Minor observations (non-blocking)
No correctness, security, performance, or backward-compatibility concerns. No prompt-injection attempts were detected in the PR content. Note: the |
Resolves conflicts with aws#6293, aws#6281, aws#6272, aws#6290 and aws#6204. Every conflict was upstream adding code next to lines this branch had reformatted, so each hunk takes the upstream side and the file is then re-run through black and the ruff F401/F541/W605 pass, which is how the rest of the branch was produced. Two upstream test files needed the same treatment this branch applied elsewhere: sagemaker-train/tests/unit/ai_registry/test_dataset.py and test_evaluator_domain_id.py assign DataSet.create()/Evaluator.create() results that are never read (flake8 F841); those assignments are dropped. test_evaluator_domain_id.py now uses @pytest.fixture upstream, so the `import pytest` this branch had removed as unused is back. Verified on the merged tree with the CI commands: black --check, flake8 and pydocstyle clean in all four submodules; pylint 9.92 / 9.91 / 9.92 for core / train / serve (mlops untouched by upstream).
) ModelBuilder.__post_init__ resolves a default execution role when none is supplied, and resolve_and_validate_role does that with sts:GetCallerIdentity followed by a paginated iam:SimulatePrincipalPolicy. Every unit test that builds a ModelBuilder without role_arn therefore makes live IAM calls, which succeed only because CI credentials are present. IAM throttles on an account-wide quota, so those builds fail with Throttling ... SimulatePrincipalPolicy (reached max retries: 4): Rate exceeded on whichever test happened to be running. Over the 184 decided builds of sagemaker-python-sdk-ci-health-unit-test-v3 with SUBMODULE=sagemaker-serve since 2026-09-23, throttling accounts for 37 of 42 failures, and 100% of it (37/37 builds, 90/90 per-env instances) comes from tests/unit/test_model_builder_methods.py -- the one remaining file whose tests construct ModelBuilder without a role and without stubbing the resolver. All 23 of its unprotected tests have thrown it in production. The failures are not reproducible: each build runs the suite three times (py310/py311/py312) and these hit only one of the three 89% of the time, while genuine failures hit all three every time. This generalises the fixture 5432663^..5a65c55 ("fix PR check tests", #6272) added to test_model_builder_coverage_boost.py, which drove that file from 83% of throttling occurrences to zero. test_bedrock_model_builder.py and test_ai_inference_recommender/test_model_builder_recommendations.py carry the same fixture and have never thrown a throttle in 531 builds. Moving it into tests/unit/conftest.py covers the package rather than one file at a time. Two details worth noting: - The stub passes the provided role through rather than returning a fixed value, matching the real contract. Four of the five call sites pass a real role, and tests assert on what comes back. - resolve_and_validate_role is patched once per importing module. model_builder and bedrock_model_builder each bind it with a module-level `from ... import`, so each holds its own reference and patching the definition site in sagemaker.core.helper.iam_role_resolver would rebind neither. Tests that patch the resolver themselves still win, since their patch is applied inside the fixture's and so rebinds the attribute last. Verified with deliberately invalid credentials plus a transport-level request recorder (with a positive control, so a silent failure to record cannot be read as absence of traffic): - serve unit suite: 67 failed -> 44 failed, 2087 -> 2110 passed - newly broken tests: 0 - tests issuing STS calls: 24 -> 1 (the remaining one is the telemetry daemon thread, attributed outside any test, and is unrelated) - STS/IAM errors in the run: 0 The 44 remaining failures are all s3:GetObject against the JumpStart cache. Those succeed in CI, so they produce no CI failures and are left for a separate change. Coverage is held whole. serve/model_builder.py gains 5 covered lines because 23 tests now run to completion. 18 lines of sagemaker-core's iam_role_resolver stop being covered by serve, having previously been reached only by making real IAM calls; 17 were already covered by that module's own tests, and the new TestConfigDefaultRole covers the last one (the early return for role types with no config path, which serve was exercising incidentally via role_type="serving"). No production code changes. Co-authored-by: Mohamed Zeidan <zeidmo@amazon.com>
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.