feat(jobs): golang aws lambdas scaffolding#420
Conversation
This breaks the pnpm mount feature. I put Claude to work for half an hour and tried a workaround that worked with another feature that installed pnpm, but the node feature with version 25 just does not work.
|
Warning Review limit reached
More reviews will be available in 49 minutes and 51 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThis PR upgrades devcontainer features (Node -> node:2, adds aws-cli, removes pnpm mount), normalizes Go module sync comments to use relative paths, and adds a new AWS SAM–based jobs subsystem including build/deploy Makefile, SAM template, Go Lambda handler, and supporting configs/docs. ChangesDevelopment Environment & AWS Lambda Jobs Setup
Sequence Diagram(s)sequenceDiagram
participant User
participant Makefile
participant Go Compiler
participant SAM Deploy
participant SSM
participant Lambda
User->>Makefile: make deps
Makefile->>Makefile: pip install requirements.txt
User->>Makefile: make build
Makefile->>Go Compiler: go build -o bootstrap (Linux ARM64)
Go Compiler->>Makefile: bootstrap binary
Makefile->>Makefile: zip -r hello-world.zip
User->>Makefile: make deploy
Makefile->>SAM Deploy: sam deploy --parameter-overrides
SAM Deploy->>SSM: fetch SmtpUser, SmtpPass
SSM->>Lambda: inject SMTP_USER, SMTP_PASS env vars
Lambda->>User: deployment complete
sequenceDiagram
participant Lambda
participant Environment
participant TLS
participant SMTP Server
participant Email Client
Lambda->>Environment: read SMTP_USER, SMTP_PASS
Lambda->>TLS: dial smtpHost:smtpPort with TLS
TLS->>SMTP Server: establish TLS connection
SMTP Server->>Lambda: connection OK
Lambda->>SMTP Server: create smtp.Client
Lambda->>SMTP Server: authenticate PlainAuth
SMTP Server->>Lambda: auth success
Lambda->>SMTP Server: SetFrom, Recipient, Data
Lambda->>SMTP Server: write message body
SMTP Server->>Email Client: send "Hello World" email
Email Client->>Lambda: success
Lambda->>Lambda: return "sent"
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
jobs/functions/hello-world/main.go (1)
17-17: ⚡ Quick winAvoid hardcoding a real recipient address in source.
Make the recipient configurable (env var or parameter) to prevent accidental sends and improve portability across environments.
Suggested change
const ( @@ - toAddress = "ataylor@directactioneverywhere.com" fromAddress = "tech-noreply@directactioneverywhere.com" @@ ) @@ user := os.Getenv("SMTP_USER") pass := os.Getenv("SMTP_PASS") + toAddress := os.Getenv("SMTP_TO_ADDRESS") - if user == "" || pass == "" { - return "", fmt.Errorf("SMTP_USER and SMTP_PASS must be set") + if user == "" || pass == "" || toAddress == "" { + return "", fmt.Errorf("SMTP_USER, SMTP_PASS, and SMTP_TO_ADDRESS must be set") }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@jobs/functions/hello-world/main.go` at line 17, The hardcoded recipient address in the jobs/functions/hello-world file is unsafe; replace the toAddress constant with a configurable value (e.g., read from an environment variable or function parameter). Specifically, remove the fixed toAddress = "ataylor@directactioneverywhere.com" and instead initialize toAddress from os.Getenv("TO_ADDRESS") (or accept it as an argument where the handler function is defined), provide a sensible default or fail-fast check if missing, and update any call sites that reference toAddress (the variable used in the send logic) to use the new configurable value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@jobs/README.md`:
- Around line 14-16: The fenced code blocks in README.md that contain shell
commands (e.g., the blocks with "make deps", "aws sso login --profile
<your-profile>", "make build", "make deploy", "aws lambda invoke --function-name
jobs-hello-world --region us-west-2 /dev/stdout", and "make clean") are missing
language identifiers; update each triple-backtick fence to include a language
tag (use "bash" or "sh") so they read ```bash to satisfy MD040 and improve
readability.
- Around line 20-22: Update the jobs/README.md entry for the authentication step
to clarify that the documented command is `aws login` (which is valid in AWS CLI
v2.32.0+ for console-based authentication), add a short note stating the minimum
AWS CLI version required, and explicitly warn not to replace it with `aws sso
login` unless the repo is using IAM Identity Center; also add a one-line note
that `aws sso login --profile <name>` is the alternative only when profiles are
configured via IAM Identity Center.
In `@jobs/requirements.txt`:
- Line 1: The requirements entry for aws-sam-cli is unpinned; update the package
entry in requirements.txt to pin it to the tested release (replace "aws-sam-cli"
with "aws-sam-cli==1.161.0") so builds are reproducible and include the known
security fix; also scan for any other occurrences of an unpinned aws-sam-cli
(e.g., in CI or other requirements files) and pin them the same way.
In `@jobs/template.yaml`:
- Around line 20-25: The VpcConfig currently hardcodes SecurityGroupIds and
SubnetIds (SecurityGroupIds and SubnetIds) making the template
environment-specific; add CloudFormation Parameters (e.g., ParamSecurityGroupIds
and ParamSubnetIds) that accept a comma-separated list or AWS::SSM parameter
values, replace the hardcoded arrays in VpcConfig with references to those
parameters (using Fn::Split or !Ref as appropriate), and update any related
parameter metadata/defaults and template validation to ensure deployments can
supply environment-specific VPC identifiers.
---
Nitpick comments:
In `@jobs/functions/hello-world/main.go`:
- Line 17: The hardcoded recipient address in the jobs/functions/hello-world
file is unsafe; replace the toAddress constant with a configurable value (e.g.,
read from an environment variable or function parameter). Specifically, remove
the fixed toAddress = "ataylor@directactioneverywhere.com" and instead
initialize toAddress from os.Getenv("TO_ADDRESS") (or accept it as an argument
where the handler function is defined), provide a sensible default or fail-fast
check if missing, and update any call sites that reference toAddress (the
variable used in the send logic) to use the new configurable value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9fe2c118-506e-44ef-8576-8b1736e1db82
⛔ Files ignored due to path filters (3)
go.workis excluded by!**/*.workgo.work.sumis excluded by!**/*.sumjobs/go.sumis excluded by!**/*.sum
📒 Files selected for processing (17)
.devcontainer/devcontainer-lock.json.devcontainer/devcontainer.jsonDockerfileDockerfile.cliMakefilecli/go.modjobs/.gitignorejobs/Makefilejobs/README.mdjobs/functions/hello-world/main.gojobs/go.modjobs/hello-worldjobs/requirements.txtjobs/samconfig.tomljobs/template.yamlpkg/go.modserver/src/go.mod
ec70a13 to
a71219f
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
jobs/README.md (2)
18-27: ⚡ Quick winAdd minimum AWS CLI version requirement for
aws login.The
aws logincommand requires AWS CLI version 2.32.0 or later. Add a note documenting this requirement so users don't encounter unexpected failures with older CLI versions.📝 Suggested addition
Log in with the AWS CLI: ```bash aws login-Note: the above command works for IAM users, not SSO / Identity Center users,
+Note:aws loginrequires AWS CLI version 2.32.0 or later. It works for IAM users, not SSO / Identity Center users,
and uses your console credentials rather than storing a long term IAM access
key. You must re-run it every time your console session expires.</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.In
@jobs/README.mdaround lines 18 - 27, Update the README note for the "aws
login" snippet to specify the minimum AWS CLI version required: state thataws loginrequires AWS CLI version 2.32.0 or later, and then retain the existing
clarification that it works for IAM users (not SSO/Identity Center) and that it
uses console credentials and must be re-run when the session expires; modify the
sentence containing "Note:" to begin with the version requirement and keep the
rest of the explanation intact so readers see both the version constraint and
usage caveats for theaws logincommand.</details> --- `24-26`: _⚡ Quick win_ **Fix hyphenation: "long-term" is a compound modifier.** Line 25 uses "long term" but should use "long-term" when modifying "IAM access key". <details> <summary>📝 Grammar fix</summary> ```diff -and uses your console credentials rather than storing a long term IAM access +and uses your console credentials rather than storing a long-term IAM access key. You must re-run it every time your console session expires.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@jobs/README.md` around lines 24 - 26, Change the phrase "long term IAM access key" to use the compound modifier form "long-term IAM access key" in the README.md sentence that currently reads "uses your console credentials rather than storing a long term IAM access key" so the hyphenated form correctly modifies "IAM access key".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@jobs/README.md`:
- Around line 18-27: Update the README note for the "aws login" snippet to
specify the minimum AWS CLI version required: state that `aws login` requires
AWS CLI version 2.32.0 or later, and then retain the existing clarification that
it works for IAM users (not SSO/Identity Center) and that it uses console
credentials and must be re-run when the session expires; modify the sentence
containing "Note:" to begin with the version requirement and keep the rest of
the explanation intact so readers see both the version constraint and usage
caveats for the `aws login` command.
- Around line 24-26: Change the phrase "long term IAM access key" to use the
compound modifier form "long-term IAM access key" in the README.md sentence that
currently reads "uses your console credentials rather than storing a long term
IAM access key" so the hyphenated form correctly modifies "IAM access key".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 28b36f56-a653-42f8-8da0-cb49ccb4fb99
⛔ Files ignored due to path filters (2)
go.work.sumis excluded by!**/*.sumjobs/go.sumis excluded by!**/*.sum
📒 Files selected for processing (12)
.devcontainer/devcontainer-lock.json.devcontainer/devcontainer.jsonjobs/.gitignorejobs/Makefilejobs/README.mdjobs/functions/hello-world/main.gojobs/go.modjobs/hello-worldjobs/requirements.txtjobs/samconfig.tomljobs/template.yamlserver/src/go.mod
✅ Files skipped from review due to trivial changes (4)
- jobs/.gitignore
- server/src/go.mod
- jobs/go.mod
- jobs/samconfig.toml
🚧 Files skipped from review as they are similar to previous changes (4)
- jobs/template.yaml
- .devcontainer/devcontainer-lock.json
- jobs/functions/hello-world/main.go
- .devcontainer/devcontainer.json
a71219f to
6711468
Compare
6711468 to
e74d1c3
Compare
Summary by CodeRabbit
New Features
Documentation
Chores