Skip to content

Commit ac24cef

Browse files
authored
Move the docs pipeline to Swift 6.0 toolchains (#1192)
### Motivation: The docs check pipeline was pinned to 5.10, because the 6.0 and newer docc detected more issues in the docs, and pinning down was the short-term workaround. ### Modifications: - Stop pinning to 5.10, instead let it use 6.0 (and soon 6.1). - Fix all the docs issues that 6.0 found. ### Result: - Gets the CI back to green when using 6.0 docc: https://github.com/apple/swift-distributed-actors/actions/runs/13986968195/job/39162333702?pr=1192
1 parent d8839a2 commit ac24cef

19 files changed

+71
-65
lines changed

Diff for: .github/workflows/pull_request.yml

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ jobs:
1010
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
1111
with:
1212
license_header_check_project_name: "Swift Distributed Actors"
13-
# We need to move to 6.0 here but have to fix the new warnings first
14-
docs_check_container_image: "swift:5.10-noble"
1513

1614
unit-tests:
1715
name: Unit tests

Diff for: Sources/DistributedCluster/Backoff.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public enum Backoff {
6161
/// - multiplier: multiplier to be applied on each subsequent backoff to the previous backoff interval.
6262
/// For example, a value of 1.5 means that each backoff will increase 50% over the previous value.
6363
/// MUST be `>= 0`.
64-
/// - maxInterval: interval limit, beyond which intervals should be truncated to this value.
64+
/// - capInterval: interval limit, beyond which intervals should be truncated to this value.
6565
/// MUST be `>= initialInterval`.
6666
/// - randomFactor: A random factor of `0.5` results in backoffs between 50% below and 50% above the base interval.
6767
/// MUST be between: `<0; 1>` (inclusive)

Diff for: Sources/DistributedCluster/Cluster/Cluster+Membership.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ extension Cluster {
118118
///
119119
///
120120
/// - Parameters:
121-
/// - statuses: statuses for which to check the members for
121+
/// - status: status for which to check the members for
122122
/// - reachability: optional reachability that is the members will be filtered by
123123
/// - Returns: array of members matching those checks. Can be empty.
124124
public func members(withStatus status: Cluster.MemberStatus, reachability: Cluster.MemberReachability? = nil) -> [Cluster.Member] {
@@ -145,7 +145,7 @@ extension Cluster {
145145
/// the passed in `status` passed in and `reachability` status. See ``Cluster/MemberStatus`` to learn more about the meaning of "at least".
146146
///
147147
/// - Parameters:
148-
/// - statuses: statuses for which to check the members for
148+
/// - status: status for which to check the members for
149149
/// - reachability: optional reachability that is the members will be filtered by
150150
/// - Returns: array of members matching those checks. Can be empty.
151151
public func members(atLeast status: Cluster.MemberStatus, reachability: Cluster.MemberReachability? = nil) -> [Cluster.Member] {

Diff for: Sources/DistributedCluster/Docs.docc/ClusterSingleton.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# ``DistributedCluster/ClusterSingleton``
22

3-
@Metadata {
4-
@DocumentationExtension(mergeBehavior: append)
5-
}
6-
73
Allows for hosting a _single unique instance_ of a distributed actor within the entire distributed actor system,
84
including automatic fail-over when the node hosting the instance becomes down.
95

@@ -155,7 +151,7 @@ The allocated singleton instance will get the ``activateSingleton()-9fbad`` meth
155151

156152
Conversely, when the allocation strategy decides that this cluster member is no longer hosting the singleton the ``passivateSingleton()-31z1s`` method will be invoked and the actor will be released. Make sure to not retain the actor or make it perform any decisions which require single-point-of-truth after it has had passivate called on it, as it no longer is guaranteed to be the unique singleton instance anymore.
157153

158-
## Glossary
154+
### Glossary
159155

160156
- **cluster singleton** - the conceptual "singleton". Regardless on which node it is located we can generally speak in terms of contacting the cluster singleton, by which we mean contacting a concrete active instance, wherever it is currently allocated.
161157
- singleton **instance** - a concrete instance of a distributed actor, allocated as a singleton. In contrast to "cluster singleton", a "cluster singleton instance" refers to a concrete unique instance on a concrete unique member in the cluster.

Diff for: Sources/DistributedCluster/Docs.docc/Clustering.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Clustering multiple actor system instances into a single Distributed Actor Syste
66

77
In this article, we'll learn how to configure and use multiple ``ClusterSystem`` instances to form a distributed system.
88

9-
## Initializing a ClusterSystem
9+
### Initializing a ClusterSystem
1010

1111
In this section, we will discuss initializing and using a distributed cluster system.
1212

@@ -49,15 +49,15 @@ Declaring a distributed actor is similar to declaring a plain `actor`. We do thi
4949

5050
TODO: documentation of TLS config
5151

52-
## Forming clusters
52+
### Forming clusters
5353

5454
Forming a cluster is the first step towards making use of distributed clusters across multiple nodes.
5555

5656
Once a node joins at least one other node of an already established cluster, it will receive information about all other nodes
5757
which participate in this cluster. This is why often it is not necessary to give all nodes the information about all other nodes in a cluster,
5858
but only attempt to join one or a few of them. The first join "wins" and the cluster welcome the new node into the ``Cluster/Membership``.
5959

60-
### Joining existing nodes
60+
#### Joining existing nodes
6161

6262
In the simplest scenario we already know about some existing node that we can join to form a cluster, or become part of a cluster that node already is in.
6363

@@ -83,7 +83,7 @@ There is also convenience APIs available on ``ClusterControl`` (`system.cluster`
8383
- ``ClusterControl/joined(endpoint:within:)`` which allows you to suspend until a specific node becomes ``Cluster/MemberStatus/joining`` in the cluster membership, or
8484
- ``ClusterControl/waitFor(_:_:within:)-2aq7r`` which allows you to suspend until a node reaches a specific ``Cluster/MemberStatus``.
8585

86-
### Automatic Node Discovery
86+
#### Automatic Node Discovery
8787

8888
The cluster system uses [swift-service-discovery](https://github.com/apple/swift-service-discovery) to discover nearby nodes it can connect to. This discovery step is only necessary to find IPs and ports on which we are expecting other cluster actor system instances to be running, the actual joining of the nodes is performed by the cluster itself. It can negotiate, and authenticate the other peer before establishing a connection with it (see also TODO: SECURITY).
8989

@@ -106,7 +106,7 @@ Similarly, you can implement the [ServiceDiscovery](https://github.com/apple/swi
106106
and this will then enable the cluster to locate nodes to contact and join automatically. It also benefits all other uses of service discovery in such new environment,
107107
so we encourage publishing your implementations if you're able to!
108108

109-
## Cluster Events
109+
### Cluster Events
110110

111111
Cluster events are events emitted by the cluster as changes happen to the lifecycle of members of the cluster.
112112

@@ -186,7 +186,7 @@ The ``Cluster/Membership`` also offers a number of useful APIs to inspect the me
186186

187187
> A new async/await API might be offered that automates such "await for some node to reach some state" in the future, refer to [#948](https://github.com/apple/swift-distributed-actors/issues/948) for more details.
188188
189-
## Cluster Leadership
189+
### Cluster Leadership
190190

191191
The cluster has a few operations which must be performed in a consistent fashion, such as moving a joining member to the ``Cluster/MemberStatus/up`` state. Other member status changes such as becoming `joining` or `down` do not require such strict decision-making and are disseminated throughout the cluster even without a leader.
192192

@@ -197,7 +197,7 @@ For details, refer to the ``Leadership/LowestReachableMember`` documentation.
197197

198198
You can configure leader election by changing the ``ClusterSystemSettings/autoLeaderElection`` setting while initializing your ``ClusterSystem``.
199199

200-
## Customizing Remote Calls
200+
### Customizing Remote Calls
201201

202202
Remote calls are at the heart of what makes distributed actors actually distributed.
203203

@@ -226,7 +226,7 @@ try await RemoteCall.with(timeout: .seconds(5)) {
226226
}
227227
```
228228

229-
### Remote call errors
229+
#### Remote call errors
230230

231231
By default, if a remote call results in an error that is `Codable`, the error is returned as-is. Non-`Codable` errors are
232232
converted to ``GenericRemoteCallError``.

Diff for: Sources/DistributedCluster/Docs.docc/Contributing.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
# Contributing
22

3+
Learn how to contribute to this project.
34

5+
## Overview
46

5-
## Testing
7+
### Testing
68

79
The cluster is extensively tested, including plain unit tests, tests spanning multiple nodes within the same process, as well as multi-node tests spanning across actor systems running across separate processes.
810

9-
### Multi-node testing
11+
#### Multi-node testing
1012

1113
Multi node test infrastructure is still in development and may be lacking some features, however its basic premise is to be able to run small "apps" that function as tests, and are automatically deployed to multiple processes.
1214

1315
> Note: Eventually, those processes may actually be located on different physical machines, but this isn't implemented yet.
1416
15-
## Testing logging (LogCapture)
17+
### Testing logging (LogCapture)
1618

1719
As the cluster performs operations "in the background", such as keeping the membership and health information of the cluster up to date, it is very important that log statements it emits in such mode are useful and actionable, byt not overwhelming.
1820

@@ -29,4 +31,4 @@ let log = try self.logCapture.awaitLogContaining(testKit, text: "Assign identity
2931

3032
to suspend until the expected log statement is emitted. It is possible to configure more details about the matching as well as timeouts by passing more parameters to this call.
3133

32-
### Testing metrics (MetricsTestKit)
34+
#### Testing metrics (MetricsTestKit)

Diff for: Sources/DistributedCluster/Docs.docc/Introduction.md

+12-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ A high-level introduction to distributed actor systems.
66

77
Distributed actors extend Swift's "local only" concept of `actor` types to the world of distributed systems.
88

9-
109
### Actors
1110

1211
As distributed actors are an extension of Swift's actor based concurrency model, it is recommended to familiarize yourself with Swift actors first, before diving into the world of distributed actors.
@@ -15,7 +14,7 @@ To do so, you can refer to:
1514
- [Concurrency: Actors](https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html#ID645) section of the Swift Book,
1615
- or the [Protect mutable state with Swift actors](https://developer.apple.com/videos/play/wwdc2021/10133/) introduction video from WWDC 2021.
1716

18-
## Thinking in (distributed) actors
17+
### Thinking in (distributed) actors
1918

2019
In order to build distributed systems successfully you will need to get into the right mindset.
2120

@@ -25,7 +24,7 @@ Distribution comes with the added complexity of _partial failure_ of systems. Me
2524

2625
In this section we will try to guide you towards "thinking in actors," but perhaps it’s also best to first realize that: "you probably already know actors!" As any time you implement some form of identity that is given tasks that it should work on, most likely using some concurrent queue or other synchronization mechanism, you are probably inventing some form of actor-like structures there yourself!
2726

28-
## Distributed actors
27+
### Distributed actors
2928

3029
Distributed actors are a type of nominal type in Swift. Similarly to actors, they are introduced using the `distributed actor` pair of keywords.
3130

@@ -41,7 +40,7 @@ distributed actor Greeter {
4140
}
4241
```
4342

44-
### Module-wide default actor system typealias
43+
#### Module-wide default actor system typealias
4544

4645
Instead of declaring the `typealias ActorSystem = ClusterSystem` in every actor you declare, you can instead declare a module-wide `DefaultDistributedActorSystem` typealias instead. Generally it is recommended to keep that type-alias at the default (module wide) access control level, like this:
4746

@@ -77,13 +76,13 @@ distributed actor WebSocketWorker {
7776
}
7877
```
7978

80-
### Location Transparency
79+
#### Location Transparency
8180

8281
Distributed actors gain most of their features from the fact that they can be interacted with "the same way" (only by asynchronous and throwing `distributed func` calls), regardless where they are "located". This means that if one is passed an instance of a `distributed actor Greeter` we do not know (by design and on purpose!) if it is really a local instance, or actually only a reference to a remote distributed actor, located on some other host.
8382

8483
This capability along with strong isolation guarantees, enables a concept called [location transparency](https://en.wikipedia.org/wiki/Location_transparency), which is a programming style in which we describe network resources by some form of identity, and not their actual location. In distributed actors, this means that practically speaking, we do not have to know "where" a distributed actor is located. Or in some more advanced patterns, it may actually be "moving" from one host to another, while we still only refer to it using some abstract identifier.
8584

86-
## Distributed actor isolation
85+
### Distributed actor isolation
8786

8887
In order to function properly, distributed actors must impose stronger isolation guarantees than their local-only cousins.
8988

@@ -144,7 +143,7 @@ distributed actor Example {
144143

145144
It is possible to declare nonisolated computed properties as well as methods, and they follow the same rules as such declarations in actor types.
146145

147-
## Distributed actor initialization
146+
### Distributed actor initialization
148147

149148
Distributed actors **must** declare a type of `ActorSystem` they are intended to be used with (which in case of the swift-distributed-actors cluster library is always the ``ClusterSystem``), and initialize the implicit `actorSystem` property that stores the system.
150149

@@ -159,7 +158,7 @@ Worker() // ❌ error: missing argument for 'actorSystem' parameter
159158

160159
Distributed actor initializers are allowed to be throwing, failing, or even `async`. For more details on actor initializer semantics, please refer to [SE-0327: On Actors and Initialization](https://github.com/apple/swift-evolution/blob/main/proposals/0327-actor-initializers.md).
161160

162-
## Distributed actor methods
161+
### Distributed actor methods
163162

164163
Distributed actors may declare distributed instance methods by prepending the `distributed` keyword in front of a `func` or _computed property_ declaration, like so:
165164

@@ -217,11 +216,11 @@ The `self.work(on:)` call still needed to use the `await` keyword, since we were
217216
> try await worker.work(item, settings)
218217
> ```
219218
220-
## Distributed actors conforming to protocols
219+
### Distributed actors conforming to protocols
221220
222221
Distributed actors may conform to `protocol` types, however they face similar restrictions in doing so as local-only `actor` types do.
223222
224-
### Witnessing protocol requirements
223+
#### Witnessing protocol requirements
225224
226225
As distributed actor methods are implicitly asynchronous and throwing when called from the outside of the actor, they can only witness asynchronous and throwing protocol requirements.
227226
@@ -247,7 +246,7 @@ distributed actor Example: SampleProtocol {
247246
}
248247
```
249248
250-
### Synchronous protocol requirements
249+
#### Synchronous protocol requirements
251250

252251
A `distributed actor` may conform to a synchronous protocol requirement **only** with a `nonisolated` computed property or function declaration.
253252

@@ -268,7 +267,7 @@ This is correct, since it is only accessing other `nonisolated` computed propert
268267
>
269268
> This is also how the `Hashable` and `Equatable` protocols are implemented for distributed actors, by delegating to the `self.id` property.
270269
271-
### DistributedActor constrained protocols
270+
#### DistributedActor constrained protocols
272271

273272
Protocols may require that types extending it be distributed actors, this can be expressed using the following:
274273

@@ -294,7 +293,7 @@ However, the `DistributedActor` **does not** refine the `Actor` protocol! This i
294293

295294
In practice, we do not see this as a problem, but a natural fallout of the isolation models. If necessary to require a type to be "some actor", please use the `protocol Worker: AnyActor` constraint.
296295

297-
## Where to go from here?
296+
### Where to go from here?
298297

299298
Continue your journey with those articles:
300299

Diff for: Sources/DistributedCluster/Docs.docc/LeadershipSelectionSettings.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# ``DistributedCluster/ClusterSystemSettings/LeadershipSelectionSettings``
22

3-
@Metadata {
4-
@DocumentationExtension(mergeBehavior: append)
5-
}
3+
Configure leadership election using which the cluster leader should be decided.
64

75
## Topics
86

Diff for: Sources/DistributedCluster/Docs.docc/Lifecycle.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Monitoring distributed actor lifecycles enables you to react to their terminatio
99
This is crucial for building robust actor systems which are able to automatically remote e.g. remote worker references as they are confirmed to have terminated.
1010
This can happen if the remote actor is just deinitialized, or if the remote host is determined to be ``Cluster/MemberStatus/down``.
1111

12-
## Lifecycle Watch
12+
### Lifecycle Watch
1313

1414
A distributed actor is able to monitor other distributed actors by making use of the ``LifecycleWatch`` protocol.
1515

Diff for: Sources/DistributedCluster/Docs.docc/Observability.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
The cluster system offers a number of built-in observability capabilities about the state of the cluster, as well as distributed actors it manages.
44

5-
## Logging
5+
### Logging
66

77
TODO: Explain `Logger(actor: self)` pattern
88

9-
## Metrics
9+
### Metrics
1010

1111
TODO: List the metrics we expose automatically; things like number of active distributed actors, message size, time calls take etc.
1212

1313

14-
## Distributed Tracing
14+
### Distributed Tracing
1515

1616
TODO: Integrate and explain how tracing works in the cluster system.

Diff for: Sources/DistributedCluster/Docs.docc/Receptionist.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and communicate with them.
77
fishy-docs:enable
88
}
99

10-
## Receptionist
10+
### Receptionist
1111

1212
Discovering actors is an important aspect of distributed programming, as it is _the_ primary way we can discover actors on other nodes,
1313
and communicate with them.
@@ -55,7 +55,7 @@ Other actors which discover the actor, and want to be informed once the actor ha
5555
> Warning: `DistributedReception.Key`s are likely to be collapsed with ``ClusterSystem/ActorID/Metadata-swift.struct`` during the beta releases.
5656
> See [Make use of ActorTag rather than separate keys infra for reception #950](https://github.com/apple/swift-distributed-actors/issues/950)
5757
58-
### Receptionist: Listings
58+
#### Receptionist: Listings
5959

6060
The opposite of using a receptionist is obtaining a ``DistributedReceptionist/listing(of:file:line:)`` of actors registered with a specific key.
6161

@@ -101,7 +101,7 @@ distributed actor Boss: LifecycleWatch {
101101
}
102102
```
103103

104-
### Checking-out from receptionist listings
104+
#### Checking-out from receptionist listings
105105

106106
Checking out of the receptionist is performed automatically when a previously checked-in actor is terminated,
107107
be it by the node that it was located on terminating, or the actor itself being deallocated.

Diff for: Sources/DistributedCluster/Docs.docc/Security.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Configuring security aspects of your cluster system.
1111
Securing your cluster system mostly centers around two concepts: making sure you trust your peers and systems which are able to call into the cluster,
1212
and ensuring that messages exchanged are of trusted types.
1313

14-
## Transport Security: TLS
14+
### Transport Security: TLS
1515

1616
> Note: **TODO:** explain configuring TLS
1717
@@ -48,18 +48,18 @@ let tlsExampleSystem = await ClusterSystem("tls-example") { settings in
4848
}
4949
```
5050

51-
## Message Security
51+
### Message Security
5252

5353
The other layer of security is about messages which are allowed to be sent to actors.
5454

5555
In general, you can audit your distributed API surface by searching your codebase for `distributed func` and `distributed var`, and verify the types involved in those calls.
5656

5757
The cluster also requires all types invokved in remote calls to conform to `Codable` and will utilize `Encoder` and `Decoder` types to deserialize them. As such, the typical attack of "accidentally deserialize an arbitrary sub-class of a type" is prevented by the `Codable` type itself.
5858

59-
### Trusting message types
59+
#### Trusting message types
6060

6161

62-
### Trusting error types
62+
#### Trusting error types
6363

6464
Error types may be transported back to a remote caller if they are trusted.
6565

@@ -77,8 +77,7 @@ struct GreeterCodableError: Error, Codable {}
7777
struct AnotherGreeterCodableError: Error, Codable {}
7878
```
7979

80-
81-
### Topics
80+
## Topics
8281

8382
- ``Serialization/Settings``
8483
- ``ClusterSystemSettings/tls``

Diff for: Sources/DistributedCluster/LifecycleMonitoring/LifecycleWatch.swift

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ extension LifecycleWatch {
6161
///
6262
/// - Parameters:
6363
/// - watchee: the actor to watch
64+
/// - file: the file path
65+
/// - line: the line number
6466
/// - Returns: the watched actor
6567
@discardableResult
6668
public func watchTermination<Watchee>(

0 commit comments

Comments
 (0)