Summary
Config sync retry logic now assumes configuration definition entries behave like immutable snapshots, but the codebase still has legacy mutation-prone paths that can mutate nested state in place.
Desired invariant
Configuration definition maps should be treated as immutable snapshots. When config changes, callers should replace whole entries or whole definition maps rather than mutating nested state in place.
Existing mutation-prone examples
- Provider config resolution mutates nested
BasicConfig through ProviderConfig.ResolveConfig.
- Role accessors and resolution paths can work on shallow copies whose slice-backed fields still alias underlying data.
- Workflow definitions contain pointer-backed
*model.Workflow state, so shallow copies do not provide isolation.
Follow-up work
- Audit and replace existing mutation-prone paths with copy-on-write or whole-entry replacement.
- Standardize the invariant in config code and docs.
- Add targeted tests for mutation isolation beyond the sync retry path.
Scope note
This is a follow-up enhancement issue. It should stay separate from the current sync bug-fix PRs so reviewers can reason about behavior fixes independently from broader lock/mutation cleanup.
Summary
Config sync retry logic now assumes configuration definition entries behave like immutable snapshots, but the codebase still has legacy mutation-prone paths that can mutate nested state in place.
Desired invariant
Configuration definition maps should be treated as immutable snapshots. When config changes, callers should replace whole entries or whole definition maps rather than mutating nested state in place.
Existing mutation-prone examples
BasicConfigthroughProviderConfig.ResolveConfig.*model.Workflowstate, so shallow copies do not provide isolation.Follow-up work
Scope note
This is a follow-up enhancement issue. It should stay separate from the current sync bug-fix PRs so reviewers can reason about behavior fixes independently from broader lock/mutation cleanup.