// The build line (phone diagnostics, architect's brief of 12 Oct 2026): one// faint line at the bottom of the Databases sheet and of This phone / This// Mac that says which build this is and which Mac it last heard from —//// "Cotton 1.0.0 (254) · c76d108 · Mac mac-c 0.29.37"//// Left: this app's version, build number and short commit — constants of the// binary. Right: the serving Mac's name and version as this device last heard// them (`read.syncStatus`'s `loop.peer`, kept by the sync loop from the// exchange answer and the schema a 400 or 426 names). Red when the two schemas differ, but no schema number is ever// written on it: a person reads this line, and the rule since the opening// card is that no schema number stands anywhere a person reads (walker 298:// "schema 139" twice on the Databases sheet). Pure, so the line is the same// wherever it is drawn.importFoundationpublicstructBuildLine: Equatable, Sendable {/// The Mac across the exchange, as the sync loop last heard it.publicstructPeer: Equatable, Sendable {publicvar name: String?publicvar version: String?publicvar schema: Int?publicinit(name: String? = nil, version: String? = nil, schema: Int? = nil) {self.name = nameself.version = versionself.schema = schema }/// `read.syncStatus`'s `loop.peer`; `nil` when the loop has heard/// nothing yet.publicstaticfunc of(syncStatus: JSONValue?) -> Peer? {guardlet peer = syncStatus?["loop"]?["peer"] else { returnnil }let heard = Peer( name: peer["name"]?.string, version: peer["version"]?.string, schema: peer["schema"]?.int)return heard == Peer() ? nil : heard } }/// This build in the one form every screen says it in — "Cotton 1.0.0/// (286) · 9c19043" — the Databases foot, the dev corner and About alike,/// so two screens never name one build two ways (architect, 16 Oct 2026)./// A part the build was not stamped with says so. No schema: a person/// reads it. A business app says its own name: "Cotton" appears nowhere/// in a business flavour (`BusinessFlavourWordsTests`).publicstaticfunc own(app: String = app, version: String, build: String, commit: String) -> String {let short = commit.isEmpty ? "unstamped" : String(commit.prefix(7))let numbers = "\(version.isEmpty ? "?" : version) (\(build.isEmpty ? "?" : build))"return"\(app) \(numbers) · \(short)" }/// The app's own name: the business's in a business flavour, else Cotton.publicstaticvar app: String { name(of: FlavourManifest.current) }publicstaticfunc name(of manifest: FlavourManifest?) -> String { manifest?.name ?? "Cotton" }publiclet text: String/// The two schemas differ — the line is drawn red.publiclet mismatched: Bool/// - Parameters:/// - build: `CFBundleVersion`; `commit`: `CottonBuildCommit`./// - schema: this build's `SCHEMA_VERSION` (`build.facts`).publicinit(version: String = "", build: String, commit: String, schema: Int?, peer: Peer?) {let own = Self.own(version: version, build: build, commit: commit)let other: Stringiflet peer {let name = peer.name.map { "Mac \($0)" } ?? "Mac"let version = peer.version.map { " \($0)" } ?? "" other = name + version } else { other = "no Mac heard yet" } text = "\(own) · \(other)" mismatched = schema != nil && peer?.schema != nil && peer?.schema != schema }}/// WHICH PROCESS DREW A PROBLEM CARD: its bundle id, version and build, and/// the commit it was built from — "com.cottondb.cotton · 1.0.0 (256) ·/// 5e7ce0f". Drawn at the foot of every card that offers "Send a report", so/// a page from a second install or an old build cannot be read as this one's/// (12 Oct 2026: a page an old schema-93 build drew was read for an hour as/// build 256's, because nothing on it said which app it came from).publicstructProcessStamp: Equatable, Sendable {publiclet text: Stringpublicinit(bundleId: String, version: String, build: String, commit: String) {let app = bundleId.isEmpty ? "unknown bundle" : bundleIdlet numbers = "\(version.isEmpty ? "?" : version) (\(build.isEmpty ? "?" : build))"let short = commit.isEmpty ? "unstamped" : String(commit.prefix(7)) text = "\(app) · \(numbers) · \(short)" }publicstaticfunc of(_ bundle: Bundle = .main) -> ProcessStamp {let string = { (key: String) -> Stringin (bundle.object(forInfoDictionaryKey: key) as? String) ?? "" }returnProcessStamp( bundleId: bundle.bundleIdentifier ?? "", version: string("CFBundleShortVersionString"), build: string("CFBundleVersion"), commit: string("CottonBuildCommit")) }}