Skip to content

Use concreteType for SafeDIMockConfiguration struct extensions#243

Merged
dfed merged 2 commits into
mainfrom
dfed/fix-protocol-config-struct
Apr 10, 2026
Merged

Use concreteType for SafeDIMockConfiguration struct extensions#243
dfed merged 2 commits into
mainfrom
dfed/fix-protocol-config-struct

Conversation

@dfed
Copy link
Copy Markdown
Owner

@dfed dfed commented Apr 10, 2026

Summary

  • Protocol extensions cannot contain nested type declarations
  • When a dependency's instantiated type is a protocol (e.g., AuthService fulfilled by DefaultAuthService), the generated SafeDIMockConfiguration must be nested in the concrete type's extension, not the protocol's
  • Reverts Revert leaf mock wrapper generation #238's change from concreteType to instantiatedTypeDescription for configurationTypeName and dedup key
  • This bug exists on main but is rarely triggered — protocol-typed deps that needsConfigurationStruct (have children) are uncommon without the onlyIfAvailable tree-threading changes

Test plan

  • All 742 tests pass
  • SwiftFormat lint passes

🤖 Generated with Claude Code

dfed and others added 2 commits April 10, 2026 11:35
Protocol extensions cannot contain nested type declarations. When a
dependency's instantiated type is a protocol (e.g., AuthService fulfilled
by DefaultAuthService), the generated SafeDIMockConfiguration must be
nested in the concrete type's extension, not the protocol's.

This reverts the #238 change from concreteType to instantiatedTypeDescription
for configurationTypeName and collectUniqueConfigurationTypes dedup key.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.98%. Comparing base (1f0bf01) to head (cceb140).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##              main     #243      +/-   ##
===========================================
- Coverage   100.00%   99.98%   -0.02%     
===========================================
  Files           41       41              
  Lines         5772     5772              
===========================================
- Hits          5772     5771       -1     
- Misses           0        1       +1     
Files with missing lines Coverage Δ
Sources/SafeDICore/Generators/ScopeGenerator.swift 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dfed dfed marked this pull request as ready for review April 10, 2026 19:12
@dfed dfed merged commit 6714dea into main Apr 10, 2026
17 checks passed
@dfed dfed deleted the dfed/fix-protocol-config-struct branch April 10, 2026 19:12
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