mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 15:49:33 -05:00
* fix(cloudformation): reject resources that depend on each other in a cycle A template whose resources form a dependency cycle was created anyway: the topological sort appended the resources it could not order and created them in template order. CloudFormation rejects such a template with a ValidationError naming the resources, before any of them is created. The sort now throws that error when resources remain unsorted, and the synchronous pre-check that runs before CreateStack, UpdateStack and CreateChangeSet calls the sort instead of repeating its dependency checks, so the request fails before any stack state is created. * fix(cloudformation): keep dependency order when deleting a stack saved with a cyclic template A stack saved before circular templates were rejected can still carry one. Deleting it hit the new circular-dependency error while ordering its resources, so the delete fell back to insertion order for every resource and could remove a resource before one still using it. The delete now orders what it can and places the circular resources after it, as before. * fix(cloudformation): order resources that depend on a cycle when deleting a saved stack A resource that depends on a dependency cycle cannot be ordered either, so the delete of a stack saved with a cyclic template ranked such resources in template order and could remove a target group before the listener using it. When the sort stalls it now releases a resource on the cycle itself and goes on, so everything that depends on the cycle keeps its dependency order. * fix(cloudformation): delete linked dependency cycles in dependency order When a saved stack's template has a cycle that depends on another cycle, the sort could release a resource of the dependent cycle before the cycle it uses was placed, so the delete removed that cycle's resources first. When the sort stalls it now releases a resource from the first strongly connected component Tarjan's algorithm completes over the resources left, which depends on no other cycle. * fix(cloudformation): order a saved cyclic stack in one pass and name only the cycle Breaking one cycle at a time searched again at every stall and recursed, so a long dependency chain could exhaust the thread's stack and stop the delete of a stack saved with a cyclic template. The resources left at a stall are now ordered in one pass by their strongly connected components, dependencies first, with an iterative Tarjan search. The circular-dependency error names only the components that are cycles, not resources that merely depend on one. * test(cloudformation): cover circular dependency rejection with the AWS SDK * test(cloudformation): assert only the cycle's resources in the SDK test's message