import XCTest/// The microphone and speech-recognition usage strings, on every target that/// can reach the code asking for them (coordinator, 14 Oct 2026: the Home/// preview's first tap on the fan's record button died in TCC — a request/// without its string is a SIGABRT, not a prompt).finalclassUsageDescriptionTests: XCTestCase {privatestaticlet keys = ["NSMicrophoneUsageDescription", "NSSpeechRecognitionUsageDescription"]/// RULE: every app or extension target that links CottonUI — which holds the dictation, recording and record-button code that asks for the microphone and speech recognition — carries NSMicrophoneUsageDescription and NSSpeechRecognitionUsageDescription in its Info.plist as does the Home preview's; without them the first tap that reaches the microphone kills the app (TCC, 14 Oct 2026, the preview's record button).func testEveryTargetThatCanAskForTheMicrophoneSaysWhy() throws {let project = trySourceSweep.mustRead("apps/cotton/project.yml", ownedBy: "the app's packaging")let blocks = Self.targets(in: project) XCTAssertFalse(blocks.isEmpty, "no targets read from project.yml — did its shape change?")for (name, block) in blocks where block.contains("product: CottonUI") && !block.contains("bundle.unit-test") && !block.contains("bundle.ui-testing") {for key inSelf.keys { XCTAssertTrue(block.contains("\(key):"), "\(name) links CottonUI but its Info.plist has no \(key)") } } }/// Each target's block under `targets:`, by name.staticfunc targets(in project: String) -> [(String, String)] {var blocks: [(String, String)] = []var inTargets = falsevar name: String?var lines: [String] = []func close() { iflet name { blocks.append((name, lines.joined(separator: "\n"))) } }for line in project.components(separatedBy: "\n") {if !line.hasPrefix(" "), !line.isEmpty, !line.hasPrefix("#") {if inTargets { close(); name = nil; lines = [] } inTargets = line.hasPrefix("targets:")continue }guard inTargets else { continue }if line.hasPrefix(" "), !line.hasPrefix(" "), line.hasSuffix(":"), !line.trimmingCharacters(in: .whitespaces).hasPrefix("#") { close() name = String(line.dropFirst(2).dropLast()) lines = [] } else { lines.append(line) } }if inTargets { close() }return blocks }}