fix: Add pre-validation for Bedrock and MLflow role permissions - #6162
fix: Add pre-validation for Bedrock and MLflow role permissions#6162rsareddy0329 wants to merge 2 commits into
Conversation
Validate execution role permissions before submitting evaluation jobs to fail fast with actionable guidance instead of failing during execution. Reuses existing _simulate_denied_actions and _role_trusts_service from iam_role_resolver.py. Applies to all evaluators via BaseEvaluator.
|
Claude finished @rsareddy0329's task in 5m 52s —— View job Code Review: PR #6162 — Pre-validation for Bedrock/MLflow role permissions
The goal — fail fast with actionable guidance instead of 30 minutes into a job — is worthwhile, and the graceful-degradation and error-message handling are well done. However, there are a few correctness issues that can hard-fail jobs that would otherwise succeed, so I'd hold on merging until these are addressed. (Note: my environment doesn't have the inline-comment tool, so findings are collected below with file/line references.) 🔴 High — validation runs for all evaluators, but Bedrock trust applies only to some
The PR is scoped to "LLM-as-Judge evaluation jobs," but as written it also gates InspectAI (existing/create-endpoint modes), Benchmark, CustomScorer, and MultiTurnRL (which uses Bedrock AgentCore, not 🔴 High — MLflow (and likely Bedrock) actions are resource-scoped → false denials
This is exactly the trap the existing code documents and deliberately avoids — see 🟡 Medium — hard-raise diverges from the codebase's "warn, don't block" convention
🟡 Medium — depends on private cross-package helpers
Minor upside: passing 🟢 Low
Summary: the graceful-degradation paths and error messaging are good, but the unconditional placement in |
|
Claude finished @rsareddy0329's task in 3m 26s —— View job Code Review: Pre-validation for Bedrock/MLflow role permissionsI reviewed the diff (
🔴 1. Existing tests will now fail —
|
| def test_evaluation_trust_includes_bedrock(self): | ||
| """Evaluation role type should require bedrock.amazonaws.com trust.""" | ||
| expected = _expected_trust_services("evaluation") | ||
| assert "bedrock.amazonaws.com" in expected |
| def test_evaluation_trust_includes_sagemaker(self): | ||
| """Evaluation role type should require sagemaker.amazonaws.com trust.""" | ||
| expected = _expected_trust_services("evaluation") | ||
| assert "sagemaker.amazonaws.com" in expected |
Add 'evaluation' role type to IAM_POLICY_CONFIG with Bedrock and MLflow permissions. BaseEvaluator now calls resolve_and_validate_role with role_type='evaluation' which validates permissions and trust using the existing iam_role_resolver infrastructure. Removes the standalone role_permission_validator utility in favor of the existing centralized approach.
6d14e6e to
da692d2
Compare
|
Claude finished @rsareddy0329's task in 1m 42s —— View job Code Review: Pre-validation for Bedrock/MLflow role permissions
The That leaves the placement and trust concerns below. 🔴 High — the change is in the shared base class; it forces Bedrock permission + trust on every evaluator
Your 🔴 High — existing base-evaluator tests will fail
🟠 Medium — requiring
|
Add pre-validation for Bedrock and MLflow role permissions
Validate execution role permissions before submitting LLM-as-Judge evaluation jobs to fail fast with actionable guidance instead of failing during execution.
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.