Skip to content

Treat config definition entries as immutable snapshots and eliminate legacy in-place mutations #306

@michaelw

Description

@michaelw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions