Skip to content

Correctly support endpoint expressions with multiple chained assigns - #7238

Merged
alextwoods merged 1 commit into
masterfrom
alexwoo/eprules_multiple_assign_fix
Aug 7, 2026
Merged

Correctly support endpoint expressions with multiple chained assigns#7238
alextwoods merged 1 commit into
masterfrom
alexwoo/eprules_multiple_assign_fix

Conversation

@alextwoods

Copy link
Copy Markdown
Contributor

Correctly support endpoint expressions with multiple chained assigns.

Motivation and Context

Codegen for endpoint rules with expressions with multiple chained assigns were failing because we our codegen would visit each assign and collect them and then after all were visited only then generate the lets, but since the generating the lets is what updates the symbol table we were not able to find the result of earlier assigns. Basically an endpoint rule like:

isoArn = aws.parseArn(ResourceARN) && isoArnType = isoArn.resourceId[0] 

In the above expression the isoArnType assign needs to use the resul tof the first assing to isoArn, which currently fails with:

  Cannot find a member with name `resourceId` for type `Void`,  
  Cannot find type for expression `(get-member isoArn resourceId)`,  
  Cannot find type for variable `isoArnType`,

Modifications

When visiting letExpressions we need to visit and process them sequentially - that is, we need to process the bindings AND register the types.

Testing

Added codegen test with previously failing example ruleset.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.

License

  • I confirm that this pull request can be released under the Apache 2 license

@alextwoods
alextwoods requested a review from a team as a code owner August 7, 2026 15:47
@alextwoods
alextwoods requested a review from zoewangg August 7, 2026 15:48
@alextwoods
alextwoods enabled auto-merge August 7, 2026 16:07
@alextwoods
alextwoods added this pull request to the merge queue Aug 7, 2026
Merged via the queue into master with commit e5be633 Aug 7, 2026
22 of 23 checks passed
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants