Skip to content

fix: check deploy_lambda() inputs before pushing the image - #59

Merged
novica merged 2 commits into
mainfrom
fix--deploy-input-checks
Nov 1, 2026
Merged

novica merged 2 commits into
mainfrom
fix--deploy-input-checks

Conversation

@novica

@novica novica commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Several input mistakes surfaced only after the slow ECR push, and some left resources behind.

  • deploy_lambda() checks the ARN format of role_arn (arn:aws…:iam::<12 digits>:role/…) and policy_arns (arn:aws…:iam::(aws|<12 digits>):policy/…) before any AWS call. A role name like "my-role" or a bare policy name now fails at once.
  • create_lambda_exec_role(): when a policy can't be attached, the policies already attached are detached and the new role is deleted before the error is raised. If that cleanup fails too, a warning names the role left behind, and the original attach error is still raised.
  • build_lambda(system_deps = character(0)) is rejected instead of writing dnf -y install with no packages.
  • The log after role creation names the role and the attached policies, instead of saying it has only basic permissions.

Related GitHub Issues and PRs

Are these changes tested?

Yes. New tests: malformed and missing ARNs fail before the ECR lookup; a failed attach detaches and deletes the role; a failed cleanup warns and keeps the attach error; an empty system_deps is rejected. Existing tests now use well-formed ARNs.

Are there any user-facing changes?

Yes. deploy_lambda() rejects malformed role_arn and policy_arns, and build_lambda() rejects an empty system_deps.

Was AI used for this PR?

In accordance with the AI generation guidelines, please disclose whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Checklist

  • I understand and agree to the Code of Conduct.
  • The PR title follows Conventional Commits (fix:, feat:, docs:, ...); it becomes the NEWS.md entry.
  • I have run air format . and jarl check ..
  • I have updated roxygen comments and run devtools::document() if documentation changed.
  • I have added testthat unit tests to tests/testthat for any new functionality or fixed bug.

Assisted-by: Claude Code

Malformed role or policy ARNs failed only after the slow ECR push, and a
failed policy attach left the new role behind.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@novica
novica merged commit 691a9f8 into main Nov 1, 2026
8 checks passed
@novica
novica deleted the fix--deploy-input-checks branch November 1, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deploy_lambda(): validate inputs before the slow ECR push

1 participant