Repository navigation
fix(E3010): count post-transform resources on SAM templates - #4889
Varshith-Kali wants to merge 2 commits into
Conversation
|
Hi team, the [CI] Test PR workflow run on the current head is still parked waiting for a first-time-contributor approval (action_required). Could a maintainer approve the run so CI can proceed? Thanks. |
Since the SAM transform stopped running in aws-cloudformation#4491, E3010 counted Resources as written, so a SAM template expanding past the 500 resource limit passed lint even though CloudFormation rejects it at deploy. E3010 now counts a conservative lower bound of the post-transform total when the template declares the AWS::Serverless-2016-10-31 transform: each serverless resource counts as the CloudFormation resource it expands to, plus the resources the transform generates (implicit roles, versions, aliases, URLs, CodeDeploy resources, per-event permissions, implicit APIs). It fires only when the template provably exceeds the limit, never on an over-estimate. The transform itself stays disabled for the rest of the ruleset. Also fixes the implicit resource model generating CodeDeploy resources for functions without DeploymentPreference. Fixes aws-cloudformation#4883
938e5e3 to
2c0ae0c
Compare
|
Fixed the CI failure: it was only the isort hook in the style job, not the tests. All 3485 unit tests passed on windows-latest 3.13; isort flagged src/cfnlint/rules/resources/MaxProperties.py for an extra blank line after the import block. Removed that one blank line in 9211bd6. Verified locally: isort check clean, ruff check and format clean, and the affected unit tests pass (1643 passed in test/unit/rules/resources and test/unit/module/context). |
|
Hi team, the fix for the CI failure is now on the current head 9211bd6 (isort hook only, all 3485 unit tests pass locally), but no workflow runs have started on it yet. Could a maintainer approve the first-time-contributor run so CI can verify the fix? |
Summary
Fixes #4883.
Since #4491 removed the SAM transform, E3010 counted
Resourcesas written. A SAM template that expands past the 500 resource limit passed lint, even though CloudFormation rejects it at deploy time (eachAWS::Serverless::Functionbecomes at least the function plus its execution role).Changes
AWS::Serverless-2016-10-31transform. The transform itself stays disabled for the rest of the ruleset.AWS::Serverless::Connectorcreates none), plus the generated resources the transform is known to create (implicit roles, versions, aliases, function URLs, CodeDeploy resources, per-event permissions, implicit APIs). The rule fires only when the template provably exceeds the limit, so the estimate cannot cause false positives.cfnlint/contextis now shared:_inject_sam_implicit_resourcesis built on the newsam_generated_resourcesgenerator, which E3010 also uses for counting.DeploymentPreference(they were injected for every function).Testing
AWS::Serverless::Functionresources (under 500 as written) now fail E3010, matching the 520 resources CloudFormation reports at deploy. Also verified end to end with the issue's repro template.test/unit/rules/resources,test/unit/rules/jsonschema,test/unit/rules/mappings,test/unit/rules/outputs,test/unit/module/context, and the SAM integration tests are all green. Ruff check and format clean.