Codebase Review Round 2 — Finding #10
Severity: High
Location: config.rs:85-156
Problem
ClusterState is a 40-field flat struct that serves as the central configuration object. This "God Struct" anti-pattern makes the code hard to understand, test, and extend. Tests that construct ClusterState require 47 lines of boilerplate to set all fields.
Impact
- Adding new features requires modifying a 40+ field struct
- Test setup is verbose and fragile (any new field breaks all test constructors)
- No logical grouping makes it hard to understand which fields relate to which subsystem
Fix
- Decompose into logical sub-structs:
TlsConfig, RateLimitConfig, WafConfig, MeshConfig, ObservabilityConfig, etc.
- Implement
Default for each sub-struct to reduce test boilerplate
ClusterState becomes a composition of these sub-structs
Codebase Review Round 2 — Finding #10
Severity: High
Location:
config.rs:85-156Problem
ClusterStateis a 40-field flat struct that serves as the central configuration object. This "God Struct" anti-pattern makes the code hard to understand, test, and extend. Tests that constructClusterStaterequire 47 lines of boilerplate to set all fields.Impact
Fix
TlsConfig,RateLimitConfig,WafConfig,MeshConfig,ObservabilityConfig, etc.Defaultfor each sub-struct to reduce test boilerplateClusterStatebecomes a composition of these sub-structs