fix(lambda): close the remaining contract validation gaps
Merged
WA
2mo ago+761+761+012345678901234567890123456789-73-73-01234567890123456789
Summary
- Closes the Lambda contract validation gaps raised in review on the v0.8.16 release PR (#7224), following #7216
- Fixes two real holes in code-source selection:
hasS3required both S3 fields, so a partial pair alongsideimageUriread as "image only" and the stray field still reached AWS; and animageUriwith nopackageTypewas accepted even though it then defaults to Zip - Fixes the VPC guard, which only checked that both lists were supplied — supplying both with one empty passed and produced a partial update
- Adds the documented AWS bounds for alias names (1–128 plus the pattern that excludes all-digit names), descriptions (256), layer names (140 plus the name-or-ARN pattern), optional
functionNameon the event source mapping operations (1–256), andRemovePermissionstatement IDs (1–100 plus its own pattern, which allows a dot whereAddPermissiondoes not) - Rejects structurally meaningless values: empty tag keys, empty Kafka bootstrap servers, more than one weighted routing entry, and a mapping supplying both an event source ARN and self-managed Kafka bootstrap servers
Every bound here is one the AWS Lambda API reference documents. Two review findings asked for constraints the reference does not state and were left alone — see the PR discussion for the reasoning.
Type of Change
- Bug fix
Testing
- 13 new boundary tests, 181 passing across the Lambda block, contracts, tools, and operations
bun run type-checkclean; all 39check:auditspass, plusdocs-manifest:checkand the block-registry check- 7,035 tests pass across the blocks, tools, and contracts suites
- Verified every added bound against the AWS Lambda API reference rather than inferring from sibling operations
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing
- No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)