Skip to content

Revert leaf mock wrapper generation#238

Merged
dfed merged 4 commits into
mainfrom
codex/revert-leaf-mock-wrappers
Apr 10, 2026
Merged

Revert leaf mock wrapper generation#238
dfed merged 4 commits into
mainfrom
codex/revert-leaf-mock-wrappers

Conversation

@dfed
Copy link
Copy Markdown
Owner

@dfed dfed commented Apr 10, 2026

Summary

  • revert the always-wrapper mock generation change for simple leaf nodes
  • restore the pre-alpha-14 mock API shape where simple leaves stay raw builder values and richer nodes use SafeDIMockConfiguration
  • keep the unrelated launch-only SafeDITool fallback for plugin setup intact

Why

The always-wrapper change appears to have caused a meaningful compile-time regression in the Apple repo after the 2.0.0-alpha-14 bump. Reverting just that generated API change lets us preserve the launch fallback fix while removing the extra mock-wrapper surface area.

What changed

  • restored needsConfigurationStruct-based branching in mock generation
  • restored raw optional leaf builder emission in root SafeDIParameters and child configs
  • restored the previous shared-config ownership behavior for simple leaf nodes
  • updated mock-generation golden tests back to the pre-wrapper shape
  • left Plugins/Shared.swift and Plugins/SafeDIGenerator/SafeDIGenerateDependencyTree.swift unchanged so the local source fallback still only triggers on tool launch failures

Validation

  • swift build --traits sourceBuild
  • swift test --traits sourceBuild
  • ./CLI/lint.sh

@dfed dfed changed the title [codex] Revert leaf mock wrapper generation Revert leaf mock wrapper generation Apr 10, 2026
@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 100.00%. Comparing base (e1b298e) to head (106ae3b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #238   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           41        41           
  Lines         5715      5772   +57     
=========================================
+ Hits          5715      5772   +57     
Files with missing lines Coverage Δ
Sources/SafeDICore/Generators/ScopeGenerator.swift 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread README.md Outdated
Comment thread README.md Outdated
Co-authored-by: Dan Federman <dfed@me.com>
@dfed dfed marked this pull request as ready for review April 10, 2026 15:52
@dfed dfed self-assigned this Apr 10, 2026
@dfed dfed merged commit 1372465 into main Apr 10, 2026
17 checks passed
@dfed dfed deleted the codex/revert-leaf-mock-wrappers branch April 10, 2026 15:53
dfed added a commit that referenced this pull request Apr 10, 2026
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>
dfed added a commit that referenced this pull request 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 #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
- [x] All 742 tests pass
- [x] SwiftFormat lint passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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