Containers must not depend on each other in a cyclic manner to avoid tight coupling and maintainability issues.
C4-ARCH-001
Error - High impact on architecture quality
General - This rule is evaluated against the overall architecture model.
GeneralIssuesFinder.CyclicDependenciesExists("Container",@ModelRelationships)Containers should form an acyclic dependency graph in which the direction of dependencies is unambiguous and consistent with architectural responsibilities. A cyclic dependency occurs when container A depends (directly or indirectly) on container B, and container B also depends on container A.
Container-level cyclic dependencies indicate a violation of separation of responsibility and a lack of clear architectural boundaries. They create strong coupling, preventing independent versioning, deployment, testing, and refactoring of containers. In extreme cases, cyclic dependencies can lead to problems with initialization, configuration, or dependency loading at system startup.
This rule enforces an architecture based on unidirectional dependencies, consistent with principles such as the Dependency Rule, the Stable Dependencies Principle, and the Clean Architecture.
Example of violation - direct cycle
ContainerA → ContainerB
ContainerB → ContainerAExample of violation - indirect cycle
ContainerA → ContainerB → ContainerC → ContainerA