#8482·cadence

Decouple config structs from config package

Author: ShaddollCreated Aug 27, 2026Updated Aug 27, 2026
Labelstriage/needs-infokind/cleanup

Problem

The codebase has a centralized configuration structure that defines the configuration for all components. This approach introduces several issues:

  • It creates a centralized dependency for configuration decoding. Whenever a new component, dependency, or plugin is introduced, its configuration struct must be added to the central configuration structure so that it can be decoded. However, some components use a plugin architecture, where plugin-specific configuration types are intentionally not known to the core codebase. To support these plugins, we introduced yaml.Node to defer decoding until the plugin is loaded. This adds complexity and weakens type safety in the configuration layer.

  • It allows configuration types to create unintended dependencies between components. A component may reference another component's configuration struct simply because it needs to construct one of that component's dependencies. For example, dynamicconfigfx depends on the persistence configuration because the config-store client uses it to create a persistence.ConfigStoreManager. This violates the intended dependency-injection model: dynamicconfigfx should depend on a ConfigStoreManager, not on the configuration required to construct one. As a result, persistence.ConfigStoreManager is currently instantiated twice in the application, leading to duplicated ownership and unclear component lifecycle.

Suggestion

Decouple component-specific configuration structs from the config package and ultimately remove the Config type entirely. Each component should depend only on config.Provider and be responsible for decoding its own configuration independently. This eliminates the need for a centralized configuration structure and keeps configuration ownership within the component that consumes it.

Here is an example PR: https://github.com/cadence-workflow/cadence/pull/8472

Source: cadence-workflow/cadence