Skip to content

Isolate configuration defaults - #242

Open
ydah wants to merge 1 commit into
bigcommerce:mainfrom
ydah:fix/configuration-default-isolation
Open

ydah wants to merge 1 commit into
bigcommerce:mainfrom
ydah:fix/configuration-default-isolation

Conversation

@ydah

@ydah ydah commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

What? Why?

Gruf::Configuration#reset assigns default values directly from VALID_CONFIG_KEYS. Although the outer hash is frozen, mutable defaults such as services, server_options, and nested RPC server options remain shared.

Controllers::Base.bind appends service classes to Gruf.services, which mutates the shared default array. As a result, calling Gruf.reset reuses the polluted array, causing services to accumulate across tests and development reloads.

This uses Active Support's deep_dup when applying defaults during reset, ensuring each reset receives independent mutable objects while preserving the existing configuration key structure.

How was it tested?

  • Added regression specs for mutable configuration defaults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant