Remove dead IAM bootstrap block from deploy.sh#19
Merged
Conversation
The post-canary IAM block attempted \`aws iam get-role alpha-engine-data-role\` as a "create if missing" bootstrap, then fell through to CreateRole when the get-role call failed. This was dead code with a silent-fail trap inside it: 1. \`alpha-engine-data-role\` already exists in AWS and is the live Lambda's execution role. The get-role check should succeed and exit the branch as a no-op — it never actually needs to create anything. 2. The deploy.sh header already documents the role as a prerequisite. The bootstrap block contradicted that contract. 3. \`&>/dev/null\` swallowed any non-zero exit from get-role, including "permission denied" from the github-actions-lambda-deploy role (which correctly lacks iam:* permissions). The branch then interpreted "permission denied" as "role does not exist" and tried to create it, which failed explicitly with iam:CreateRole AccessDenied. Today's auto-deploy after PR #18 merged surfaced all of this: the Lambda itself deployed successfully (version 4 live, canary passed), but the workflow failed at the dead IAM step and marked the run red. Fix: delete the entire block. Replace with a comment explaining the role is a one-time out-of-band provisioning concern, ideally extended into \`infrastructure/iam/\` the same way #17 did for github-actions-lambda-deploy. This also aligns with the no-silent-fails rule: any future IAM provisioning that belongs in this path should fail loudly, not fall through a pattern-matching check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Delete the `Checking IAM role: alpha-engine-data-role` bootstrap block at the end of `infrastructure/deploy.sh`. It's dead code with a silent-fail trap inside it, and it broke today's auto-deploy after the Lambda itself had already succeeded.
Context
Today's Deploy workflow run (triggered by #18 merge) produced:
```
Alias 'live' -> version 4
Canary passed (status=OK) ← Lambda deploy SUCCEEDED
Checking IAM role: alpha-engine-data-role...
Creating IAM role... ← dead-code path
Error: ... iam:CreateRole ... AccessDenied
```
Two layers:
Dead code. `alpha-engine-data-role` has existed in AWS for months and is the live Lambda's execution role. The get-role check at line 203 should always succeed in steady state. The entire `else` branch (create role + attach inline policy) has never fired in steady state and never should. The header comments already list the role as a prerequisite.
Silent fail inside the dead code. The `aws iam get-role` call was followed by `&>/dev/null`, which swallows BOTH "role not found" and "permission denied". The deploy role (`github-actions-lambda-deploy`) intentionally lacks `iam:*` permissions (principle of least privilege). So the check treated every permission denial as "role doesn't exist" and fell through to CreateRole, which then failed explicitly. Classic no-silent-fails antipattern at the IAM layer.
Fix
Delete the whole block. Replace with a comment explaining that the role is a one-time out-of-band provisioning concern. The version-controlled IAM pattern added in #17 (`infrastructure/iam/apply.sh`) is the right home for any future provisioning; this deploy path should never touch IAM.
Impact
Test plan
🤖 Generated with Claude Code