Skip to content

2.3.0

Latest

Choose a tag to compare

@dfed dfed released this 20 Nov 02:24
· 20 commits to main since this release

New

SafeDI 2.3.0 is for codebases with many modules. Types keep their access levels, each module can generate its own part of the tree, an implementation can live above the feature that uses it, and mocks work across modules. The Manual’s “Adopting SafeDI in a large codebase” shows how these fit together (#531).

package and internal access

  • @Instantiable types, their initializers, extensions’ instantiate(…) methods and hand-written mocks may be package or internal wherever the code that builds them can reach them: internal when the type is built in its own module, package when another module of the same package builds it, and public or open across packages. 2.2.0 required public or open. The macro rejects only private and fileprivate, with a fix-it (#489, #504, #509, #552).
  • When building a type needs wider access, SafeDITool generate reports each declaration that must widen, once, at the declaration, with a fix-it. Where declaring an enclosing type a seam would move the construction into a module that can see the type, the error offers that too. This covers the types a constructed type is nested in, the type an extension extends, namespaces declared in extensions, and names written in backticks (#509, #534, #543, #555, #569, #575).
  • package access needs every module compiled with one -package-name. SwiftPM passes it. Under Xcode and Tuist set SWIFT_PACKAGE_NAME, under Bazel package_name, and in a custom build generate --package-name. When SafeDI is not told that two modules share a package, the access error offers giving them one, naming your build’s setting, beside making the declaration public (#504, #567, #574, #647, #673).
  • Two modules may each keep a type of one name to themselves. SafeDI now accepts two such @Instantiable types in modules that a third module reads, when that module cannot name either, so an app that reaches both through seams builds (#622).

Per-module dependency trees (seams)

A type declared @Instantiable(generateDependencyTree: true) is a seam. Its own module generates its tree as an initializer that takes what the tree needs from outside, and every tree that reaches the seam calls that initializer, so a change inside the seam’s tree recompiles only the seam’s module and the calls to it. Unlike a root, a seam may receive and forward dependencies, and it needs no root above it (#525). The Manual’s “Generating a dependency tree per module” describes seams in full.

// In module Feed, which depends on the module that declares `Session`, a `public` @Instantiable type.
public protocol FeedService {
    func refresh() async
}

@Instantiable(generateDependencyTree: true, generateMock: .public)
public final class FeedScreen: Instantiable {
    init(session: Session, service: FeedService) {
        self.session = session
        self.service = service
    }

    @Received private let session: Session
    @Instantiated private let service: FeedService
}
  • What the initializer takes. The seam’s own @Received and @Forwarded properties, then each dependency its tree receives that nothing inside the tree provides. A value the tree receives from outside is an @autoclosure, created when the tree first reads it, as an inline build creates it (#525, #578).
  • Generated calls, and calls you write. The initializer generated calls use has labels that start with __safeDI_, and its shape can change in any release. Each generated call names an enum generated beside it, so a call generated against a stale signature fails to compile, with a comment saying what to fix under your build system. To call a seam from code you write, such as code that does not use SafeDI yet, set #SafeDIConfiguration(generatePlainDependencyTreeInitializers: true) in the seam’s module: that adds an initializer with readable labels, which takes every argument as a plain value and keeps nothing of the caller but its hole builders. Its parameters have no defaults, so a hand-written call stops compiling when the seam starts taking a parameter at the call’s access level (#525, #557, #561, #611, #615, #631).
  • Access. Each parameter is as visible as the types it names. When some are narrower than the seam, the seam gets one initializer per access level, each caller calls the narrowest one it can reach, and a narrower parameter never changes a wider initializer. Only the parameters’ types must be that visible: the types the tree builds keep their own access. A type SafeDI reads no declaration of, such as a system framework’s, counts as public (#527, #541, #555, #580, #640).
  • Holes. A type the seam’s tree instantiates that no declaration the seam’s module can see fulfills, such as a protocol only the app implements, is a hole. The seam takes one builder per hole type, whatever wrappers its places are held in, named for what it builds: feedServiceBuilder here, impl_FeedServiceBuilder when fulfilledByType: "Impl" fills it. The builder returns the plain value, and the seam wraps it where a place is held in a wrapper. A builder whose places forward nothing takes nothing ({ StubFeedService() }, StubFeedService.init), also for places held in ErasedInstantiator<(), Maker>, which take makerBuilder: @escaping () -> Maker, unless its only places are held in an Instantiator, which keeps Instantiator<Maker>.Builder. Places held in an instantiator that forwards a value take that wrapper’s own Builder, such as makerBuilder: @escaping Instantiator<Maker>.Builder, which is handed the value the instantiator forwards. The generated code of a module that can see an implementation fills the builder; a seam that cannot passes it up to its own caller; a root that cannot is an error naming the modules to list. Adding a place never renames another builder, unless the new builder’s label coincides with an existing one’s, when SafeDI names both apart by their types; a label equal to another parameter’s takes a trailing _. A filled builder keeps alive only what its implementation reads (#528, #583, #612, #627, #628, #690, #731, #738, #757, #781, #821).
  • @Sendable places. A place built inside a @Sendable function or held in a Sendable wrapper is filled by a @Sendable builder of its own, such as feedServiceSendableBuilder. A value a seam defers that a Sendable builder reads is held in a SendableLazilyInstantiated, which needs the Sendable wrappers’ deployment targets (#578, #626, #654).
  • Screens that open each other through received instantiators work inside and across seams (#651).
  • Errors at a seam. SafeDI reports, at the seam and with what to change, each tree a seam cannot build as an inline build would; the Manual’s “Where a seam differs from building its tree inline” lists them (#525, #562, #573, #578, #651, #658, #670).
  • Under the Xcode project plugin, every tree is built inline, seams included; the Manual’s “Limits of the Xcode project plugin” says what it supports (#535, #559).

Public mocks

  • @Instantiable(generateMock: .public) generates a public mock() in the declaring module, which tests and previews in any module, of this package or another, can call. generateMock: now takes a MockGeneration: .none, .internal or .public; false and true still mean .none and .internal (#530).

  • Like a seam’s initializer, a public mock has one tier per access level among its parameters. A dependency the mock can build is a T? = nil parameter: pass a value to use it, or nil to build it. A hole takes a required builder, as at a seam, and a mockOnly fake the module can see fills it instead (#530, #545, #629, #784, #785):

    // In a package that depends on Feed’s library product.
    import Feed
    
    struct StubFeedService: FeedService {
        func refresh() async {}
    }
    
    #if DEBUG
    func makeFeedScreen() -> FeedScreen {
        FeedScreen.mock(feedServiceBuilder: { StubFeedService() })
    }
    #endif
  • A mock that another module generates calls a type’s public mock wherever it cannot build the type’s tree itself, at the narrowest tier it can reach, and shares the values it already holds with that call. It fills a hole of the called mock where the same types built for production fill it, and otherwise takes the builder as a parameter of its own (#530, #545, #547, #591, #692, #702, #707, #740, #741, #786, #799, #805, #806, #807, #808, #834).

  • Mocks never call a seam’s generated initializer: a mock in another module builds the seam’s whole tree itself, unless the seam has generateMock: .public, whose mock it calls (#530, #531).

  • Public mocks compile in modules whose declarations default to the main actor (-default-isolation MainActor), on the declaring and the calling side (#641). Some shapes in such modules still need a workaround; see Known issues (#661).

Dependency cycles

  • A cycle is accepted when any dependency along it is an instantiator, from whichever point a tree enters it. 2.2.0 accepted a cycle only when the dependency that closed it was an instantiator, so one graph built from one root and was rejected from another, or by its type’s own mock() (#571).

  • Screens that open each other through received instantiators. A type can receive an Instantiator, ErasedInstantiator or a Sendable twin declared above it even when that instantiator builds the receiver or a type above it. So two screens can open each other with neither instantiating the other, and their parent declares both builders once. 2.2.0 rejected this as a dependency cycle. Each instantiate() builds in the scope that declares the instantiator, each receiver is handed an instantiator of its own, and a tree its owner releases is freed. Among the properties one type creates, a cycle of receives is accepted when every property on it is an instantiator; one with a constant or a LazilyInstantiated on it is still an error. This works at any depth, through fulfilledByType and renames, in generated mocks, and through seams (#649, #650, #651):

    @Instantiable(isRoot: true)
    public final class Root: Instantiable {
        public init(profileBuilder: Instantiator<ProfileScreen>, followersBuilder: Instantiator<FollowersScreen>) { … }
    
        @Instantiated private let profileBuilder: Instantiator<ProfileScreen>
        @Instantiated private let followersBuilder: Instantiator<FollowersScreen>
    }
    
    @Instantiable
    public final class ProfileScreen: Instantiable {
        public init(followersBuilder: Instantiator<FollowersScreen>) { … }
    
        @Received private let followersBuilder: Instantiator<FollowersScreen>
    }
    
    @Instantiable
    public final class FollowersScreen: Instantiable {
        public init(profileBuilder: Instantiator<ProfileScreen>) { … }
    
        @Received private let profileBuilder: Instantiator<ProfileScreen>
    }

Other additions

  • Attributes on generated initializers. generatedInitializerAttributes: "@MainActor" adds attributes to a root’s generated init() and to a seam’s generated initializers, as mockAttributes does for mock(). generatedAttributes: gives all of them the same text (#510).

  • More mock() parameters default to a hand-written mock. A mock() parameter for a value the mock cannot build, such as a @Forwarded property or a received type with @Forwarded properties, defaults to the hand-written mock SafeDI would build its type with, a protocol’s mockOnly fake included, when that mock takes no required argument and the module can call it. 2.2.0 defaulted only a @Forwarded property whose own type had a mockOnly mock (#570):

    -static func mock(service: Service) -> Screen
    +static func mock(service: Service = FakeService.mock()) -> Screen
  • Shared mock() parameters are documented. A mock() parameter handed to several types that each create that dependency in the app says so in a documentation comment above mock(), which Quick Help shows, naming each property it is passed to (#614).

  • Builder typealiases. Instantiator<T>.Builder, ErasedInstantiator<F, T>.Builder and their Sendable twins name the closure each wrapper is created with, so code can spell it, for example where a builder forwards a value that is itself a closure (#712).

  • SafeDITool query needs (beta). The report lists each flat mock() parameter’s default, and the JSON adds defaultExpression to unfulfilledDependencies; formatVersion stays 0. A --module-info module is named after the module its file records, and two files that record one module, or a directory named like a module a file records, are an error (#570, #577).

Build integrations

  • Bazel.
    • A module lists only the modules it depends on directly in safedi_deps; safedi_swift_library collects the SafeDI modules beneath it, as rules_swift collects Swift modules. Complete lists keep working (#610).
    • SafeDI’s Bazel module depends on the Bazel Central Registry’s swift-syntax and swift_argument_parser instead of translating its Package.swift with rules_swift_package_manager, which leaves your module graph. A project that also depends on the registry’s swift-syntax resolves one version for itself and SafeDI. Through these modules your graph resolves at least rules_swift 3.6.1, apple_support 2.5.4 and rules_apple 4.5.0; none changes its compatibility level or requires a newer Bazel, so nothing is required, but Bazel warns about a lower version your MODULE.bazel declares until you raise it (#599).
    • @safedi//:SafeDI and @safedi//:SafeDITool are short labels for the library and the tool (bazel run @safedi//:SafeDITool -- …); the old labels keep working. @safedi//bazel:safedi is a bzl_library for your own macros. Registry releases are tested on Bazel 8 as well as 9 (#599).
    • safedi_compile and safedi_swift_library take package_name (#504).
  • Tuist. The Manual documents the SafeDITuist plugin, declared by sha: (the commit git ls-remote https://github.com/dfed/SafeDI refs/tags/2.3.0 prints), since no Tuist version loads it by tag:. The plugin passes each target’s module and package names to SafeDITool (#504, #531, #556).
  • Xcode project plugin. safedi-release-install installs the SafeDITool it downloads only when its SHA-256 matches the one SafeDI records for that release; a download that differs is deleted, and the command fails with both hashes; running it again retries the download (#600).
  • Custom builds. generate takes --module-name, --package-name and --project-root, and --transitive-module-info-file-path, a file listing the .safedi of every module beneath this one, as the Bazel rule passes. Each .safedi file carries what a seam or public mock of its module needs, so a module is never listed only for another module’s seam or public mock (#504, #564, #577, #581, #610).

Documentation

The new Documentation/QuickStart.md, which the README links to, adds SafeDI to an existing app of several modules, step by step, in a Swift package, an Xcode project, Bazel or Tuist. The Manual is in reading order, with edge-case rules in a closing Reference section. New sections cover access levels, per-module trees, public mocks, adopting SafeDI in a large codebase, the Tuist integration, and which modules a Bazel, Tuist or custom-build module lists. It also says how a module whose declarations default to the main actor uses SafeDI, and which Bazel archives build SafeDITool from source (#516, #531, #581, #584, #588, #607, #625, #664).

Breaking changes

Each item is measured from 2.2.0. Every other declaration that is now an error did not build correctly on 2.2.0. The macros report items 4 to 10 as you type, each with a fix-it where one is safe. SafeDITool generate reports at build time item 2, item 4’s #if chains, item 8 on declarations the macro does not see, item 11, and the errors in items 12 to 14 and 18 to 20. Diagnostic text changed throughout, so update any script that matches SafeDI’s error or warning text. A build that treats warnings as errors also fails on the new warnings under Diagnostics until each is addressed. When upgrading from 2.1.x or earlier, read the 2.2.0 release notes as well.

Integrations

  1. A root’s init() is generated only in the module that declares it (#564).
    • Before: a target whose plugin read another module’s root (the SwiftPM plugin hands each target its dependencies’ files, and additionalDirectoriesToInclude adds a directory’s) also generated extension FeatureRoot { public convenience init() { … } }.
    • After: that target’s file holds only // SafeDI generates FeatureRoot’s init() only in Feature, the module that declares FeatureRoot. …, and a call of FeatureRoot() there fails with “missing argument for parameter 'dependency' in call”.
    • Edit: if you call a root’s init() from another target, add the SafeDI plugin to the target that declares the root.
  2. Bazel and custom builds name the module (#504, #577).
    • Before: SafeDITool generate … --module-info-output Feature.safedi ran.
    • After: Error: '--module-info-output' requires '--module-name': a module info file names the module it describes. A safedi_compile target needs module_name.
    • Edit: pass --module-name (and --package-name where the module has one). safedi_swift_library sets module_name for you; add it to a safedi_compile you declare yourself.
  3. Tuist’s dependencies: lists module names (#577).
    • Before: SafeDI.preCompileScript(module:dependencies:) read each dependency’s <module>.safedi, named after that target’s module: argument, its sources directory.
    • After: it reads $(PRODUCT_MODULE_NAME).safedi, so dependencies: lists module names.
    • Edit: only a target whose sources directory and module name differ needs its dependencies: entries changed to the module name.

Declarations now rejected

  1. Renames of renames, and a rename of a property to itself (#563).
    • Before: @Received(fulfilledByDependencyNamed: "b", ofType: A.self) let c: A beside @Received(fulfilledByDependencyNamed: "a", ofType: A.self) let b: A on one type built and compiled. A rename of a property to itself compiled where no tree built the type (SafeDITool already rejected it in a tree).
    • After: the macro reports “c is renamed from b, which this declaration also renames. Rename a, the property the renames start from, instead.”, and “a is renamed from itself with the same type, which renames nothing. Receive it with @Received.” SafeDITool also rejects such a chain formed by #if blocks that are active together, or by the clauses of a condition only the compiler decides, such as os(iOS).
    • Edit: apply the fix-it, which renames from the start of the chain. On an optional rename of an onlyIfAvailable rename, the result is nil where the start of the chain is unavailable, even where an ancestor declares the middle label. For an #if chain, give the first rename another label.
  2. Erased renames of an optional dependency (#579).
    • Before: @Received(fulfilledByDependencyNamed: "token", ofType: Secret?.self, erasedToConcreteExistential: true) let auth: AnyAuth generated AnyAuth(token). It compiled only where the eraser’s initializer took an optional, as init(_: Secret?), and then built a non-nil AnyAuth(nil) when token was nil.
    • After: the macro reports “ofType: names an optional dependency, so a property that receives it with erasedToConcreteExistential: true is nil where the dependency is. Its type must be optional, spelled with ?.” The generated code is (token as Secret?).map { AnyAuth($0) }, which is nil when token is.
    • Edit: apply the fix-it, which declares let auth: AnyAuth?, or name a non-optional dependency in ofType:.
  3. erasedToConcreteExistential: true where no erasing initializer can exist (#592).
    • Before: @Instantiated(fulfilledByType: "DefaultService", erasedToConcreteExistential: true) let service: any ServiceProtocol generated any ServiceProtocol(DefaultService()), which never compiled, so only a declaration that no tree built was accepted.
    • After: the @Instantiated and @Received macros report it on an existential spelled with any or as a composition (P & Q, (any P)?), including the type a wrapper builds, and on an erased rename into a SafeDI wrapper of a dependency whose ofType: is not a function type.
    • Edit: remove the argument (the fix-it does), or erase where the wrapper is instantiated with @Instantiated(fulfilledByType:erasedToConcreteExistential:).
  4. async or throws hand-written mocks (#509).
    • Before: public static func mock() async -> Service compiled where no generated mock called it; a generated mock calls hand-written mocks synchronously, so it failed everywhere else.
    • After: the macro reports “This mock() method must be neither async nor throws: generated mocks call it synchronously.”
    • Edit: remove the effect specifiers (the fix-it does).
  5. Reserved type-name prefixes (#790).
    • Before: types named SafeDIScope_UserService or SafeDIMockScope_Helper built and compiled.
    • After: the @Instantiable macro, and SafeDITool for declarations the macro does not see, report “The type name SafeDIMockScope_Helper begins with SafeDIMockScope_, a prefix SafeDI reserves for names in the code it generates.” The reserved prefixes are __safeDI_, SafeDIScope_, SafeDISendableScope_, SafeDIMockScope_ and SafeDISendableMockScope_. This holds even in a module with no seam or public mock.
    • Edit: rename the type.
  6. Reserved labels written in backticks (#817).
    • Before: @Instantiated let `__safeDI_editor`: Editor and @Instantiated let `safeDIOverrides`: Editor built, while the same labels without backticks were already errors. The __safeDI_ label compiled, with a generated mock beneath it too; the safeDIOverrides label compiled only where no generated mock reached it, and failed in the generated mock’s code otherwise.
    • After: the @Instantiable macro reads a name without its backticks, so it reports “__safeDI_editor begins with __safeDI_, a prefix SafeDI reserves for names in the code it generates. Rename it so that it does not begin with __safeDI_.”, as it does for the unquoted label. This covers property labels, instantiate(…) parameter names and default-valued parameter labels, for the __safeDI_ prefix and for each name reserved whole (safeDIOverrides, safeDIBuilder, and the wrapper types generated code builds, such as Instantiator).
    • Edit: rename the property or parameter.
  7. Parameters named _, and names encoded two ways (#519).
    • Before: public static func instantiate(dep _: Dep) -> Thing, or a type whose initializer parameter café is written with U+00E9 and whose property café is written with e followed by U+0301, compiled where no tree built the type. Where a tree built it, SafeDITool reported the _ parameter as a dependency named _ that nothing fulfills, and generated code for the two encodings that did not compile (“cannot find 'café' in scope”).
    • After: the @Instantiable macro reports “This parameter of instantiate(…) has no default value, so it is a dependency, which SafeDI names by the parameter’s inner name. _ names no dependency, so nothing can fulfill it. Name the parameter, or give it a default value.”, and “The names café (U+0063 U+0061 U+0066 U+00E9) and café (U+0063 U+0061 U+0066 U+0065 U+0301) look the same but are encoded differently, so SafeDI cannot tell them apart. Rename one of them.”
    • Edit: name the parameter (where the label can name it, the fix-it names the parameter after its label), and spell both names the same way.
  8. mockOnly fakes in additionalMocksToGenerate (#557).
    • Before: listing FakeService, whose only declaration is @Instantiable(…, mockOnly: true, customMockName: "fake"), generated extension FakeService { static func mock() -> FakeService { FakeService.fake() } }. A fake whose method is named mock was already an error.
    • After: “This #SafeDIConfiguration lists FakeService in additionalMocksToGenerate, but the only @INSTANTIABLE declaration of FakeService SafeDI read is mockOnly: true …”
    • Edit: remove the entry and call the fake’s own method, or name that method mock so existing mock() calls keep compiling.

Values and accepted graphs

  1. onlyIfAvailable renames are always their own value (#572).
    • Before: a rename declared with onlyIfAvailable: true whose dependency is unavailable fell through to an enclosing property of the rename’s label: under a Root that instantiates token, Child’s @Received(fulfilledByDependencyNamed: "missing", ofType: Token.self, onlyIfAvailable: true) let token: Token? got Root’s token, and so did a Grand beneath it that received token only if available.
    • After: let token: Token? = nil for Child and every type below it. In a dependency tree, a dependency received only if available inside the property it is built from is nil too, even beside a farther optional declaration of its name, which 2.2.0 passed, as generated mocks already passed nil. A type built as a rename’s dependency that requires that rename is a dependency-cycle error, also under an enclosing property of the rename’s name, which 2.2.0 passed it.
    • Edit: to keep a value, declare or receive it under its own label.
  2. Values redeclared inside a lazy cycle (#533, #639). A type built again through a cycle closed by an instantiator now receives the nearest declaration above it (see Fixes). Two shapes 2.2.0 compiled are now errors:
    • A type the cycle builds again receives one label in two forms that no one declaration between the cycle’s ends can carry, such as x: X? beside x: Instantiator<X>?, or a LazilyInstantiated<X> beside its instance. Before: the type built again read the declaration above the cycle. After: “A and the types it builds receive x as x: Instantiator<X>? and x: X?, which one value cannot carry together.” Edit: receive the forms under different labels.
    • A type between the cycle’s ends declares the label as another type: A receives x: X from Root, and a nested cycle builds A again beneath C, which declares x: Y. Before: every A got Root’s x. After: the hidden-label error, “C declares x: Y with the same label, so the types below C receive x: Y instead.” Edit: give the redeclaration a different label.
  3. Instantiators received in their own loop (#649, #743).
    • Before: an instantiator received with onlyIfAvailable: true inside the tree it builds, on the type it builds, or from an instantiator beside it that receives it back, was nil, as 2.2.0’s Manual said: T4(t4Builder: nil, t2Builder: nil).
    • After: such a receive gets the instantiator, let t4Builder = Instantiator<T4>(__safeDI_t4Builder) and T4(t4Builder: t4Builder, …). It is nil only where no instantiator of that name is declared above the receiver, or where a property that is not an instantiator waits in the same circle. A rename of an instantiator follows the same rule. Two types that receive one instantiator this way no longer hold the same wrapper object; each builds the same thing.
    • Edit: code that relied on the nil can stop receiving the instantiator.
    • One shape is now an error: a type built in a @Sendable function (inside a SendableInstantiator or SendableErasedInstantiator) that receives, only if available, an instantiator that is not Sendable, where the receive sits inside the tree that instantiator builds or inside the tree of an instantiator that receives it back. For example, Root holds aBuilder: SendableInstantiator<A> and bBuilder: Instantiator<B>, A receives bBuilder only if available, and B requires aBuilder. Before: A(bBuilder: nil) inside the @Sendable function. After: the Sendable capture error SafeDI already reported for the same receive anywhere else. Edit: declare the instantiator, and the receive, as its Sendable twin, or remove the receive, which has only ever been nil.

Generated mocks

  1. SafeDIOverrides and SafeDIMockConfiguration fields are read-only (#754).
    • Before: let profile: ((UserService) -> Profile)?, so an initializer you wrote in an extension could assign the fields one by one.
    • After: var profile: ((UserService) -> Profile)? { __safeDI_storage.profile }, and that initializer fails with “cannot assign to property: 'profile' is a get-only property”. Calls of .init(…), mock() signatures and field reads are unchanged. In a module whose declarations default to the main actor, the configuration of a main-actor type is on the main actor too, so its fields can no longer be read, or named in a key path, from nonisolated code.
    • Edit: have the initializer call self.init(…); read main-actor configurations’ fields from the main actor.
  2. The SafeDIOverrides entry of an @Instantiated(fulfilledByType:) property configures the named type (#590).
    • Before: when another type listed the property’s type in fulfillingAdditionalTypes, the mock built that other type, and its entry was filter: CoreFilter.SafeDIMockConfiguration, or a closure (() -> FilterProtocol)? when CoreFilter had no dependencies.
    • After: the mock builds AppFilter, as production does, and the entry is filter: AppFilter.SafeDIMockConfiguration, or a closure (() -> FilterProtocol)? when AppFilter has no dependencies.
    • Edit: update an override that configured the other type’s construction, such as .init(filter: .init(level: { … })).
  3. No override for a receive that production always passes nil (#788).
    • Before: when one type in a mock’s tree receives token: Token? only if available and a type beneath it requires token: Instantiator<Token>, the mock offered token_Token: Token? = nil in SafeDIOverrides and passed it to the receive only if available, though production always passes nil there. Two shapes compiled this way: Screen, the mocked type, receives token only if available and a type it builds requires token: Instantiator<Token>; or a type the mock builds requires token: Instantiator<Token> and builds a type, such as Holder, that receives token only if available.
    • After: the entry is gone, and the mock passes nil: Screen(token: nil, child: child) in the first shape, Holder(token: nil) in the second. At the entry’s default, nil, 2.2.0’s mock passed nil too, so the mock builds the same values. A call that sets the entry fails with “extra argument 'token_Token' in call”.
    • Edit: delete the token_Token: argument.
  4. A label received in two required forms along a mock’s tree (#593, #597).
    • Before: when Screen receives x: A and a type it builds requires x: Instantiator<A>, the mock generated x_A and x_Instantiator__A entries for a tree no production root can build.
    • After: the hidden-label error, “In the mock of Screen, Screen receives x: A with the same label, so the types below Screen receive x: A instead … Receive x: Instantiator<A> and x: A under different labels to fix.” This applies to two required receives of one label, one beneath the other or both on one type, in the mocked type’s tree or the tree of a dependency the mock builds beside it. The same label in sibling branches, and pairs where one receive is only if available, are accepted.
    • Edit: receive the two forms under different labels.
  5. A hand-written mock that returns another type and takes the type’s dependencies in another order (#741).
    • Before: SystemClock fulfills Clock and declares instantiate(primary: Source, backup: Source, zone: String = "UTC") -> SystemClock beside a hand-written customMock(backup: Source, primary: Source, zone: String = "UTC") -> Clock. A mock that built clock: Clock with customMock and systemClock: SystemClock with instantiate(…) configured both with one SystemClock.SafeDIMockConfiguration, which the type has because of its default-valued zone. It compiled, and a builder set in that configuration was handed primary and backup in one order for clock and in the other for systemClock.
    • Still accepted: a reordered hand-written mock that returns the type itself, a mock that builds only one of the two properties, and a type with no default-valued parameter, whose two properties get separate override closures.
    • After: “The two take different parameters, but both properties are configured with one SystemClock.SafeDIMockConfiguration. Make customMock return SystemClock, so that it builds both properties, or give customMock exactly the parameters of SystemClock’s instantiate(…) method, in the same order.”
    • Edit: as the message says.
  6. A mock whose @Sendable builder would capture a LazilyInstantiated (#815).
    • Before: a generateMock type holding gizmo: LazilyInstantiated<Gizmo> (a type the mock cannot build) and a SendableInstantiator<Settings> whose tree receives gizmo got a mock that read gizmo.instance inside a @Sendable function. It compiled in the Swift 5 language mode with a warning, and failed in Swift 6.
    • After: the mock reports the error production reports for the same tree, “gizmo … cannot be received inside a @Sendable function … Declare gizmo on Screen as SendableLazilyInstantiated<Gizmo> to fix.”
    • Edit: as the message says.

Fixes

Generated code

  • A type built again through a cycle closed by an instantiator (Instantiator, SendableInstantiator, or a lazily instantiated dependency) receives each property from the nearest declaration above it, including a value a type inside the cycle forwards, as the Manual says. 2.2.0 passed the declaration above the cycle, or nil to a receive only if available. Where that nearest declaration is a LazilyInstantiated and the type built again receives its instance, the instance is created when the cycle’s instantiator builds the type, before the type reads it. 2.2.0 handed that type the value declared above the cycle instead, so the lazy value was created only when something read it. Where the type built again receives the label in two forms that no one declaration provides, it gets the nearest declaration of the form it requires, and a form received only if available that no such declaration provides gets nil; shapes no one value can carry are an error (#533, #639; see Breaking changes).
  • Three cycle shapes build as written (#571):
    • A dependency with the same label and type as a declaration above it, but fulfilled by another type, builds the type it names. 2.2.0 took it for a cycle: as an instantiator it built the type above (a flowBuilder fulfilled by SettingsFlow inside LoggedInFlow built another LoggedInFlow), and as a constant or LazilyInstantiated it was rejected.
    • A type beside or beneath an instantiator that closes a cycle, and that receives the instantiator’s label, is passed that instantiator from every entry point. 2.2.0 rejected it or passed nil.
    • A type built inside a dependency it receives, beneath a type that forwards that dependency, is passed the forwarded value. 2.2.0 rejected it as a cycle.
  • In a dependency tree, a type that requires an onlyIfAvailable rename is passed nil where nothing holds the rename’s dependency, or where that dependency is an ancestor still being built. 2.2.0 rejected both (#572).
  • An @Instantiable nested in a namespace that names one of the namespace’s types unqualified, such as Mode, generates code that compiles. 2.2.0 failed with “cannot find type 'Mode' in scope”, or named a top-level Mode. A receive spelled NestedType inside Grandchild matches a forwarded Grandchild.NestedType (#585).
  • An ErasedInstantiator whose first generic argument is a tuple of the built type’s @Forwarded properties works when an element’s type is more than one bare name, such as (count: Int?, names: [String]), and accepts any spelling that syntax shows is the same type: Optional<Int>, Array<Int>, attributes in another order, or a Swift. qualifier (#604, #606).
  • A closure’s typed throws(E), a variadic parameter, an attribute’s qualifier or arguments (@convention(c)), nonisolated(nonsending), and a value generic argument (InlineArray<3, Int>) reach generated code as written, and two types that differ only in one of them no longer match (#605).
  • An initializer parameter @escaping OnTap matches a property of type OnTap, a typealias of a closure, and @Sendable @escaping () -> Void matches a @Sendable () -> Void property, whatever the attributes’ order (#557, #616).
  • A generated file imports the module that declares a type it builds for a property spelled as another type, through fulfilledByType: or fulfillingAdditionalTypes:. 2.2.0 failed with “cannot find 'DefaultThing' in scope” until some file happened to import that module (#617).
  • Generated imports carry the access level each needs. When one of a module’s files gave an import an access level, such as internal import Foundation, 2.2.0’s generated imports failed with “ambiguous implicit access level” (#551).
  • A rename with erasedToConcreteExistential: true of an optional dependency builds the erased value only when the dependency is present (#579; see Breaking changes).

Generated mocks

  • A mock builds the type an @Instantiated(fulfilledByType:) property names, as the app does, even when another type lists the property’s type in fulfillingAdditionalTypes. 2.2.0 built that other type, or called its merged mockOnly mock. A mockOnly fake of the property’s type still replaces it (#590; see Breaking changes).
  • A mock compiles when a type it builds receives a label only if available and a type beneath that one requires the label in a form the first cannot read, such as token: Token? above token: Instantiator<Token>. The mock passes the receive nil, as production does. 2.2.0 handed the optional value to the type that requires the instantiator, and failed with an error such as “cannot convert value of type 'Token?' to expected argument type 'Instantiator'” (#788; see Breaking changes).
  • A mock passes nil to a receive only if available in each place production does, not once for every place a type is built. Where the mocked type receives Source, which requires token: Instantiator<Token> and builds a Leaf that receives token: Token? only if available, and also builds a Reader that requires token: Token beside a second Leaf, the mock builds Leaf(token: nil) inside Source, as production does, and hands the other Leaf its Token. 2.2.0 handed both Leafs the Token. SafeDIOverrides and the mock() parameters are unchanged (#846).
  • A mock compiles when one of the mocked type’s renames has a label that a dependency the mock builds receives as another type. 2.2.0’s rename hid the mock() parameter for that receive (#594).
  • A mock compiles when a type is built only beneath a node that repeats one of its ancestors’ types, such as through an Instantiator of an ancestor, and its configuration is read there. 2.2.0 failed with “type 'Gamma' has no member 'SafeDIMockConfiguration'” (#789).
  • A mock compiles for a type whose initializer, instantiate(…) or hand-written mock has a labeled, default-valued @autoclosure parameter, such as retries: @autoclosure () -> Int = 3, and evaluates the value where it builds the type. A throwing @autoclosure parameter is taken as one that does not throw, so the value passed needs no try, and one whose default throws, such as seed: @autoclosure () throws -> Int = try loadSeed(), is left to that default, as production leaves it (#595, #832).
  • A mock compiles when a type in its tree has a default-valued @escaping parameter whose type is a typealias of a closure, such as onTap: @escaping Handler = {}. 2.2.0’s configuration took it without @escaping, and Debug builds failed with “assigning non-escaping parameter 'onTap' to an '@escaping' closure” (#542).
  • A mock compiles for a type built inside a SendableInstantiator or SendableErasedInstantiator whose default-valued closure parameter takes or returns a @Sendable function, such as onEvent: @escaping (@Sendable () -> Void) -> Void = { _ in }. 2.2.0’s configuration stored it as a closure that is not @Sendable, and the mock failed with “capture of '…' with non-Sendable type '(@sendable () -> Void) -> Void' in a '@sendable' local function” (#831).
  • A mock compiles when a dependency is labeled Type or Protocol: its configuration declares the member in backticks. 2.2.0 failed with “type member must not be named 'Type'” (#758).
  • A mock whose tree builds types inside a SendableInstantiator compiles when two override paths join to one name, such as header.leaf and a sibling labeled header_leaf. 2.2.0 declared one local twice (#679).
  • A mock that takes two received closures of one label, one of them nonisolated(nonsending), names that parameter handler_nonisolatednonsending_Void_async_to_Void. 2.2.0 put parentheses in the name, which did not compile (#678).
  • A mock creates a type’s own onlyIfAvailable rename where the app does. 2.2.0 passed the type the safeDIOverrides entry for the rename’s label, which is nil unless a test sets it (#537).
  • A mock keeps the any that a protocol-typed dependency’s declaration spells: in the binding and builder function it creates for the dependency, in the override closures of SafeDIOverrides and SafeDIMockConfiguration, and in a mock() parameter for a dependency no type fulfills, and it takes an opaque some P parameter as any P. 2.2.0 spelled these without it, as in (() -> Service)? for @Instantiated let service: any Service. A dependency the mock promotes to its root is spelled as the mocked type declares it, also where a type in its tree spells it without any: when the mocked type receives shared: any Service and a type in its tree receives shared: Service, the mock() parameter is shared: any Service, also where the dependency is received only if available, as an optional or as a LazilyInstantiated. 2.2.0 took the tree’s spelling. A dependency the mocked type receives through a rename is spelled as the rename’s property declares it, not as its ofType:: beside @Received(fulfilledByDependencyNamed: "shared", ofType: Service.self) let other: any Service, the mock() parameter is shared: any Service, where 2.2.0 had shared: Service. So a module that enables the ExistentialAny upcoming feature and builds with warnings as errors compiles its mocks (#811).
  • Where the types in a mock’s tree spell a dependency the mocked type does not receive both ways, such as shared: Service and shared: any Service, the mock spells it any Service in its mock() parameter, its binding and its SafeDIOverrides entry, by value, as an optional and inside a LazilyInstantiated. 2.2.0 took the spelling of the receiver declared first, so swapping two @Instantiated declarations turned shared: any Service into shared: Service. A type in the tree that receives the dependency through a rename, such as @Received(fulfilledByDependencyNamed: "shared", ofType: Service.self) let other: any Service, counts as its property spells it, any Service, where 2.2.0 took Service from its ofType: (#844).
  • A mock() parameter is spelled the same on every run where one type in the tree receives the dependency by value and another lazily, such as service: any Service and service: LazilyInstantiated<Service>, and no type fulfills it. The mock spells the parameter and the LazilyInstantiated it wraps around it the more explicit way, any Service and LazilyInstantiated<any Service>. 2.2.0 chose between the two spellings in an order that changed from run to run (#812).

Build integration

  • Bazel. Errors and warnings name each file by the path Bazel hands SafeDITool, as swiftc does, so editors and rules_xcodeproj open them. 2.2.0 named a path inside the action’s sandbox, which Bazel deletes. bazel run @safedi//bazel:safeditool accepts paths relative to the directory it runs in (#536, #560).
  • Tuist. A project in a subdirectory of the workspace, such as Projects/Feature/Project.swift, finds SafeDITool; its first build used to fail with “SafeDITool not found” even after tuist install. -D flags in OTHER_SWIFT_FLAGS count as active compilation conditions, so a build that stopped at SafeDI’s #error because of such a flag builds, and a generated import guarded only by such a flag follows the clause the compiler compiles (#553, #560).

Diagnostics

New errors

Each of these declarations never built correctly. They used to crash SafeDITool, stop it without naming a file, or fail in the compiler inside generated code:

  • A declaration that repeats a dependency label, including one declared in each clause of an #if that only the compiler decides, such as #if os(iOS). Declare it once, outside the #if (#519).
  • A hand-written mock that takes, with no default value, a dependency the type declares only inside an #if clause the build leaves inactive. The error is at that clause’s #if, #elseif or #else line, and offers a default value, and, where moving the mock into the clause compiles under every condition, that move. It is reported only in builds that compile generated mocks (#792).
  • Two .safedi files that describe one module differently (#577).

Changed messages

  • Errors name their fix. A root that needs dependencies from outside is offered generateDependencyTree: true. A type nothing fulfills says how your build lets SafeDI read the module that declares it, in the words of your integration. An optional @Received let user: User? that nothing provides is offered @Instantiated let user: User together with onlyIfAvailable: true on the receive. Where declaring a received property would close a dependency cycle, the error says so and offers removing the receive or receiving it only if available; 2.2.0 offered a declaration that then failed as a cycle (#557, #672, #687).
  • The error for a @Received dependency that no @Instantiable declaration fulfills, most often a protocol received as any Api, leads with the declaration that fulfills it: decorate the type, or list it in the fulfillingAdditionalTypes of an @Instantiable type that conforms to it, and instantiate it above the receiver. It names the protocol without any, and offers forwarding the value second. 2.2.0 offered only an @Instantiated declaration, which cannot build a type nothing fulfills (#801).
  • The error for a received property that nothing fulfills no longer suggests a property that a closer declaration of the same label, of another type, hides from the receiver, since following that suggestion only moved the error. Where no suggestion is left, it suggests declaring the property. For example, where Host forwards user: Token beneath a Root that instantiates user: User, 2.2.0 asked a receive of viewer: User under Host “Did you mean user: User?”, and the error now says to declare @Instantiated let viewer: User (#815).
  • The error for a dependency cycle that no instantiator breaks names every dependency on it (#571).
  • When several declarations of one label reach a receive that a @Sendable builder would capture, the error’s remedy names every type that declares it, in source order, so following it clears every chain’s error at once (#795).
  • A mock’s @Forwarded property that a type in a received dependency’s tree cannot see, because a type above receives the label in another form, gets a remedy that names both receives to relabel. 2.2.0 said to relabel the forwarded property, which in most shapes left the receive hidden (#671).
  • The error for a received property that a closer declaration of its label hides names every declaration of that label, of another type, between the receive and what provides it, closest first, with a note at each. 2.2.0 named only the closest, so relabeling it left the receive hidden by the next one up the chain, and the build failed again with the same error naming another type (#843).
  • That error is reported once per root, for the first chain in declaration order that reaches the receive, and again only for a chain that passes other declarations that hide it. 2.2.0 reported it once for every chain, so a type built beneath two screens got two errors at one line (#842).
  • Two @Instantiable types of one name in different modules: the error names the modules and asks to rename one, instead of telling you to delete a declaration your module needs (#618, #622).
  • A type declared more than once in #if clauses gets per-clause advice, and the repeated-dependency and unfulfilled-receive hints are clearer (#557).
  • The fix-it for a required rename of an onlyIfAvailable rename passes nil where the source is unavailable (#563).
  • The macro’s fix-its that add an initializer, an instantiate() method or a mock method spell the access the type needs, instead of always public (#552).
  • The macro no longer crashes on an initializer or hand-written mock with two problems no fix-it addresses, such as public init() async throws {} (#519).
  • SafeDI’s messages spell the apostrophe ’ (#698).

Warnings

  • Deprecations. Each still works, now warns and names its replacement, and SafeDI 3.0 removes it. SafeDI’s own integrations draw none of them (#558):
    • @Forwarded on an Instantiator, ErasedInstantiator, LazilyInstantiated or a Sendable twin. Declare the wrapper @Instantiated on the type and forward what the type it builds needs, receive it from an ancestor that declares it, or forward the value it builds.
    • generate --additional-imported-modules. Use #SafeDIConfiguration(additionalImportedModules:).
    • A hand-written manifest passed to generate --swift-manifest, one that lacks the fields scan writes. Run scan first, or use --output-directory or --combined-output.
  • mockAttributes on a mockOnly declaration, which nothing reads, with a fix-it that removes it (#557).
  • The macro no longer warns about a bare nested type name in a dependency’s type, such as Mode for a Mode declared inside Feature, which SafeDI now qualifies. It still warns, with a fix-it, about a nested type spelled through Self, such as Self.Mode (#585, #589).

Performance

Measured against 2.2.0.

  • Seams. A change inside a seam’s tree recompiles only the seam’s module and the generated calls to it, instead of the whole tree in the root’s module (#525).
  • Fewer rebuilds under Bazel, Tuist and custom builds. generate writes its combined output and .safedi file only when their bytes change, and the .safedi file only when the run succeeds, so an unchanged module no longer invalidates the modules that depend on it (#577).
  • Building SafeDI’s macro plugin. Every project compiles the macro plugin from source. It now compiles only the code the macros use: a release build of the macro module takes about 65% fewer compiler instructions than 2.2.0’s, and a debug build about 62% fewer (#635).
  • Bazel. Resolving SafeDI’s module no longer runs swift package on the host or fetches rules_swift_package_manager’s modules, and a project that also depends on the registry’s swift-syntax builds it once instead of twice (#599).

Known issues

  • A mock that calls another module’s public mock can accept a graph that production rejects for access. Where production would fill a hole of the called mock with a type whose tree constructs a type the calling module cannot access, production reports that access error, but the calling mock takes the hole’s builder as a required parameter instead (#849).
  • SafeDITool generate takes 2.5 to 3.2 times as long as 2.2.0 when screens that open each other through an Instantiator cycle declare a value again, on graphs of 12 and 16 such screens, and the gap grows with the number of screens (#646).
  • Generated code does not compile in a module whose declarations default to the main actor (-default-isolation MainActor) when a type conforms only to Instantiable; giving that type generatedAttributes: "@MainActor" works around it (#661).

What's Changed

  • Pin the Tuist example to SafeDI 2.2.0 by @dfed in #514
  • Bump bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml from 1.5.1 to 1.6.0 in the actions group by @dependabot[bot] in #515
  • Record the access level of every @INSTANTIABLE type, extension, initializer and mock method by @dfed in #489
  • Check SafeDI's sources for traps, and report what the macro rejects without trapping by @dfed in #519
  • Fail a fuzzed graph whose generated code draws a compiler warning by @dfed in #517
  • Add a value-level comparator for differential oracles by @dfed in #518
  • State the implementer rules in CLAUDE.md by @dfed in #520
  • Report the xcodebuild check names on Markdown-only pull requests by @dfed in #522
  • Close three blind spots in the value comparator by @dfed in #524
  • Hand generate the module and package that declare each @INSTANTIABLE type by @dfed in #504
  • Let @INSTANTIABLE types and their initializers be package or internal where the constructing code can reach them by @dfed in #509
  • Let @INSTANTIABLE put attributes on the initializer SafeDI generates by @dfed in #510
  • Put the Manual in reading order by @dfed in #516
  • Generate a dependency tree per module with @INSTANTIABLE(generateDependencyTree: true) by @dfed in #525
  • Prove a seam parameter's access from the types it mentions by @dfed in #527
  • Take a builder for each type a seam's module cannot see, and fill it in the module that can by @dfed in #528
  • Generate public mocks, and call them from other modules by @dfed in #530
  • Document adopting SafeDI in a large codebase, and the Tuist integration by @dfed in #531
  • Pin each seam rule's primary shape by hand, and draw its siblings in the seam corpus by @dfed in #532
  • Pass the nearest declaration to a type a lazy cycle builds again by @dfed in #533
  • Check the access of a plain type an extension extends by @dfed in #534
  • Check that the graph fuzzer's graphs generate the same code split across modules under both multi-module integrations by @dfed in #500
  • Fix what the button-up review and the adopter testers found in the package-access stack by @dfed in #535
  • Print diagnostics under Bazel at the paths Bazel hands SafeDITool by @dfed in #536
  • Create a type's own onlyIfAvailable alias in a mock whose override binds its label by @dfed in #537
  • Pin the base corpus's per-feature counts, and cut the unit tests it already covers by @dfed in #538
  • Give the base corpus a value oracle, and cut the unit tests it now covers by @dfed in #540
  • Count a type SafeDI reads no declaration of as public by @dfed in #541
  • Take a default-valued parameter declared @escaping as @escaping in a configuration by @dfed in #542
  • Offer the seam remedy wherever the candidate's module reads every type on the path by @dfed in #543
  • Create an alias of a lazy cycle's parameter label where nothing above the function provides it by @dfed in #544
  • Pass a public mock call inside a fill what the mock binds for it by @dfed in #545
  • Fix the wording the adopter testers' second round found by @dfed in #546
  • Generate a fill a mock declares with what its caller generates later by @dfed in #547
  • Pass nil to a type built as a lazy cycle's parameter label inside the function's body by @dfed in #548
  • Qualify a nested type a public mock's module-level configuration spells by @dfed in #549
  • Build the release SafeDITool on Linux in CI, and avoid the Swift 6.3.3 crash that stopped 2.3.0-alpha-1 by @dfed in #550
  • Spell the access level each generated import needs by @dfed in #551
  • Give the declarations macro fix-its add the access the type needs by @dfed in #552
  • Find SafeDITool from a Tuist project in a subdirectory of the workspace by @dfed in #553
  • Resolve #if around plain type declarations as SafeDI resolves it around SafeDI content by @dfed in #555
  • Load the Tuist plugin by commit, not by tag by @dfed in #556
  • Make errors name their fix, and reject mockOnly types in additionalMocksToGenerate by @dfed in #557
  • Deprecate forwarded wrappers, hand-written manifests, --additional-imported-modules by @dfed in #558
  • Drop the Xcode-only --build-setting-product-module-name option by @dfed in #559
  • Read Tuist's -D flags, accept relative paths in bazel run, document integrations by @dfed in #560
  • Remove the nil defaults from a seam's generated initializer by @dfed in #561
  • Explain that generateMock: .public requires a seam's initializer to be public by @dfed in #562
  • Reject a rename of another rename and a rename of a dependency to itself by @dfed in #563
  • Generate a root's init() only in the module that declares it by @dfed in #564
  • Fix two tests that failed when the checkout lives under /private/tmp by @dfed in #565
  • Render a public mock() that takes no parameters on one line by @dfed in #566
  • Show where a Tuist project sets SWIFT_PACKAGE_NAME by @dfed in #567
  • Check the access of namespaces declared in extensions and of backticked names by @dfed in #569
  • Default unbuildable mock() parameters to their type's hand-written mock by @dfed in #570
  • Accept a dependency cycle when any dependency along it is an instantiator by @dfed in #571
  • Always bind an onlyIfAvailable rename, to its nearest dependency or to nil by @dfed in #572
  • Bind an onlyIfAvailable rename of a seam parameter as an inline build does by @dfed in #573
  • Treat a named module with no package name as outside every package by @dfed in #574
  • Count the access level an extension spells for an unread nested type by @dfed in #575
  • Reject a seam naming a type a mock-only block declares narrower without DEBUG by @dfed in #576
  • Let a module list only the modules it imports to call a seam or public mock by @dfed in #577
  • Create a seam's by-value dependencies when its tree first reads them by @dfed in #578
  • Generate compiling code for a required erased rename of an optional dependency by @dfed in #579
  • Count a plain type in a mock-only #if block at its narrowest level across builds by @dfed in #580
  • Document which modules a Bazel, Tuist or custom-build module lists by @dfed in #581
  • Raise CI test time limits and name the runner image in macOS cache keys by @dfed in #582
  • Create a lazily held value when a hole's implementation uses it by @dfed in #583
  • Give each Manual rule one home, and move edge-case rules to a Reference section by @dfed in #584
  • Qualify a namespace's nested types that an @INSTANTIABLE names unqualified by @dfed in #585
  • Split SafeDIToolTests into five test targets so a release build compiles them in parallel by @dfed in #586
  • Split CLAUDE.md into a short root and topic files that load where they apply by @dfed in #587
  • Document platform-clause dependencies, one mock value per name, and seam errors by @dfed in #588
  • Warn only about a nested type spelled through Self by @dfed in #589
  • Build the type fulfilledByType: names in a generated mock by @dfed in #590
  • Pass a public mock call the value the mocked type already creates by @dfed in #591
  • Reject erasedToConcreteExistential where no erasing initializer can exist by @dfed in #592
  • Reject a label received in two forms along a promoted dependency's tree by @dfed in #593
  • Pass a mocked type's rename to promoted dependencies only when the types match by @dfed in #594
  • Make generated mocks compile for a default-valued @autoclosure parameter by @dfed in #595
  • Skip the nested-type search for names no nested declaration has by @dfed in #596
  • Reject a label received in two forms along a mock's tree when either is required by @dfed in #597
  • Build the Tuist example against SafeDI 2.3.0-alpha-2 by @dfed in #598
  • Depend on the Bazel Central Registry's swift-syntax and swift-argument-parser by @dfed in #599
  • Verify the SafeDITool the Xcode installer downloads against a pinned SHA-256 by @dfed in #600
  • Run SwiftFormat as a release build in CI and CLI/lint.sh by @dfed in #601
  • Build the Tuist example against SafeDI 2.3.0-alpha-3 by @dfed in #602
  • Pass generate the project root from both PluginScanner fallbacks by @dfed in #603
  • Accept a forwarded tuple whose elements are not one bare name by @dfed in #604
  • Keep every part of a type that its spelling carries by @dfed in #605
  • Treat spellings of one type as one type in an erased instantiator's first generic by @dfed in #606
  • Document what seams cost under Xcode, what public mocks require, and how to wire a new module by @dfed in #607
  • Say what is true and what to do in three adopter-facing errors by @dfed in #608
  • Make the fuzzer known-issues rule match the lists it describes by @dfed in #609
  • Document when a hand-written seam call keeps compiling after a parameter is added by @dfed in #611
  • Name the modules a root must list to reach a hole by @dfed in #612
  • Document a mock parameter several types create by @dfed in #614
  • Accept an @escaping parameter whose type is a typealias of a closure by @dfed in #616
  • Retry installing curl for Codecov on the Linux job by @dfed in #620
  • Give seams a plain initializer that cannot retain its caller by @dfed in #615
  • Name the modules when two modules declare a type of one name by @dfed in #618
  • Collect the SafeDI modules beneath a Bazel module instead of asking each root to list them by @dfed in #610
  • Import the module of a type a generated tree builds for a property that does not name it by @dfed in #617
  • Report every difference a renamed fuzzer graph shows by @dfed in #613
  • Give each reason a renamed fuzzer graph differs its own known-issue entry by @dfed in #619
  • Skip the lazy-cycle validation walk where it cannot find anything by @dfed in #621
  • Tell apart types of one name that a module cannot name by @dfed in #622
  • Settle cycle parameters when a cycle closes on the other form of its declaration by @dfed in #624
  • Count a @sendable fill as a @sendable function for the seam places and calls inside it by @dfed in #626
  • Build a seam hole's wrapper in the seam, and have its builder return the plain value by @dfed in #627
  • Give a seam one builder per hole type, over an enum of the places that build it by @dfed in #628
  • Give a public mock one builder per hole type, over an enum of its places, as a seam takes them by @dfed in #629
  • Fuzz the nested seam builders' shapes, and check that a second place renames no builder or case by @dfed in #630
  • Generate a seam's readable-label initializer only when its module opts in, and document each generated initializer by @dfed in #631
  • Make the Manual easier to read by @dfed in #625
  • Say which runs two third-module access tests model, and test a Bazel run of one by @dfed in #623
  • Keep test temporary files out of the system temporary directory by @dfed in #632
  • Run the repeat test passes on Linux instead of macOS by @dfed in #633
  • Skip compile checks that passed in an earlier CI run by @dfed in #634
  • Compile only what the macros use into the macro plugin by @dfed in #635
  • Make generated mock configuration fields private(set) by @dfed in #636
  • Speed up cycles where screens declare a value again by @dfed in #638
  • Pass a cycle's required form of a label, and reject forms one value can't carry by @dfed in #639
  • Add a dispatchable Linux test workflow for one branch by @dfed in #643
  • Keep lint.sh's SwiftPM temp folders out of the system temp folder by @dfed in #644
  • Reject a seam fill that would read the wrong level of a cycle by @dfed in #637
  • Carry a cycle parameter, not the seam's memo, in a hole's scope by @dfed in #642
  • Keep a public seam's builder labels independent of narrower parameters by @dfed in #640
  • Compile public mocks in modules that default to the main actor by @dfed in #641
  • Lead with the package-name remedy, naming each integration's setting by @dfed in #647
  • Word hole errors for a builder function's cycle parameter by @dfed in #656
  • Call a staged builder's stage before a @sendable function a cycle closes on by @dfed in #654
  • Fuzz lazy cycles with cycle parameters in a seam's tree by @dfed in #655
  • Remove the compiler warnings in SafeDI's own sources and fail CI on new ones by @dfed in #648
  • Reject a fill that reads a cycle parameter's label in two forms, as inline does by @dfed in #658
  • Trim the Manual and correct two statements by @dfed in #660
  • Bring the agent instruction files up to date with the code by @dfed in #659
  • Say how main-actor-default modules use SafeDI, and which Bazel archives build the tool by @dfed in #664
  • Keep test helpers from blocking concurrency threads while compiling by @dfed in #657
  • Pin the example projects to 2.3.0-alpha-4 by @dfed in #662
  • Stop lexing parameter names again to check their encodings by @dfed in #663
  • Qualify nested types without copying the qualification state per type by @dfed in #665
  • Compute the .safedi schema fingerprint without reflection at run time by @dfed in #668
  • Search generated code for markers by bytes, and standardize each path once by @dfed in #667
  • Call a staged builder's stage before a @sendable function in a public mock by @dfed in #666
  • Add a fast debug mode to the Linux verify workflow by @dfed in #669
  • Report a hand-written initializer collision at that initializer, with a remedy that fits its tier by @dfed in #670
  • Name both receives in the remedy for a forwarded property hidden in a mock's tree by @dfed in #671
  • Name no imported module in the error for a type nothing fulfills by @dfed in #672
  • Offer the package-name remedy wherever a module's missing package is the cause by @dfed in #673
  • Word seam remedy lists and fill errors so each remedy reads as one alternative by @dfed in #674
  • Generate mock configuration fields as let again by @dfed in #675
  • Find SafeDI's module on Linux in the multi-module reproduction script by @dfed in #676
  • Accept loops through received instantiators by @dfed in #649
  • Build loops of instantiators in mocks by @dfed in #650
  • Carry loop rebindings into seams, and reject fills that receive an instantiator being built by @dfed in #651
  • Test that loops of received instantiators free their trees, and fuzz them by @dfed in #652
  • Report the fill finding that comes first in the source, not the first one a name-ordered walk meets by @dfed in #677
  • Spell a nonisolated(nonsending) closure type as an identifier by @dfed in #678
  • Name a mock’s extracted override locals apart when labels join with underscores by @dfed in #679
  • Make scan cheaper without changing what it writes by @dfed in #680
  • Generate mock roots without the copies and walks added since 2.2.0 by @dfed in #681
  • Split the seam corpus across two fuzzer jobs, report what each fuzzer phase costs, and keep a findings ledger by @dfed in #682
  • Call instantiators and mocks that take forwarded values with sample values in the fuzzer's value oracle by @dfed in #683
  • Check that generated mocks apply overrides in the fuzzer's value oracle by @dfed in #684
  • Draw hand-written mocks, mockOnly extensions, structs and additional mocks in the fuzzer's base corpus by @dfed in #685
  • Order a type's children in a seam's tree by what the type holds by @dfed in #689
  • Nest a seam's scope enums by type by @dfed in #690
  • Nest a place inside a fill by type by @dfed in #691
  • Nest a public mock's scope enums by type, and fill per route by @dfed in #692
  • Nest a place inside a public mock's fill by type by @dfed in #696
  • Fuzz a hole's scope by type: shared types, a tangle of cycles, and their oracles by @dfed in #693
  • Describe a hole's scope nested by type in the Manual by @dfed in #694
  • Pass a mock's renamed receive by name when a receive beneath reads the label by @dfed in #686
  • Give working advice when declaring a receive would close a cycle or when it is a required optional by @dfed in #687
  • Add a remedy oracle to the graph fuzzer's base corpus by @dfed in #688
  • Cover generator lines no test reached by @dfed in #700
  • Name the place inside a nested fill, and remove code no valid input reaches by @dfed in #704
  • Spell every apostrophe SafeDI emits as ’ by @dfed in #698
  • Fuzz places inside plain fills and holes under later loop members, and judge places inside fills by @dfed in #699
  • Check line coverage in CI from the test jobs' own reports by @dfed in #701
  • Report the changed generator lines no fuzzer corpus graph ran by @dfed in #695
  • Ask that a generator change land with a fuzzer draw for its shape by @dfed in #697
  • Hold the root enum in a public mock's case that builds the mocked type again by @dfed in #702
  • Hand an inner seam's places no values of the calling type by @dfed in #703
  • Write down the design, testing, release and documentation rules the instruction files lack by @dfed in #705
  • Build only the dispatched commit in the graph fuzzer's coverage mode by @dfed in #706
  • Give a public mock's root level the values its mock() binds before its tree by @dfed in #707
  • Update SwiftFormat to 0.64.7 by @dfed in #709
  • Check out the dispatched commit in the graph fuzzer's coverage jobs by @dfed in #710
  • Make Codecov informational: no comments, no docs-only status job by @dfed in #711
  • Name the closure each instantiator is created with: X<…>.Builder by @dfed in #712
  • Report a public mock fill that reads a value its loop declares again by @dfed in #713
  • Gate seam and public mock generator changes on fuzzer draws, a retention oracle and a size check by @dfed in #708
  • Raise the Latest Swift and Xcode 26 test steps' time limits by @dfed in #715
  • Keep passed compile checks across generator changes in CI by @dfed in #716
  • Fuzz the builder surface: what a person writes stays compiling by @dfed in #714
  • Share passed compile checks across branches in CI by @dfed in #717
  • Run a list of graph-fuzzer seeds in one process by @dfed in #721
  • Rule that a test writes its expected output out as one literal by @dfed in #722
  • Start a release Verify from main's newest build and run its tests in parallel jobs by @dfed in #723
  • Start the fuzzer's coverage build from Verify's stamped cache, and split the slow corpora's shards by @dfed in #724
  • Run only the edited suites while fixing tests, then the whole suite once by @dfed in #726
  • Start the fuzzer's shards and the repeated test passes when the Linux build ends by @dfed in #725
  • Fuzz the corpora from Verify's build with one dispatch by @dfed in #732
  • Apply the graph fuzzer's moved pins from a corpus run's analysis by @dfed in #733
  • Name the step when multi-module-repro.sh fails, and accept an empty dependencies.txt by @dfed in #734
  • Check that calling mocks mirror their production tree in the graph fuzzer by @dfed in #727
  • Add a skill that rewrites test expectations from what the test helpers record by @dfed in #728
  • Add an apply-edit skill that replaces exact text read from files, all or nothing by @dfed in #729
  • Check that every graph SafeDI 2.2.0 accepts still compiles and builds the same values by @dfed in #730
  • Label each builder by what it builds, so adding a place renames no other builder by @dfed in #731
  • Make Verify's fast mode require a filter by @dfed in #736
  • Add the verify-touched skill: run locally the suites a branch touches by @dfed in #737
  • Name every place a fill finding holds for, so file names never pick one by @dfed in #735
  • Give a seam a builder struct for each hole type, so a filled builder keeps alive only what it reads by @dfed in #738
  • Say that an agent may always cancel and re-run CI to manage the runners by @dfed in #746
  • Key passed compile checks by what compiles them, and share only a run's own passes by @dfed in #747
  • Build the test support target in release again, and keep @testable out of it by @dfed in #744
  • Keep the fuzz corpus script’s report out of the system temporary directory by @dfed in #745
  • Return what a type’s custom mock returns from a public mock’s construction function by @dfed in #740
  • Declare a public mock construction function for each way a module builds a type by @dfed in #741
  • Rebind a loop of builders when a receive left nil joins it to a value by @dfed in #742
  • Give a type the instantiator that builds it beside a receive left nil by @dfed in #743
  • Queue the longest macOS job for a runner first by @dfed in #749
  • Generate a seam's dependency tree in time that grows with its paths, not their square by @dfed in #748
  • Make generate faster: re-indent and spell mock override paths over bytes by @dfed in #750
  • Release each scope's finished code task, and start tasks only for large subtrees by @dfed in #751
  • Fix three graph fuzzer oracles that misjudged accepted graphs by @dfed in #752
  • Share passed compile checks between pull requests through their artifacts by @dfed in #753
  • Keep a mock's configurations' fields behind one reference, so a deep tree's mock compiles by @dfed in #754
  • Add a pre-review skill that runs what a branch owes before review by @dfed in #755
  • Fold the eleven short macOS CI jobs into two by @dfed in #756
  • Spell keyword labels as Swift requires in builder structs and mock configurations by @dfed in #758
  • Hand a seam's places held in instantiators builders of the wrapper's own Builder type by @dfed in #757
  • Retry the two Xcode project resolves from the checkout's root by @dfed in #760
  • Run a fuzzer batch's tool runs and value comparisons side by side by @dfed in #759
  • List the release acceptance check's #743 differences against 2.2.0 by @dfed in #765
  • Delete a Verify or Graph Fuzzer run's scratch branch when the run ends by @dfed in #762
  • List in the pre-review block the files a branch shares with other open changes by @dfed in #763
  • List in the pre-review block the instruction files near their size limit by @dfed in #766
  • Check generate time against main on every pull request by @dfed in #767
  • Check release acceptance on every pull request and push to main by @dfed in #768
  • Build and test in two steps in "Build and Test on Xcode 26" by @dfed in #769
  • Save CI's build caches only from main, keyed on the build's arguments and compiler by @dfed in #770
  • Keep one release Verify build per ref, and save debug builds only from main by @dfed in #771
  • Raise the CI step limits that sit under twice their longest run by @dfed in #774
  • Say that the example-pin pull request moves the Bazel example's pin too by @dfed in #764
  • Have the implementer agent size its brief, confirm a named mechanism first, and leave unreal shapes unfixed by @dfed in #773
  • Hold a received loop's levels in one box, so a seam's loop compiles in time that grows with the loop by @dfed in #761
  • Hand a mock's builder closures an implicitly unwrapped value as its optional by @dfed in #772
  • Have the implementer agent build on past a stop under the option it recommends by @dfed in #775
  • Cut four CI step limits to about twice their measured runs by @dfed in #776
  • Compile the five SafeDITool test targets without optimization by @dfed in #777
  • Add a skill that measures generate against a base commit and 2.2.0 by @dfed in #779
  • Report changed-line coverage when a test fails by @dfed in #780
  • Take a builder struct for every hole type of a seam, including seams that call seams and pass places up by @dfed in #781
  • Reject a fill that reads a value its seam, opened again, loses by @dfed in #782
  • Speak of members and values structs in seam diagnostics, and report a fill that receives a seam's parameter in another form by @dfed in #783
  • Take a hole's builder in a public mock as a seam takes it by @dfed in #784
  • Have a public mock and every generated call of one take the builders a seam takes by @dfed in #785
  • Have a calling mock fill, report and pass up as its production twin does by @dfed in #786
  • Wrap the caller's own value where one route of a seam's place holds it lazily by @dfed in #787
  • Pass nil to a mock's receive only if available that another receive's form pins by @dfed in #788
  • Generate the configuration of a type built only beneath a repeated ancestor by @dfed in #789
  • Reject type names that begin with the prefixes of SafeDI's generated seam types by @dfed in #790
  • Document the seam and mock behaviors the Manual missed by @dfed in #791
  • Report a hand-written mock that takes a dependency only an inactive #if clause declares by @dfed in #792
  • Have the fuzzer's remedy oracle follow more of SafeDI's advice, in every seam graph by @dfed in #793
  • Fix the schema fingerprint and the unfillable-fill check where earlier changes meet by @dfed in #794
  • Name every declaration in the remedy for a wrapper a @sendable builder captures by @dfed in #795
  • Keep what each value comparison program printed, so CI runs only the programs it has not seen by @dfed in #796
  • Fix three seam corpus tests after the changes below them by @dfed in #797
  • Draw and test calling mocks whose build leaves the mock condition off by @dfed in #798
  • Accept a calling mock whose only requirement of a value comes from a third module's public mock by @dfed in #799
  • Document the inner-seam fill error, the test-host fake, and when a seam builds a hole's property by @dfed in #800
  • State only working remedies for an unfulfilled received protocol and a cycle a seam's fill closes by @dfed in #801
  • Fix two tests for Xcode 26.0 and for runs without compile verification by @dfed in #802
  • Create a lazy value where a caller's fill reads it, through a fill of a passed-up place by @dfed in #803
  • Say what SafeDI hands a builder in fill errors, and offer only remedies that work by @dfed in #804
  • Fill a calling mock's places with the caller's own lazy values, and pass a place up whole where no level can hand them by @dfed in #805
  • Re-enter the enclosing call's level function when a fill calls a public mock that holds a builder of the filled type by @dfed in #806
  • Pass up a calling mock's place where a re-entered call cannot hand its fill the caller's value by @dfed in #807
  • Hand a .public caller's struct through a re-entering public mock, and take a @sendable builder where a level re-enters through a SendableInstantiator by @dfed in #808
  • Hand a fill the wrapper its tree reads, and report the wrapper mixes no values struct carries by @dfed in #809
  • Have the remedy oracle follow the advice of a seam fill's errors by @dfed in #810
  • Keep the any of an existential wherever a mock spells a dependency's type by @dfed in #811
  • Spell a mock parameter the same on every run by @dfed in #812
  • Take a builder for a public mock's place beneath a dependency it promotes by @dfed in #813
  • Test by value the internal calling mocks that take a builder per passed-up form by @dfed in #814
  • Reject a public mock that would hold two values under one label, and report production's Sendable-capture error from a mock by @dfed in #815
  • Pin the fuzzer corpora and list each corpus's known issues by @dfed in #816
  • Reject a reserved label written in backticks by @dfed in #817
  • Say what generated seam types promise and which OS versions a seam needs by @dfed in #818
  • Split ScopeGenerator's initializer into functions of its own, so SafeDI builds faster by @dfed in #819
  • Say that a label declared again on one path is discouraged by @dfed in #820
  • Take one builder per hole type across mixed forms, and () -> T for a builder whose places forward nothing by @dfed in #821
  • Judge a hand-written public mock call's builder by the type its mock gives the label by @dfed in #822
  • Take a public mock's overrides in the inline build's order by @dfed in #823
  • Hand a fill that reads a carried wrapper the wrapper its level carries by @dfed in https://github.com/dfed/SafeDI/pull/824
  • Take a value a public mock's tree receives lazily as its wrapper by @dfed in https://github.com/dfed/SafeDI/pull/825
  • Take a public mock's own optional-typed defaults on mock() in every shape by @dfed in https://github.com/dfed/SafeDI/pull/826
  • Test that a public mock's type built again inside a fill gets the caller's lazy value by @dfed in https://github.com/dfed/SafeDI/pull/827
  • Spell a mock's flat received parameters by their own types by @dfed in https://github.com/dfed/SafeDI/pull/828
  • Reject a fill's only-if-available read of a wrapper a seam's parameter cannot provide by @dfed in https://github.com/dfed/SafeDI/pull/829
  • Fix a rule and two public mock fuzzer readers after the changes below them by @dfed in https://github.com/dfed/SafeDI/pull/830
  • Mark a mock configuration's closure default @sendable unless its own type is by @dfed in https://github.com/dfed/SafeDI/pull/831
  • Take a throwing @autoclosure default as one that does not throw in mocks by @dfed in https://github.com/dfed/SafeDI/pull/832
  • Re-pin three tests after a public mock's own defaults move onto mock() by @dfed in https://github.com/dfed/SafeDI/pull/833
  • Report the twin's error where a fill requires a value the called mock holds only in an optional wrapper by @dfed in https://github.com/dfed/SafeDI/pull/834
  • Test that a mock takes a throwing autoclosure parameter whose default tries only inside a closure by @dfed in https://github.com/dfed/SafeDI/pull/836
  • Drop the public mock plan binding the overrides struct no longer reads by @dfed in https://github.com/dfed/SafeDI/pull/837
  • Pin the fuzzer corpora and release acceptance for the 2.3.0 stack, and decide a throwing default at parse time by @dfed in https://github.com/dfed/SafeDI/pull/838
  • Hand each fill of a seam call the caller's value in the form that fill takes by @dfed in https://github.com/dfed/SafeDI/pull/839
  • Draw a mock passed a label that its tree declares again above an alias, and call internal mocks' flat parameters intended by @dfed in https://github.com/dfed/SafeDI/pull/840
  • Generate a fill's call of a hand-written mock in a build that compiles no mocks by @dfed in https://github.com/dfed/SafeDI/pull/841
  • Report a hidden receive once per root, from the first chain in declaration order by @dfed in https://github.com/dfed/SafeDI/pull/842
  • Name every declaration that hides a received property by @dfed in https://github.com/dfed/SafeDI/pull/843
  • Spell a value its tree's receivers spell apart as the most explicit of their spellings by @dfed in https://github.com/dfed/SafeDI/pull/844
  • Remove the handling, tests and draws of implicitly unwrapped and required optional dependencies by @dfed in https://github.com/dfed/SafeDI/pull/845
  • Pass nil to a receive only if available in the place a required receive pins, not wherever its type is built by @dfed in https://github.com/dfed/SafeDI/pull/846
  • Pin the fuzzer corpora and lists for the cleanup folded into 2.3.0 by @dfed in https://github.com/dfed/SafeDI/pull/847
  • Document the escaping typealias default, the override order and a flat parameter’s label by @dfed in https://github.com/dfed/SafeDI/pull/848

Full Changelog: 2.2.0...2.3.0