mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
* fix(cloudformation): resolve FunctionResponseTypes through whole-property intrinsics Greptile review on #2964 (merged): resolveStringList checked isArray() on the raw, unresolved property node, so a whole-property intrinsic like Fn::If, Fn::Split, or a Ref to a CommaDelimitedList parameter was silently rejected instead of evaluated, leaving FunctionResponseTypes empty for otherwise-valid templates. hectorvent merged #2964 anyway, treating this as an acceptable known limitation given the property's narrow value domain, but it turned out to be a self-correction I should have caught: this same file already has resolveStringListOrEmpty, which resolves the whole property through resolveNode first, and swapping to it is a straight improvement with no downside for the plain-array case. That still needed a real fix underneath it: resolveNode treated Fn::If as a scalar-collapsing intrinsic like Ref/Fn::Sub, so it stringified a chosen array or object branch instead of preserving it. This is the same engine gap Greptile flagged on PR #2796 (ScheduleGroup Tags), which hectorvent asked to be raised separately rather than fixed in that PR. Since a real fix was needed here to close this issue's gap for good, resolveNode now special-cases Fn::If: it picks the branch the same way resolve() does, then resolves that branch recursively instead of collapsing it, so the result keeps whatever shape the chosen branch actually has. resolve() itself is unchanged. Verified by disabling each fix independently and confirming the corresponding test fails with the exact expected error before restoring it. Full cloudformation package regression (1272 tests) passes clean. * fix(cloudformation): use resolveList for FunctionResponseTypes, not resolveStringListOrEmpty Greptile review on this PR: resolveStringListOrEmpty routes through resolveNode, so it now sees an Fn::If-wrapped list, but resolveNode never implemented real list-splitting logic - it just special-cases which intrinsics collapse to a scalar. Fn::Split and a Ref to a CommaDelimitedList parameter still resolved to a bare string there, so resolveStringListOrEmpty's isArray() check still rejected them. The engine already has a purpose-built method for exactly this, resolveList, which correctly handles a literal array, Fn::GetAZs, Fn::Cidr, Fn::Split (with its actual delimiter), and a comma-delimited scalar (a Ref to a CommaDelimitedList parameter). It only needed Fn::If added, the same way resolveNode gained it: pick the branch, then resolve that branch through resolveList itself rather than collapsing it, so a list-shaped branch (a literal array or another Fn::Split) stays list-shaped. Made resolveList public and switched provisionLambdaEventSourceMapping to call it directly for FunctionResponseTypes, closing the gap for Fn::If, Fn::Split, and CommaDelimitedList Refs in one pass instead of leaving Fn::Split and CommaDelimitedList as a known follow-up gap. Verified by disabling the new Fn::If branch in resolveList and confirming the test fails with the exact expected wrong value before restoring it - the first version of that test used comma-friendly data that passed either way, so it was rewritten with a non-comma delimiter to actually discriminate. Full cloudformation package regression (1276 tests) passes clean. * fix(cloudformation): route FunctionResponseTypes through resolveStringList, not resolveList hectorvent (review): since #2946, the provisioner's resolveStringList helper already delegates to engine.resolveStringList, which handles Fn::If/Fn::Split/CommaDelimitedList and drops blank entries - making the resolveList hunk from this PR redundant, and worse: resolveList keeps blanks, so a conditional element resolving to AWS::NoValue was forwarded as an invalid empty-string response type (also flagged by Greptile). Drops the resolveList call in favor of the existing resolveStringList helper, makes resolveList private again (its only external caller was this now-removed hunk), and points the engine tests at resolveStringList. Adds a test pinning the NoValue-drops-the-entry behavior Greptile flagged.