Skip to content

Comments

Add ConfigResolver with shared singleton pattern#641

Open
ubaskota wants to merge 2 commits intosmithy-lang:config_resolution_mainfrom
ubaskota:config_resolver
Open

Add ConfigResolver with shared singleton pattern#641
ubaskota wants to merge 2 commits intosmithy-lang:config_resolution_mainfrom
ubaskota:config_resolver

Conversation

@ubaskota
Copy link

Issue #, if available:

Description of changes:

Implements ConfigResolver to resolve config values from multiple sources in precedence order. Adds get_shared_resolver() using @lru_cache to share a single resolver instance across all config objects, avoiding redundant reads from the sources.

Tests
Added unit tests to validate the expected behavior. Verified that the tests pass.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ubaskota ubaskota requested a review from a team as a code owner February 20, 2026 00:08
Copy link
Contributor

@jonathan343 jonathan343 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Ujjwal.

I left some minor comments and suggestions. However, my biggest concern with this PR is the approach for config resolver sharing.

  1. It doesn't follow any of the approaches discussed in previous designs
  2. In cases where multiple threads hit the function before the first result is cached, it will result in each building their own resolver which is unnecessary/duplicate work

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.

4 participants