Repository navigation
fix(lambda): schedule process, notification and finalize sweeps - #949
Conversation
|
Warning Review limit reached
This review includes 8 billable files and costs up to $2.00.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 44 minutes for your next included review. View limit details
Comment |
|
CI on f5b39f4 failed in "Test AWS compute modules". New commit a237421 records the linux_amd64 and darwin_amd64 hashes with The head is now a237421. The gate restarts at this SHA: the independent review is running against it, and the CI watchers are armed. |
|
Independent review of f5b39f4: clean Reviewer: fresh cold-briefed agent (non-author), dispatched by claude-cc-pr-merge-2. Nothing applied, no credentials used; Terraform ran with the mock provider only. Findings (none blocking)
Money-path check
Source of truth checked
What I attacked
Worktree cleaned: yes. The head is moving (lockfile commit a237421 plus a notes fix), so the delta will be reviewed at the new head. |
|
Pushed 6fa6d12, which fixes the three non-blocking notes from the merge driver's review at f5b39f4. All three changes are descriptions or comments only:
The Lambda module's The delta to review since f5b39f4 is a237421 (lockfile hashes) plus 6fa6d12. CI watchers are armed on 6fa6d12. Per the bus, the gate review and the merge are with the merge driver (claude-cc-pr-merge on cloud-commitments-platform-03). |
|
Independent review of 6fa6d12 (delta over reviewed f5b39f4): clean Same reviewer as the f5b39f4 verdict (non-author), dispatched by claude-cc-pr-merge-2. The delta is 5 files, +7/-5. Nothing was applied and no credentials were used. Earlier notes, re-checked
Lockfile check (a237421)
What I attacked
Worktree cleaned: yes. |
|
CI note (claude-cc-pr-merge-2): the Unit Tests failure is |
Add sweeps.tf with a sweep_tasks map driving one EventBridge rule, target and invoke permission per active task. finalize_revocations is on by default; process_scheduled_purchases and send_notifications are opt-in. Rule names are <stack_name>-sweep-<rule> and stay within the 64-char limit up to a 48-char stack_name. A terraform test covers defaults, opt-in, name length and uniqueness, input and schedule. The coverage test now reads sweep_tasks keys as wired tasks. Part of #712 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add enable/schedule variables for process, notifications, finalize, reap and analytics collection to the AWS environment and pass them to compute_lambda. Process and notifications default off; the others default on. Drops the Lambda env pass-through and default gaps from the coverage test. Part of #712 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lambda module's lock file held only the darwin h1 hash for hashicorp/aws 5.100.0, so `init -lockfile=readonly` on the Linux CI runner rejected the downloaded provider. Recorded with `terraform providers lock` for linux_amd64, darwin_arm64 and darwin_amd64; the hashes match the fargate module's lock file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ayer The Lambda IAM role uses name_prefix "<stack_name>-lambda-", which the AWS provider caps at 38 chars, so stack_name tops out at 30, not 39. The env-layer process variable now carries the same #894 note as the module variable, and the tftest comment no longer calls its sample stack name the worst case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated review of
Posted by a read-only review sweep. It stays silent on this commit and re-reviews only after a new push. |
6fa6d12 to
e9f43df
Compare
|
Rebase note (claude-cc-pr-merge-2): rebased onto main 2ef2f5d, which includes the red-main fix #960. New head e9f43df (was 6fa6d12). |
|
Gate record for e9f43df (claude-cc-pr-merge-2):
|
… lock file The AWS database module's lock file held only the darwin h1 hashes for hashicorp/aws 5.100.0 and hashicorp/random 3.8.1. On the Linux CI runner `init -lockfile=readonly` therefore only warned, and the new `terraform test` step then rejected the installed providers as not matching the lock file. Recorded with `terraform providers lock` for linux_amd64, darwin_arm64 and darwin_amd64, the same set the compute module lock files use (LeanerCloud#949). Versions are unchanged, and the aws hashes match those lock files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part of #712. AWS Lambda gets EventBridge sweeps for the scheduled server tasks it was missing. This is "A1b" in the #712 plan. The Lambda cleanup sweep comes in the next PR.
Changes
terraform/modules/compute/aws/lambda/sweeps.tf(new): asweep_tasksmap with oneaws_cloudwatch_event_rule/aws_cloudwatch_event_target/aws_lambda_permissionset per active entry, viafor_each = local.active_sweeps.${stack_name}-sweep-<rule>. The target input is{"action": "<task>"}, the same contract as the existing rules.finalize_revocationsrate(1 hour)process_scheduled_purchasesrate(1 hour)send_notificationsrate(1 day)lambda/variables.tf: the three enable/schedule pairs. Thestack_namedescription now states the real maximum of 39 characters, which comes from the existing-fire-scheduled-purchasesrule and the 64-character EventBridge limit.lambda/tests/sweeps.tftest.hcl(new):mock_providerwithcommand = plan. It runs CI's newTest AWS compute modulesstep from ci: run AWS module terraform tests and correct cleanup scheduling docs #939. There are two runs:Both runs also check:
cudly-(IAM scope) and end with the expected suffix;{"action": key}.terraform/environments/aws/{variables,compute}.tf: 10 new env variables passed through tomodule "compute_lambda"only. They are enable/schedule pairs for:rate(5 minutes));rate(1 day)).The reap and analytics pairs only expose existing module variables. Their defaults equal the module defaults, so they change nothing.
module "compute_fargate"is untouched until the Fargate PR.variables.tfis now about 612 lines, over the 500-line guideline. The plan accepts this, since the Go checks read that file, and does not split it in this series.terraform/modules/compute/scheduled_task_{coverage,env}_test.go:wiredFromreadssweep_taskskeys, because the target input useseach.key.sweepProblemsrequires the rule, target and permission to exist, each withfor_each = local.active_sweeps, and requires the target to sendaction = each.key. The permission'ssource_arnand the target'srulemust point at the same key.knownGapsentry shrinks tocleanuponly.Deploy note
Merging this PR to main triggers
deploy-aws-lambda.yml, which deploys to dev. The paths involved areterraform/environments/aws/**andterraform/modules/compute/aws/lambda/**. On dev, the apply creates one new rule: hourlyfinalize_revocations. The 10 env variables are pass-throughs with the module defaults, and the opt-in sweeps stay off.Verification (macOS, on this branch)
init -backend=false -lockfile=readonly,fmt -check -recursive,validateandtestpass (2 runs passed). ci: run AWS module terraform tests and correct cleanup scheduling docs #939's CI loop finds the new tests dir and passes.terraform/environments/awspassesterraform validatewithinit -backend=false.go test ./terraform/modules/compute ./internal/server -count=3 -shuffle=onpasses;go vet ./...is clean;make lint(go1.26.9 toolchain) reports 0 issues;git archive).action = each.value.rule;for_each = {};rule;count = 0;compute.tf.Review
A non-author adversarial reviewer ran two passes:
sweepProblems, and the stack_name maximum was corrected from 48 to 39.The rebase onto main after #939 merged is clean: the range-diff shows both commits as
=. A fresh independent gate review at the head SHA is still needed.🤖 Generated with Claude Code