Skip to content

Fix scope resolution issues#2324

Merged
arnaudgiuliani merged 2 commits into4.2.0from
fix_scope_resolution_issues
Dec 2, 2025
Merged

Fix scope resolution issues#2324
arnaudgiuliani merged 2 commits into4.2.0from
fix_scope_resolution_issues

Conversation

@arnaudgiuliani
Copy link
Copy Markdown
Member

Fix scope resolution issues for #2274

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes scope resolution issues in Koin's dependency injection framework, addressing issue #2274. The changes focus on improving how scoped instances are resolved when using custom scope linking patterns, particularly when scopes are unlinked from the root scope and linked to other scopes.

Key Changes:

  • Modified scope resolution logic to support chained parent scope lookup when a single scope is linked
  • Changed scope archetype check to use scopeArchetype == null instead of TypeQualifier check
  • Added exception handling for MissingScopeValueException to gracefully handle missing scoped values

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
projects/core/koin-core/src/commonTest/kotlin/org/koin/core/ScopeTest.kt Added two regression tests demonstrating scope resolution through custom-linked scopes
projects/core/koin-core/src/commonMain/kotlin/org/koin/core/resolution/CoreResolver.kt Modified parent scope resolution to support chained lookup for single-linked scopes and updated archetype condition
projects/core/koin-core/src/commonMain/kotlin/org/koin/core/registry/InstanceRegistry.kt Added exception handling for MissingScopeValueException and sorting for deterministic instance retrieval
projects/core/koin-core/src/commonMain/kotlin/org/koin/core/instance/ScopedInstanceFactory.kt Enhanced isCreated() logic and added exception throwing for non-holdInstance factories
projects/compose/koin-compose-navigation3/build.gradle.kts Changed minSdk from property reference to hardcoded value 23

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@arnaudgiuliani arnaudgiuliani merged commit 516ec1b into 4.2.0 Dec 2, 2025
10 checks passed
@arnaudgiuliani arnaudgiuliani deleted the fix_scope_resolution_issues branch December 2, 2025 18:41
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.

2 participants