Repository navigation
fix: sweep launch path silently drops CLI IAM flags (#539) - #541
Merged
Merged
Conversation
--iam-role/--iam-policy/--iam-policy-file/--iam-role-tags/ --iam-allow-full-access parsed successfully on `spawn launch --param-file` but were never read by the sweep path, so every sweep instance silently got the shared spored-instance-role. A wrong/missing IAM role means the workload dies on its first AWS API call with AccessDenied, which reads as a workload bug rather than a launch-flag bug. Resolves the flags into a real instance profile once per sweep (reusing the same CreateOrGetInstanceProfile logic launch_single.go's ensureIAMProfile uses per instance) and folds the result into sweep defaults, mirroring the #525 fix for CLI spend controls: this reaches both the foreground and detached (Lambda) orchestration paths, with a row's own iam_role: still outranking the CLI flag, which still outranks the file's defaults:. Adds Tier 0 e2e coverage (test/e2e/tier0_sweep_iam_test.go) asserting the resulting instance profile against a Substrate-launched sweep, including the row-overrides-CLI precedence case and the no-flags fallback regression guard. Verified fail-without/pass-with via git stash.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
spawn launch --param-file ...(the sweep path) accepted--iam-role,--iam-policy,--iam-policy-file,--iam-role-tags, and--iam-allow-full-accessbut never read them — every sweep instance silently got the sharedspored-instance-roleinstead, with no warning and exit 0. Same bug class as Sweep dispatch silently drops --cost-limit and --ttl, then logs "Using safeguards: ttl=..." #525 (CLI spend controls dropped on the sweep path), but worse: a wrong/missing IAM role means the workload dies on its first AWS API call withAccessDenied, which reads as a workload bug rather than a launch-flag bug, so the entire run's compute spend can produce zero result.CreateOrGetInstanceProfilelogiclaunch_single.go'sensureIAMProfileuses per instance — same validation, same audit logging) and folds the result into the sweep'sdefaults["iam_role"], mirroring the Sweep dispatch silently drops --cost-limit and --ttl, then logs "Using safeguards: ttl=..." #525 fix for spend controls. This reaches both the foreground and detached (Lambda orchestrator) paths through the existingiam_role:param-file key, with the established precedence: a row's owniam_role:> the CLI flag > the file'sdefaults:. A sweep with no CLI IAM flags and no file-leveliam_role:still falls back to the sharedspored-instance-role, unchanged from before this fix.applyCLIIAMToSweep), so the more useful fix was tractable.Test plan
test/e2e/tier0_sweep_iam_test.go: Tier 0 e2e coverage against the Substrate AWS emulator —TestTier0_SweepAppliesCLIIAMRole:--iam-rolereaches every sweep instance's actual IAM instance profile (asserted viaDescribeInstances), not the shared role.TestTier0_SweepAppliesCLIIAMPolicyFile:--iam-policy-fileis both named correctly AND its policy document is actually attached to the role (not just a same-named empty role).TestTier0_SweepRowIAMRoleBeatsCLI: a row's owniam_role:still outranks--iam-roleon the command line.TestTier0_SweepDefaultsToSharedRoleWithoutIAMFlags: regression guard — no CLI IAM flags still falls back to the sharedspored-instance-role.git stash: all three positive-case tests failed pre-fix with the bug's exact symptom (instance profile ARN referencingspored-instance-profileinstead of the requested role), and pass post-fix.test/e2eTier 0 suite passes (go test -tags=e2e_tier0 ./test/e2e/...), no regressions to the Sweep dispatch silently drops --cost-limit and --ttl, then logs "Using safeguards: ttl=..." #525/Unknown param-file keys silently become PARAM_* env vars — a mistyped or invented spend control caps nothing #526/--estimate-only is ignored on the foreground sweep path — --no-detach launches every row instead of estimating #524 sweep tests.make checkclean (fmt, vet, staticcheck pre-existing findings unrelated to this change, short tests).make check-docsclean — no flag help text was changed, sodocs-gen/needed no regeneration.CHANGELOG.mdupdated under## [Unreleased]→### Fixed, referencing --iam-role / --iam-policy / --iam-policy-file are silently ignored on the sweep path (0.100.4) #539.