Skip to content

Commit 387de22

Browse files
committed
fix(plan-77): remove HermesHonchoRelays, add declarative principle docs
- Remove HermesHonchoRelays.swift (application-specific code violation) - Remove ScopedRelay.swift (depended on removed RelayActor) - Add NetworkTrace public modifiers for test visibility - Add AppleRelayConfig to Service.swift - Create examples/honcho-hermes.yml demonstrating x-apple-relays - Create examples/README-vsock-relays.md documentation - Update Plan 77 Phase 6.2: Architectural correction - Document declarative principle in plan - Add quality assessment findings
1 parent effdb85 commit 387de22

9 files changed

Lines changed: 4860 additions & 281 deletions

File tree

Sources/Container-Compose/Codable Structs/Service.swift

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,29 @@ public struct ServiceRelay: Codable, Hashable {
101101
}
102102
}
103103

104+
/// Apple Container vsock relay configuration (Plan 77 Phase 6)
105+
/// Enables declarative vsock routing in compose files
106+
public struct AppleRelayConfig: Codable, Hashable {
107+
/// Relay type identifier
108+
public let type: String
109+
110+
/// VSOCK port number
111+
public let port: UInt32
112+
113+
/// Target service for routing (optional)
114+
public let target: String?
115+
116+
/// Priority level (optional)
117+
public let priority: String?
118+
119+
public init(type: String, port: UInt32, target: String? = nil, priority: String? = nil) {
120+
self.type = type
121+
self.port = port
122+
self.target = target
123+
self.priority = priority
124+
}
125+
}
126+
104127
/// A single entry in the long-form `depends_on` map.
105128
public struct DependsOnEntry: Codable, Hashable {
106129
public let condition: DependsOnCondition?
@@ -215,6 +238,10 @@ public final class Service: Codable, Hashable {
215238
/// Relay configuration for declarative routing (Phase 5)
216239
/// Enables vsock/tcp/unix socket routing to other services
217240
public let relay: ServiceRelay?
241+
242+
/// Apple Container vsock relay extensions (Plan 77 Phase 6)
243+
/// Declarative vsock configuration for hardware-isolated IPC
244+
public let x_apple_relays: [AppleRelayConfig]?
218245

219246
/// Other services that depend on this service
220247
public var dependedBy: [String] = []
@@ -238,11 +265,12 @@ public final class Service: Codable, Hashable {
238265
}.sorted() ?? []
239266
}
240267

241-
// Defines custom coding keys to map YAML keys to Swift properties
242-
// Note: 'env' is a shorthand alias for 'environment' in Docker Compose
243-
enum CodingKeys: String, CodingKey {
244-
case image, build, deploy, restart, healthcheck, volumes, environment, env, env_file, ports, command, depends_on, user, container_name, networks, hostname, entrypoint, privileged, read_only, working_dir, configs, secrets, stdin_open, tty, platform, scheme, runtime, `init`, init_image, dns, dns_search, publish_socket, relay
245-
}
268+
// Defines custom coding keys to map YAML keys to Swift properties
269+
// Note: 'env' is a shorthand alias for 'environment' in Docker Compose
270+
enum CodingKeys: String, CodingKey {
271+
case image, build, deploy, restart, healthcheck, volumes, environment, env, env_file, ports, command, depends_on, user, container_name, networks, hostname, entrypoint, privileged, read_only, working_dir, configs, secrets, stdin_open, tty, platform, scheme, runtime, `init`, init_image, dns, dns_search, publish_socket, relay
272+
case x_apple_relays = "x-apple-relays"
273+
}
246274

247275
/// Public memberwise initializer for testing
248276
public init(
@@ -278,6 +306,7 @@ public final class Service: Codable, Hashable {
278306
init_image: String? = nil,
279307
publish_socket: String? = nil,
280308
relay: ServiceRelay? = nil,
309+
x_apple_relays: [AppleRelayConfig]? = nil,
281310
dependedBy: [String] = []
282311
) {
283312
self.image = image
@@ -312,6 +341,7 @@ public final class Service: Codable, Hashable {
312341
self.init_image = init_image
313342
self.publish_socket = publish_socket
314343
self.relay = relay
344+
self.x_apple_relays = x_apple_relays
315345
self.dependedBy = dependedBy
316346
}
317347

@@ -494,6 +524,9 @@ public final class Service: Codable, Hashable {
494524

495525
// Decode relay configuration if present (Phase 5)
496526
relay = try container.decodeIfPresent(ServiceRelay.self, forKey: .relay)
527+
528+
// Decode Apple relay extensions if present (Plan 77 Phase 6)
529+
x_apple_relays = try container.decodeIfPresent([AppleRelayConfig].self, forKey: .x_apple_relays)
497530
}
498531

499532
/// Returns the services in topological order based on `depends_on` relationships.

Sources/Container-Compose/Networking/HermesHonchoRelays.swift

Lines changed: 0 additions & 270 deletions
This file was deleted.

0 commit comments

Comments
 (0)