Skip to content

Always generate mock configuration wrappers#235

Merged
dfed merged 5 commits intomainfrom
codex/remove-needs-configuration-struct-worktree
Apr 10, 2026
Merged

Always generate mock configuration wrappers#235
dfed merged 5 commits intomainfrom
codex/remove-needs-configuration-struct-worktree

Conversation

@dfed
Copy link
Copy Markdown
Owner

@dfed dfed commented Apr 9, 2026

Summary

  • always generate SafeDIMockConfiguration for every mock-tree edge, including simple leaves
  • co-locate a rooted type's owned SafeDIMockConfiguration with its Type+SafeDIMock.swift output instead of leaving it in the shared configuration file
  • update the mock customization docs and golden tests for the new always-wrapper API shape

Why

Simple leaf overrides previously used raw builder values while richer nodes used configuration objects. That meant a child could change categories at the call site as it evolved from a leaf into a configurable subtree. This change makes the generated mock API structurally uniform and keeps consumer call sites stable as dependencies grow.

What changed

  • removed the needsConfigurationStruct split from mock generation so every edge now routes through .safeDIBuilder on a config object
  • updated root SafeDIParameters generation to always store config objects for tree children
  • partitioned mock configuration output so rooted types own their own SafeDIMockConfiguration in their dedicated mock file, while the shared SafeDIMockConfiguration.swift only keeps non-rooted or orphaned config types
  • documented that every child dependency gets a configuration object, even when it is currently a simple leaf
  • refreshed the mock-generation golden tests to match the new generated API

Validation

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

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (855ee44) to head (0d5fa2f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #235   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           41        41           
  Lines         5752      5715   -37     
=========================================
- Hits          5752      5715   -37     
Files with missing lines Coverage Δ
...afeDICore/Generators/DependencyTreeGenerator.swift 100.00% <100.00%> (ø)
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.

dfed and others added 4 commits April 9, 2026 16:54
…ugin setup

When Xcode builds an SPM package, context.tool(named:) returns a path
with unresolved build variables (e.g. /${BUILD_DIR}/${CONFIGURATION}/SafeDITool)
that cannot be executed as a subprocess during createBuildCommands. This
catches that failure, emits a warning, and falls back to the lightweight
PluginScanner approach already used by the XcodeBuildToolPlugin.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dfed dfed changed the title [codex] Always generate mock configuration wrappers Always generate mock configuration wrappers Apr 10, 2026
@dfed dfed self-assigned this Apr 10, 2026
@dfed dfed marked this pull request as ready for review April 10, 2026 03:38
@dfed dfed merged commit c47f428 into main Apr 10, 2026
17 checks passed
@dfed dfed deleted the codex/remove-needs-configuration-struct-worktree branch April 10, 2026 03:40
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