Sync VCC Plus 3.7.1 build 67 source

Refresh reviewed MCP output export, four-drive owned playtests, bounded BASIC readiness, and pinned CMOC 0.1.101 source/patches. Preserve independent source-edition identity, empty libraries, notices and privacy boundaries.

Validated 74 export/privacy checks, pinned dependency sources, and an independent unsigned universal Release build. A subsequent documentation-only correction removes an excluded qualification link; all build inputs remain identical.
This commit is contained in:
Brian Holman committed 2026-11-17 08:42:27 -07:00
1 parent 4abc194001
commit 5534005799
54 files changed
+2950 -435

No files matched your search

@@ -487,7 +487,8 @@ final class BASICDevelopmentModel: ObservableObject {
}
guard reviewIsCurrent?() != false, source == text else { return nil }
guard let snapshot = await machine.loadBASICSource(text, run: run, breakpoints: breakpoints,
review: prior.map { ($0, existing) }) else { message = machine.fileError ?? "BASIC transfer failed."; return nil }
review: prior.map { ($0, existing) },
reviewIsCurrent: reviewIsCurrent) else { message = machine.fileError ?? "BASIC transfer failed."; return nil }
machine.basicWorkspaceOwner = workspaceID
let loadedSource = reviewIsCurrent == nil ? await machine.readBASICSource() : snapshot.assistantLoadedSource
guard machine.basicWorkspaceOwner == workspaceID, source == text else { return nil }
+58 -7
View File
@@ -507,6 +507,8 @@ struct CMOCProjectConfiguration: Codable, Equatable, Sendable {
/// Additional build-produced floppy images reviewed for owned disk exchange.
/// These are outputs, not source inputs or arbitrary files to mount.
var playtestDisks: [String] = []
/// Concrete additional delivery files; outputDirectories are never export permissions.
var exportOutputs: [String] = []
var launchMode: CMOCLaunchMode = .quickload
var launchCommands: [String] = []
var configurations = [CMOCBuildConfiguration(name: "Debug"), CMOCBuildConfiguration(name: "Release", makeArguments: ["VCC_CONFIGURATION=Release"])]
@@ -521,7 +523,7 @@ struct CMOCProjectConfiguration: Codable, Equatable, Sendable {
var outputDirectories: [String] = []
var makefileSettings: CMOCMakefileSettings? = nil
init() {}
enum CodingKeys: CodingKey { case entrySource, makefile, buildTarget, cleanTarget, diskTarget, binary, diskImage, debugManifest, playtestDisks, launchMode, launchCommands, configurations, jobs, makefileSettings, bundledLibraries, buildSupportDirectories, resourceInputs, generatedInputs, outputDirectories }
enum CodingKeys: CodingKey { case entrySource, makefile, buildTarget, cleanTarget, diskTarget, binary, diskImage, debugManifest, playtestDisks, exportOutputs, launchMode, launchCommands, configurations, jobs, makefileSettings, bundledLibraries, buildSupportDirectories, resourceInputs, generatedInputs, outputDirectories }
init(from decoder: Decoder) throws {
self.init()
let c = try decoder.container(keyedBy: CodingKeys.self)
@@ -534,6 +536,7 @@ struct CMOCProjectConfiguration: Codable, Equatable, Sendable {
diskImage = try c.decodeIfPresent(String.self, forKey: .diskImage)
debugManifest = try c.decodeIfPresent(String.self, forKey: .debugManifest)
playtestDisks = try c.decodeIfPresent([String].self, forKey: .playtestDisks) ?? []
exportOutputs = try c.decodeIfPresent([String].self, forKey: .exportOutputs) ?? []
launchMode = try c.decodeIfPresent(CMOCLaunchMode.self, forKey: .launchMode) ?? launchMode
launchCommands = try c.decodeIfPresent([String].self, forKey: .launchCommands) ?? []
configurations = try c.decodeIfPresent([CMOCBuildConfiguration].self, forKey: .configurations) ?? configurations
@@ -554,6 +557,7 @@ struct CMOCProjectConfiguration: Codable, Equatable, Sendable {
try c.encodeIfPresent(diskImage, forKey: .diskImage); try c.encode(launchMode, forKey: .launchMode)
try c.encodeIfPresent(debugManifest, forKey: .debugManifest)
if !playtestDisks.isEmpty { try c.encode(playtestDisks, forKey: .playtestDisks) }
if !exportOutputs.isEmpty { try c.encode(exportOutputs, forKey: .exportOutputs) }
try c.encode(launchCommands, forKey: .launchCommands); try c.encode(configurations, forKey: .configurations)
try c.encode(jobs, forKey: .jobs); try c.encodeIfPresent(makefileSettings, forKey: .makefileSettings)
if !bundledLibraries.isEmpty { try c.encode(bundledLibraries, forKey: .bundledLibraries) }
@@ -592,7 +596,23 @@ struct CMOCProjectConfiguration: Codable, Equatable, Sendable {
throw CMOCBuildError.message("Additional playtest disks need distinct project-relative .dsk or .os9 output paths, separate from inputs and primary outputs.")
}
}
let concreteOutputs = ([binary, diskImage, debugManifest].compactMap { $0 } + playtestDisks +
let exportPaths = [binary, diskImage, debugManifest].compactMap { $0 } + playtestDisks + exportOutputs
guard exportPaths.count <= 64,
Set(exportPaths.map { $0.lowercased() }).count == exportPaths.count else {
throw CMOCBuildError.message("Declare at most 64 distinct concrete delivery outputs.")
}
for path in exportOutputs {
try CMOCProject.validateRelativePath(path)
guard !occupiedRoles.contains(path.lowercased()), path.split(separator: "/").count <= 32,
!path.split(separator: "/").contains(where: { [".git", ".hg", ".svn"].contains($0.lowercased()) }) else {
throw CMOCBuildError.message("Delivery outputs must be concrete generated files, separate from project inputs.")
}
}
let lowerExportPaths = exportPaths.map { $0.lowercased() }
guard !lowerExportPaths.contains(where: { path in lowerExportPaths.contains(where: { $0.hasPrefix(path + "/") }) }) else {
throw CMOCBuildError.message("Delivery output paths cannot overlap directories and files.")
}
let concreteOutputs = ([binary, diskImage, debugManifest].compactMap { $0 } + playtestDisks + exportOutputs +
(makefileSettings?.generatedResources.flatMap(\.outputs) ?? [])).map { $0.lowercased() }
let ordinaryInputs = [entrySource, makefile, CMOCProject.configurationFilename] + resourceInputs
let explicitInputs = ordinaryInputs + generatedInputs
@@ -820,7 +840,7 @@ struct CMOCProject: Equatable, Sendable {
for ext in ["map", "link"] { excluded.insert((stem + "." + ext).lowercased()) }
}
if let disk = configuration.diskImage { excluded.insert(disk.lowercased()) }
excluded.formUnion(configuration.playtestDisks.map { $0.lowercased() })
excluded.formUnion((configuration.playtestDisks + configuration.exportOutputs).map { $0.lowercased() })
if let manifest = configuration.debugManifest { excluded.insert(manifest.lowercased()) }
if let recipe = configuration.makefileSettings {
for path in recipe.generatedResources.flatMap(\.outputs) { excluded.insert(path.lowercased()) }
@@ -976,6 +996,20 @@ struct CMOCPlaytestDiskProduct: Codable, Equatable, Sendable {
let byteCount: Int
}
/// A concrete delivery product frozen at successful build completion.
struct CMOCBuildOutputProduct: Codable, Equatable, Sendable {
let relativePath: String
let byteCount: Int
let sha256: String
func identifier(artifactID: UUID) -> String {
CMOCProject.sha256(Data((artifactID.uuidString + "\n" + relativePath).utf8))
}
func fields(artifactID: UUID) -> [String: Any] {
["output_id": identifier(artifactID: artifactID), "path": relativePath,
"bytes": byteCount, "sha256": sha256]
}
}
struct CMOCBuildArtifact: Sendable {
let id: UUID
let directory: URL
@@ -998,6 +1032,7 @@ struct CMOCBuildArtifact: Sendable {
let playtestDiskProducts: [CMOCPlaytestDiskProduct]
let debugManifestRelativePath: String?
let outputPaths: [String]
let exportProducts: [CMOCBuildOutputProduct]
let configurationName: String
let action: CMOCBuildAction
var hasBinary: Bool { binaryRelativePath != nil && !binaryData.isEmpty }
@@ -1016,7 +1051,7 @@ struct CMOCBuildArtifact: Sendable {
entrySourcePath: String = "main.c", binaryRelativePath: String? = "main.bin", diskRelativePath: String? = nil,
outputPaths: [String] = [], configurationName: String = "Debug", action: CMOCBuildAction = .build,
debugManifestRelativePath: String? = nil, diskSHA256: String? = nil, buildOutput: CMOCBuildOutput? = nil,
playtestDiskProducts: [CMOCPlaytestDiskProduct] = []) {
playtestDiskProducts: [CMOCPlaytestDiskProduct] = [], exportProducts: [CMOCBuildOutputProduct] = []) {
self.id = id; self.directory = directory; self.source = source; self.sourceData = sourceData; self.sourceSHA256 = sourceSHA256
self.binaryData = binaryData; self.buildLog = buildLog; self.buildOutput = buildOutput; self.sources = sources ?? [entrySourcePath: sourceData]
self.sourceHashes = self.sources.mapValues(CMOCProject.sha256)
@@ -1026,6 +1061,7 @@ struct CMOCBuildArtifact: Sendable {
self.debugManifestRelativePath = debugManifestRelativePath
self.diskSHA256 = diskSHA256
self.playtestDiskProducts = playtestDiskProducts
self.exportProducts = exportProducts
self.configurationName = configurationName; self.action = action
}
func matches(source: String) -> Bool { sourceSHA256 == CMOCProject.sha256(Data(source.utf8)) }
@@ -1588,10 +1624,11 @@ final class CMOCBuildService: @unchecked Sendable {
let supportKey = CMOCProject.sha256(try libraryEncoder.encode(supportIdentity))
// A newly reviewed media declaration cannot inherit an incidental old
// image from an earlier cache. Empty declarations retain legacy keys.
let exportKey = settings.exportOutputs.isEmpty ? "" : "\nexport-outputs:" + CMOCProject.sha256(try libraryEncoder.encode(settings.exportOutputs))
let playtestMediaKey = settings.playtestDisks.isEmpty ? "" :
"\nplaytest-disks:" + CMOCProject.sha256(try libraryEncoder.encode(settings.playtestDisks))
let cacheKey = CMOCProject.sha256(Data((project.directory.resolvingSymlinksInPath().path + "\n" + name + "\n" +
configuration.makeArguments.joined(separator: "\n") + "\n" + libraryKey + "\n" + supportKey + "\n" + toolchain.path + "\n" + CMOCProject.sha256(manifest) + playtestMediaKey).utf8))
configuration.makeArguments.joined(separator: "\n") + "\n" + libraryKey + "\n" + supportKey + "\n" + toolchain.path + "\n" + CMOCProject.sha256(manifest) + playtestMediaKey + exportKey).utf8))
let cache = try incrementalWorkspaceRoot().appendingPathComponent(cacheKey)
let workspace = cache.appendingPathComponent("project")
let indexURL = cache.appendingPathComponent("inputs.json")
@@ -1750,6 +1787,19 @@ final class CMOCBuildService: @unchecked Sendable {
sha256: CMOCProject.sha256(data), byteCount: data.count))
}
}
var exportProducts: [CMOCBuildOutputProduct] = []
if requiresProducts {
let declared = [binaryPath, diskPath, settings.debugManifest.flatMap { products[$0] == nil ? nil : $0 }].compactMap { $0 } + settings.playtestDisks + settings.exportOutputs
var total = 0
for path in declared {
guard let data = products[path], data.count <= CMOCProject.maximumFileBytes,
total <= 128 * 1024 * 1024 - data.count else {
throw CMOCBuildError.validation(message: "Make did not produce a bounded declared delivery file: " + path, log: log, capture: combinedOutput)
}
total += data.count
exportProducts.append(CMOCBuildOutputProduct(relativePath: path, byteCount: data.count, sha256: CMOCProject.sha256(data)))
}
}
try control.checkCancellation(log: log)
let id = UUID()
let result = buildRoot.appendingPathComponent(id.uuidString)
@@ -1773,7 +1823,7 @@ final class CMOCBuildService: @unchecked Sendable {
binaryRelativePath: binaryPath, diskRelativePath: diskPath, outputPaths: products.keys.sorted(), configurationName: name, action: action,
debugManifestRelativePath: settings.debugManifest,
diskSHA256: diskPath.flatMap { products[$0] }.map(CMOCProject.sha256), buildOutput: combinedOutput,
playtestDiskProducts: playtestDiskProducts)
playtestDiskProducts: playtestDiskProducts, exportProducts: exportProducts)
try buildHistory.record(artifact, project: project.directory)
frozen = true; succeeded = true
return artifact
@@ -1831,7 +1881,8 @@ final class CMOCBuildService: @unchecked Sendable {
let physicalDirectory = URL(fileURLWithPath: String(cString: physicalPath), isDirectory: true)
free(physicalPath)
let artifact = CMOCBuildArtifact(id: id, directory: physicalDirectory, source: source,
sourceData: sourceData, sourceSHA256: CMOCProject.sha256(sourceData), binaryData: binary, buildLog: output.text, buildOutput: control.capturedOutput)
sourceData: sourceData, sourceSHA256: CMOCProject.sha256(sourceData), binaryData: binary, buildLog: output.text, buildOutput: control.capturedOutput,
exportProducts: [CMOCBuildOutputProduct(relativePath: "main.bin", byteCount: binary.count, sha256: CMOCProject.sha256(binary))])
try control.checkCancellation()
try buildHistory.record(artifact, project: project.directory)
succeeded = true
+1 -1
View File
@@ -97,7 +97,7 @@ struct CMOCProjectInputManifest: Equatable, Sendable {
let effective = CMOCProject(directory: project.directory, configuration: configuration)
let recipe = configuration.makefileSettings
let generatedOutputs = Set(recipe?.generatedResources.flatMap(\.outputs) ?? [])
var products = generatedOutputs.union(configuration.playtestDisks)
var products = generatedOutputs.union(configuration.playtestDisks).union(configuration.exportOutputs)
for path in [configuration.binary, configuration.diskImage, configuration.debugManifest].compactMap({ $0 }) {
products.insert(path)
}
+272
View File
@@ -0,0 +1,272 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import Darwin
/// A connection-scoped, revocable write grant. It never follows a user-selected
/// path supplied over MCP: the destination was selected in the native app.
final class MCPBuildExporter: @unchecked Sendable {
static let maximumFiles = 64
static let maximumSetBytes = 128 * 1024 * 1024
static let maximumSessionBytes = 512 * 1024 * 1024
static let maximumRequests = 64
struct Identity: Equatable, Sendable {
let device: dev_t
let inode: ino_t
init(_ value: stat) { device = value.st_dev; inode = value.st_ino }
}
struct Source: Sendable {
let artifactID: UUID
let directory: URL
let products: [CMOCBuildOutputProduct]
let identity: Identity
init(_ artifact: CMOCBuildArtifact) throws {
artifactID = artifact.id; directory = artifact.directory; products = artifact.exportProducts
let fd = try MCPBuildExporter.directory(artifact.directory)
defer { close(fd) }
identity = try MCPBuildExporter.identity(fd)
}
}
struct Delivery: Sendable {
let directory: String
let products: [CMOCBuildOutputProduct]
}
let destinationID = UUID().uuidString
private let root: URL
private let rootIdentity: Identity
private let state = NSLock()
private var valid = true
// Only used by authored race/failure fixtures, never populated by public input.
var beforeCommit: (@Sendable () throws -> Void)?
var afterFile: (@Sendable (Int) throws -> Void)?
init(destination: URL) throws {
root = destination.standardizedFileURL
let fd = try Self.directory(root); defer { close(fd) }
rootIdentity = try Self.identity(fd)
}
func invalidate() { state.lock(); valid = false; state.unlock() }
private func check() throws {
try Task.checkCancellation()
state.lock(); defer { state.unlock() }
guard valid else { throw Self.failure("access_denied") }
}
private static func failure(_ text: String) -> CMOCBuildError { .message(text) }
private static func identity(_ descriptor: Int32) throws -> Identity {
var value = stat()
guard fstat(descriptor, &value) == 0, value.st_mode & S_IFMT == S_IFDIR else {
throw failure("export_directory_unavailable")
}
return Identity(value)
}
/// Follow only Apple's standard /tmp and /var aliases, never arbitrary links.
private static func canonicalPath(_ url: URL) -> String {
let path = url.standardizedFileURL.path
return path == "/tmp" || path.hasPrefix("/tmp/") || path == "/var" || path.hasPrefix("/var/") ? "/private" + path : path
}
private static func directory(_ url: URL) throws -> Int32 {
let normalized = canonicalPath(url)
guard normalized.hasPrefix("/") else { throw failure("invalid_export_directory") }
var held = open("/", O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)
guard held >= 0 else { throw failure("export_directory_unavailable") }
do {
for component in normalized.split(separator: "/") {
let next = openat(held, String(component), O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)
guard next >= 0 else { throw failure("export_directory_changed_or_linked") }
close(held); held = next
}
return held
} catch { close(held); throw error }
}
private func destination() throws -> Int32 {
try check()
let fd = try Self.directory(root)
do {
guard try Self.identity(fd) == rootIdentity else { throw Self.failure("export_destination_changed") }
return fd
} catch { close(fd); throw error }
}
private func source(_ value: Source) throws -> Int32 {
try check()
let fd = try Self.directory(value.directory)
do {
guard try Self.identity(fd) == value.identity else { throw Self.failure("export_artifact_changed") }
return fd
} catch { close(fd); throw error }
}
private static func parent(_ root: Int32, path: String, create: Bool) throws -> (Int32, String) {
try CMOCProject.validateRelativePath(path)
let components = path.split(separator: "/").map(String.init)
guard components.count <= 32, components.allSatisfy({ $0.utf8.count <= 255 }) else { throw failure("invalid_export_path") }
var held = dup(root)
guard held >= 0 else { throw failure("export_directory_unavailable") }
do {
for component in components.dropLast() {
if create, mkdirat(held, component, 0o700) != 0, errno != EEXIST { throw failure("export_write_failed") }
let next = openat(held, component, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)
guard next >= 0 else { throw failure("export_path_changed_or_linked") }
close(held); held = next
}
return (held, components.last!)
} catch { close(held); throw error }
}
private func read(_ product: CMOCBuildOutputProduct, from directory: Int32) throws -> Data {
try check()
guard (0...CMOCProject.maximumFileBytes).contains(product.byteCount) else { throw Self.failure("export_output_too_large") }
let (parent, leaf) = try Self.parent(directory, path: product.relativePath, create: false)
defer { close(parent) }
let fd = openat(parent, leaf, O_RDONLY | O_NOFOLLOW | O_NONBLOCK | O_CLOEXEC)
guard fd >= 0 else { throw Self.failure("export_output_unavailable") }
let file = FileHandle(fileDescriptor: fd, closeOnDealloc: true)
defer { try? file.close() }
var before = stat()
guard fstat(fd, &before) == 0, before.st_mode & S_IFMT == S_IFREG, before.st_nlink == 1,
before.st_size == off_t(product.byteCount) else { throw Self.failure("export_output_changed_or_linked") }
var data = Data()
while data.count < product.byteCount {
try check()
let chunk = try file.read(upToCount: min(65536, product.byteCount - data.count)) ?? Data()
guard !chunk.isEmpty else { throw Self.failure("export_output_changed") }
data.append(chunk)
}
var after = stat(), named = stat()
guard fstat(fd, &after) == 0, Identity(before) == Identity(after), before.st_size == after.st_size,
before.st_mtimespec.tv_sec == after.st_mtimespec.tv_sec, before.st_mtimespec.tv_nsec == after.st_mtimespec.tv_nsec,
fstatat(parent, leaf, &named, AT_SYMLINK_NOFOLLOW) == 0,
named.st_mode & S_IFMT == S_IFREG, named.st_nlink == 1, Identity(named) == Identity(after),
CMOCProject.sha256(data) == product.sha256 else { throw Self.failure("export_output_changed") }
return data
}
private func verifyContents(_ descriptor: Int32, products: [CMOCBuildOutputProduct], flush: Bool = false) throws {
let expected = Set(products.map(\.relativePath))
var observed: Set<String> = []
var visited = 0
func walk(_ fd: Int32, prefix: String, depth: Int) throws {
try check()
guard depth <= 32 else { throw Self.failure("export_delivery_changed") }
let copy = dup(fd)
guard copy >= 0, let stream = fdopendir(copy) else {
if copy >= 0 { close(copy) }; throw Self.failure("export_delivery_changed")
}
defer { closedir(stream) }
while let entry = readdir(stream) {
let name = withUnsafePointer(to: &entry.pointee.d_name) {
$0.withMemoryRebound(to: CChar.self, capacity: Int(entry.pointee.d_namlen) + 1) { String(cString: $0) }
}
if name == "." || name == ".." { continue }
visited += 1
guard visited <= Self.maximumFiles * 33 else { throw Self.failure("export_delivery_changed") }
let path = prefix.isEmpty ? name : prefix + "/" + name
var info = stat()
guard fstatat(fd, name, &info, AT_SYMLINK_NOFOLLOW) == 0 else { throw Self.failure("export_delivery_changed") }
if info.st_mode & S_IFMT == S_IFDIR {
guard expected.contains(where: { $0.hasPrefix(path + "/") }) else { throw Self.failure("export_delivery_changed") }
let child = openat(fd, name, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)
guard child >= 0 else { throw Self.failure("export_delivery_changed") }
defer { close(child) }
try walk(child, prefix: path, depth: depth + 1)
} else {
guard info.st_mode & S_IFMT == S_IFREG, info.st_nlink == 1, expected.contains(path) else { throw Self.failure("export_delivery_changed") }
observed.insert(path)
}
}
if flush, fsync(fd) != 0 { throw Self.failure("export_write_failed") }
}
try walk(descriptor, prefix: "", depth: 0)
guard observed == expected else { throw Self.failure("export_delivery_changed") }
for product in products { _ = try read(product, from: descriptor) }
}
/// Creates a complete new set with an exclusive atomic directory rename.
/// No existing delivery is removed or repaired. The caller binds Source and
/// the request ID to the original connection/build/revision before calling.
func export(source value: Source, products: [CMOCBuildOutputProduct], setName: String) throws -> Delivery {
guard !products.isEmpty, products.count <= Self.maximumFiles,
Set(products.map { $0.relativePath.lowercased() }).count == products.count,
products.allSatisfy({ value.products.contains($0) && (0...CMOCProject.maximumFileBytes).contains($0.byteCount) }),
products.reduce(0, { $0 + $1.byteCount }) <= Self.maximumSetBytes,
setName.hasPrefix("VCC-"), setName.utf8.count < 200, !setName.contains("/") else { throw Self.failure("invalid_export_selection") }
let sourcePath = Self.canonicalPath(value.directory), destinationPath = Self.canonicalPath(root)
guard destinationPath != sourcePath, !destinationPath.hasPrefix(sourcePath + "/") else { throw Self.failure("export_destination_overlaps_artifact") }
let destination = try destination(), source = try source(value)
defer { close(destination); close(source) }
let stageName = ".vccplus-export-" + UUID().uuidString
guard mkdirat(destination, stageName, 0o700) == 0 else { throw Self.failure("export_write_failed") }
let stage = openat(destination, stageName, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)
guard stage >= 0 else { throw Self.failure("export_write_failed") }
defer { close(stage) }
var created: [(String, Identity)] = []
var committed = false
defer {
if !committed {
// Remove only this transaction's unchanged files; never recursively
// erase unexpected files planted in a failed staging directory.
for (path, identity) in created.reversed() {
if let (parent, leaf) = try? Self.parent(stage, path: path, create: false) {
var named = stat()
if fstatat(parent, leaf, &named, AT_SYMLINK_NOFOLLOW) == 0, Identity(named) == identity { _ = unlinkat(parent, leaf, 0) }
close(parent)
}
}
let directories = Set(products.flatMap { product -> [String] in
let parts = product.relativePath.split(separator: "/"); return (1..<parts.count).map { parts.prefix($0).joined(separator: "/") }
}).sorted { $0.count > $1.count }
for path in directories {
if let (parent, leaf) = try? Self.parent(stage, path: path, create: false) { _ = unlinkat(parent, leaf, AT_REMOVEDIR); close(parent) }
}
_ = unlinkat(destination, stageName, AT_REMOVEDIR)
}
}
for (index, product) in products.enumerated() {
let checkDestination = try self.destination(); close(checkDestination)
let checkSource = try self.source(value); close(checkSource)
let bytes = try read(product, from: source)
let (parent, leaf) = try Self.parent(stage, path: product.relativePath, create: true)
defer { close(parent) }
let fd = openat(parent, leaf, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC, 0o600)
guard fd >= 0 else { throw Self.failure("export_write_failed") }
let file = FileHandle(fileDescriptor: fd, closeOnDealloc: true)
defer { try? file.close() }
var info = stat()
guard fstat(fd, &info) == 0 else { throw Self.failure("export_write_failed") }
created.append((product.relativePath, Identity(info)))
for offset in stride(from: 0, to: bytes.count, by: 65536) {
try check()
try file.write(contentsOf: bytes.subdata(in: offset..<min(bytes.count, offset + 65536)))
}
guard fsync(fd) == 0 else { throw Self.failure("export_write_failed") }
try afterFile?(index)
}
// Verify the actual staged bytes and source hashes again before commit.
for product in products { _ = try read(product, from: stage); _ = try read(product, from: source) }
try beforeCommit?()
try verifyContents(stage, products: products, flush: true)
for product in products { _ = try read(product, from: source) }
let currentDestination = try self.destination(), currentSource = try self.source(value)
defer { close(currentDestination); close(currentSource) }
var stageInfo = stat(), namedStage = stat()
guard fstat(stage, &stageInfo) == 0, fstatat(destination, stageName, &namedStage, AT_SYMLINK_NOFOLLOW) == 0,
namedStage.st_mode & S_IFMT == S_IFDIR, Identity(stageInfo) == Identity(namedStage) else { throw Self.failure("export_staging_changed") }
try check()
// Revocation cannot race between the final authority check and rename.
state.lock()
guard valid, !Task.isCancelled else { state.unlock(); throw Self.failure("access_denied") }
let renamed = renameatx_np(destination, stageName, destination, setName, UInt32(RENAME_EXCL))
let renameError = errno
if renamed == 0 { committed = true }
state.unlock()
guard renamed == 0 else {
throw Self.failure(renameError == EEXIST ? "export_destination_conflict" : "export_commit_failed")
}
// The staged file data was flushed before rename; never delete an exposed
// delivery to roll back a directory-flush failure.
guard fsync(destination) == 0 else { throw Self.failure("export_commit_uncertain") }
return Delivery(directory: setName, products: products)
}
func verify(_ delivery: Delivery) throws {
let destination = try destination(); defer { close(destination) }
let directory = openat(destination, delivery.directory, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)
guard directory >= 0 else { throw Self.failure("export_delivery_changed") }
defer { close(directory) }
try verifyContents(directory, products: delivery.products)
let current = try self.destination(); close(current)
}
}
+162 -15
View File
@@ -94,7 +94,7 @@ struct MCPProjectRefreshRecord {
let next = offset + bounded.items.count
return (bounded.items, next < entries.count ? next : nil, bounded.truncated)
}
static let safeTools: Set<String> = ["get_capabilities", "get_machine_status", "get_build", "get_build_log", "get_project_refresh", "read_project_inputs", "refresh_project", "read_project_file", "get_proposal"]
static let safeTools: Set<String> = ["get_capabilities", "get_machine_status", "get_build", "get_build_log", "get_project_refresh", "read_project_inputs", "refresh_project", "read_project_file", "get_proposal", "export_build_outputs", "get_build_export"]
}
/// The grant binds reviewed drafts and build artifacts to one selected project.
@@ -152,9 +152,42 @@ final class MCPCMOC: ObservableObject {
private var approvedRecipeID: String?
@Published var allowProjectMakefile = false
@Published var allowPlaytests = false
@Published var allowBuildExport = false
@Published fileprivate private(set) var exportFolderName: String?
private var selectedExportDirectory: URL?
fileprivate var buildExporter: MCPBuildExporter?
private var exportSources: [String: (revision: Int, configuration: String, source: MCPBuildExporter.Source)] = [:]
private struct ExportRecord {
let identity: String
let base: [String: Any]
var status = "exporting"
var delivery: MCPBuildExporter.Delivery?
var reason: String?
var fields: [String: Any] {
var value = base
value["status"] = status; value["busy"] = status == "exporting"
if let delivery {
value["delivery_directory"] = delivery.directory
let artifactID = UUID(uuidString: base["artifact_id"] as? String ?? "")!
value["outputs"] = delivery.products.map { product -> [String: Any] in
var fields = product.fields(artifactID: artifactID)
fields["relative_filename"] = delivery.directory + "/" + product.relativePath
return fields
}
}
if let reason { value["error"] = reason }
return value
}
}
private var exportRecords: [String: ExportRecord] = [:]
private var exportRequests: [String: String] = [:]
private var exportWork: Task<Void, Never>?
private var exporting = false
private var exportReservedBytes = 0
fileprivate private(set) var playtestsApproved = false
private var callContextApproved = false
private var playtestMediaApproved = false
private var playtestMultiDriveApproved = false
#if DEBUG
private var regressionPlaytestHelper: URL?
private var regressionStarterKit: StarterKit?
@@ -376,9 +409,11 @@ final class MCPCMOC: ObservableObject {
#if DEBUG
func exportCallContextRegression(_ model: CMOCDevelopmentModel, at destination: URL, playtests: Bool = true,
helperURL: URL? = nil, roms: URL? = nil) async throws {
helperURL: URL? = nil, roms: URL? = nil, exportFolder: URL? = nil) async throws {
allowProjectMakefile = true
allowPlaytests = playtests
allowBuildExport = exportFolder != nil; selectedExportDirectory = exportFolder
exportFolderName = exportFolder?.lastPathComponent
try await grant(model, at: destination)
regressionPlaytestHelper = helperURL
regressionStarterKit = roms.map { StarterKit(directory: $0) }
@@ -401,7 +436,7 @@ final class MCPCMOC: ObservableObject {
private func sanitized(_ text: String) -> String {
var result = text
for root in [scratch, model?.project?.directory].compactMap({ $0 }) {
for root in [scratch, model?.project?.directory, selectedExportDirectory].compactMap({ $0 }) {
result = result.replacingOccurrences(of: root.path, with: "<project>")
}
return String(result.prefix(2000))
@@ -588,6 +623,8 @@ final class MCPCMOC: ObservableObject {
presentationIsCurrent: (@MainActor () -> Bool)? = nil) async throws {
let id = model.assistantProjectID, ticket = UUID(), secret = UUID().uuidString + UUID().uuidString
let approvedPlaytests = allowPlaytests
let approvedExport = allowBuildExport, approvedExportDirectory = selectedExportDirectory
if approvedExport && approvedExportDirectory == nil { throw problem("Choose a delivery folder before sharing build export access.") }
let cleanup = revoke()
session = ticket
pendingModel = model
@@ -597,6 +634,7 @@ final class MCPCMOC: ObservableObject {
guard let project = model.project else { throw problem("project_unavailable") }
let scope = try MCPCMOCProject(project: project, files: model.files.map(\.relativePath), customMake: allowProjectMakefile)
let captured = try await capture(model, scope: scope, updatedScope: true, expandedSupport: true)
let exporter = try await Task.detached { try approvedExport ? MCPBuildExporter(destination: approvedExportDirectory!) : nil }.value
guard session == ticket, model.assistantProjectID == id, presentationIsCurrent?() != false else { throw problem("stale_revision") }
let dir = FileManager.default.temporaryDirectory.appendingPathComponent("vcc-c-project-" + UUID().uuidString)
let handler: MCPTransport.Handler = { [weak self] data in
@@ -607,7 +645,7 @@ final class MCPCMOC: ObservableObject {
try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: false, attributes: [.posixPermissions: 0o700])
do {
let server = try MCPTransport(handler: handler)
let bytes = try JSONSerialization.data(withJSONObject: ["token": secret, "kind": "cmoc", "toolset": 12, "playtestVideo": approvedPlaytests, "playtestMedia": approvedPlaytests, "playtestCallContext": approvedPlaytests, "projectRefresh": true, "projectDiagnostics": true, "playtestAudio": approvedPlaytests, "playtestProcessors": approvedPlaytests, "playtestJoysticks": approvedPlaytests, "customMake": scope.customMake, "playtest": approvedPlaytests, "canPropose": true,
let bytes = try JSONSerialization.data(withJSONObject: ["token": secret, "kind": "cmoc", "toolset": 13, "buildExport": approvedExport, "playtestMultiDrive": approvedPlaytests, "playtestVideo": approvedPlaytests, "playtestMedia": approvedPlaytests, "playtestCallContext": approvedPlaytests, "projectRefresh": true, "projectDiagnostics": true, "playtestAudio": approvedPlaytests, "playtestProcessors": approvedPlaytests, "playtestJoysticks": approvedPlaytests, "customMake": scope.customMake, "playtest": approvedPlaytests, "canPropose": true,
"socket": server.unixPath, "port": Int(server.port), "version": 1])
return (server, try MCPGrantFile(create: destination, data: bytes))
} catch { try? FileManager.default.removeItem(at: dir); throw error }
@@ -616,12 +654,14 @@ final class MCPCMOC: ObservableObject {
Task.detached { server.stop(); file.remove(); try? FileManager.default.removeItem(at: dir) }
throw problem("stale_revision")
}
self.buildExporter = exporter
self.server = server; self.file = file; token = secret; projectID = id; self.model = model
scratch = dir; service = CMOCBuildService(toolchain: model.service.toolchain, buildRoot: dir.appendingPathComponent("Builds"))
snapshot = captured.live; diskSnapshot = captured.disk; workspaceEpoch = captured.epoch; makeSnapshot = captured.make; approvedInputs = captured.manifest; revision = 0
self.playtestsApproved = approvedPlaytests
self.callContextApproved = approvedPlaytests
self.playtestMediaApproved = approvedPlaytests
self.playtestMultiDriveApproved = approvedPlaytests
self.scope = captured.scope; templateDirectives = captured.directives; approvedRecipeID = captured.make?.recipeID
active = true; status = "Connected to " + (model.project?.directory.lastPathComponent ?? "Hello Disk")
}
@@ -629,8 +669,11 @@ final class MCPCMOC: ObservableObject {
@discardableResult func revoke() -> Task<Void, Never> {
let playtestCleanup = playtest?.invalidate()
let old = server, grant = file, dir = scratch, work = buildTask, guest = runTask
buildExporter?.invalidate(); buildExporter = nil
let exportTask = exportWork; exportTask?.cancel(); exportWork = nil
exportRecords.removeAll(); exportRequests.removeAll(); exportSources.removeAll(); exporting = false; exportReservedBytes = 0
session = UUID(); token = ""; projectID = nil; active = false; model = nil; pendingModel = nil
callContextApproved = false; playtestMediaApproved = false
callContextApproved = false; playtestMediaApproved = false; playtestMultiDriveApproved = false
#if DEBUG
regressionPlaytestHelper = nil; regressionStarterKit = nil
#endif
@@ -649,7 +692,7 @@ final class MCPCMOC: ObservableObject {
await startupCleanup?.value
await playtestCleanup?.value
old?.stop(); grant?.remove()
await work?.value; await guest?.value
await work?.value; await guest?.value; await exportTask?.value
if let dir { try? FileManager.default.removeItem(at: dir) }
}
}
@@ -698,7 +741,7 @@ final class MCPCMOC: ObservableObject {
if let latestRefreshID, let record = refreshRecords[latestRefreshID] { fields["refresh"] = projectRefreshFields(record) }
result = fields
case "get_capabilities" where args.isEmpty:
result = ["tools": Self.tools + (callContextApproved ? ["get_call_context"] : []) + (playtestMediaApproved ? ["list_playtest_media", "exchange_playtest_media"] : []) + (playtestsApproved ? ["list_playtest_disks", "start_playtest", "playtest_input", "get_playtest_input", "playtest_debug", "capture_playtest", "capture_playtest_graphics", "capture_playtest_audio", "start_playtest_video", "stop_playtest_video", "read_playtest_video", "restart_playtest", "stop_playtest"] : []), "playtest_media_exchange": playtestMediaApproved, "playtest_media_drive": "FD0", "playtest_media_maximum_disks": 9, "playtest_media_maximum_disk_bytes": 512 * 1024, "call_context": callContextApproved, "call_context_maximum_stack_bytes": 64, "input_diagnostics": true, "playtest_joystick_input": playtestsApproved, "playtest_joystick_interfaces": playtestsApproved ? ["standard"] : [], "playtest_joystick_axis_min": 0, "playtest_joystick_axis_max": 16383, "playtest_joystick_axis_center": 8191, "owned_playtests": playtestsApproved, "async_playtest_start": playtestsApproved, "retained_playtest_disks": playtestsApproved, "period_key": playtestsApproved, "graphics_buffer_capture": playtestsApproved, "custom_gime_canvases": playtestsApproved, "source_only_debugging": playtestsApproved, "verified_flat_debugging": playtestsApproved, "video_capture": playtestsApproved, "video_capture_maximum_fields": 3600, "video_capture_maximum_clips": 4, "video_capture_maximum_bytes": 64 * 1024 * 1024, "video_capture_retained_maximum_bytes": 256 * 1024 * 1024, "video_capture_chunk_maximum_bytes": 65536, "video_capture_guest_only": true, "video_capture_optional_audio": true, "video_capture_ui_cues": false, "audio_capture": playtestsApproved, "audio_capture_maximum_fields": 120, "audio_capture_maximum_clips": 16, "audio_capture_maximum_bytes": 4 * 1024 * 1024, "build_diagnostics": true, "project_refresh": true, "input_status": refreshProblem ?? "approved", "changed_input_paths": Array(observedInputChanges.prefix(128)).map(\.path), "changed_input_paths_total": observedInputChanges.count, "changed_input_paths_truncated": observedInputChanges.count > 128, "kind": "cmoc", "app": "VCC Plus OSS",
result = ["tools": Self.tools + (buildExporter != nil ? ["export_build_outputs", "get_build_export"] : []) + (callContextApproved ? ["get_call_context"] : []) + (playtestMediaApproved ? ["list_playtest_media", "exchange_playtest_media"] : []) + (playtestsApproved ? ["list_playtest_disks", "start_playtest", "playtest_input", "get_playtest_input", "playtest_debug", "capture_playtest", "capture_playtest_graphics", "capture_playtest_audio", "start_playtest_video", "stop_playtest_video", "read_playtest_video", "restart_playtest", "stop_playtest"] : []), "build_output_export": buildExporter != nil, "export_destinations": buildExporter.map { [["destination_id": $0.destinationID, "kind": "approved_folder"]] } ?? [], "export_maximum_files": MCPBuildExporter.maximumFiles, "export_maximum_file_bytes": CMOCProject.maximumFileBytes, "export_maximum_set_bytes": MCPBuildExporter.maximumSetBytes, "export_maximum_session_bytes": MCPBuildExporter.maximumSessionBytes, "export_maximum_requests": MCPBuildExporter.maximumRequests, "playtest_media_exchange": playtestMediaApproved, "playtest_media_drive": "FD0", "playtest_media_drives": playtestMultiDriveApproved ? [0, 1, 2, 3] : [0], "playtest_media_version": playtestMultiDriveApproved ? 2 : 1, "playtest_media_write_protection": playtestMultiDriveApproved, "playtest_media_maximum_disks": 9, "playtest_media_maximum_disk_bytes": 512 * 1024, "call_context": callContextApproved, "call_context_maximum_stack_bytes": 64, "input_diagnostics": true, "playtest_joystick_input": playtestsApproved, "playtest_joystick_interfaces": playtestsApproved ? ["standard"] : [], "playtest_joystick_axis_min": 0, "playtest_joystick_axis_max": 16383, "playtest_joystick_axis_center": 8191, "owned_playtests": playtestsApproved, "async_playtest_start": playtestsApproved, "retained_playtest_disks": playtestsApproved, "period_key": playtestsApproved, "graphics_buffer_capture": playtestsApproved, "custom_gime_canvases": playtestsApproved, "source_only_debugging": playtestsApproved, "verified_flat_debugging": playtestsApproved, "video_capture": playtestsApproved, "video_capture_maximum_fields": 3600, "video_capture_maximum_clips": 4, "video_capture_maximum_bytes": 64 * 1024 * 1024, "video_capture_retained_maximum_bytes": 256 * 1024 * 1024, "video_capture_chunk_maximum_bytes": 65536, "video_capture_guest_only": true, "video_capture_optional_audio": true, "video_capture_ui_cues": false, "audio_capture": playtestsApproved, "audio_capture_maximum_fields": 120, "audio_capture_maximum_clips": 16, "audio_capture_maximum_bytes": 4 * 1024 * 1024, "build_diagnostics": true, "project_refresh": true, "input_status": refreshProblem ?? "approved", "changed_input_paths": Array(observedInputChanges.prefix(128)).map(\.path), "changed_input_paths_total": observedInputChanges.count, "changed_input_paths_truncated": observedInputChanges.count > 128, "kind": "cmoc", "app": "VCC Plus OSS",
"mutation_request_limit": MCPPlaytest.mutationRequestLimit, "stop_retention_exempt": true,
"playtest_processors": playtestsApproved ? ["MC6809", "HD6309"] : [],
"playtest_default_processor": "MC6809", "playtest_processor_selection": playtestsApproved,
@@ -722,6 +765,12 @@ final class MCPCMOC: ObservableObject {
facts["run_requirement"] = playtestsApproved ? "Owned playtests may cold-boot a copy of the current artifact disk or a selected retained test disk in an isolated 512 KB MC6809 or HD6309 worker. MC6809 is the default; the guest controls HD6309 execution mode. Debug evidence stays bound to the current artifact and is checked against runtime bytes." : "Start in VCC Plus; source debugging requires a verified map matching the delivered binary."
return pack(["result": facts])
}
case "export_build_outputs":
result = try await exportBuildOutputs(args, projectID: id, owner: owner)
case "get_build_export":
guard args.count == 2, args["project_id"] as? String == id, buildExporter != nil,
let exportID = args["export_id"] as? String, let record = exportRecords[exportID] else { throw problem("unknown_export") }
result = record.fields
case "get_machine_status" where args.isEmpty:
let observed = await model.machine.mcpReadinessSnapshot()
let tools = CMOCBuildService.requiredExecutables + ["mcpp"] +
@@ -1098,6 +1147,7 @@ final class MCPCMOC: ObservableObject {
var origin = "verified_artifact"
var originArtifactID: String? = artifact.id.uuidString
var originArtifactDiskSHA256: String? = expectedDisk
var selectedWriteProtected: Bool?
if let retainedID, let retainedSHA {
start.updatePhase("reading_retained_disk")
let saved = try await MCPPlaytestDiskStore.load(directory: storage.directory, id: retainedID,
@@ -1105,12 +1155,13 @@ final class MCPCMOC: ObservableObject {
selectedDisk = saved.data; origin = saved.record.provenance.origin
originArtifactID = saved.record.provenance.originArtifactID
originArtifactDiskSHA256 = saved.record.provenance.originArtifactDiskSHA256
selectedWriteProtected = saved.record.provenance.writeProtected
}
guard current() else { throw problem("stale_run") }
let provenance = MCPPlaytestDiskStore.Provenance(projectKey: storage.key, artifactID: artifact.id.uuidString,
artifactDiskSHA256: expectedDisk, parentDiskID: retainedID, origin: origin,
originArtifactID: originArtifactID, originArtifactDiskSHA256: originArtifactDiskSHA256,
mediaKey: playtestMediaApproved ? "primary" : nil, mediaBaseSHA256: playtestMediaApproved ? expectedDisk : nil)
mediaKey: playtestMediaApproved ? "primary" : nil, mediaBaseSHA256: playtestMediaApproved ? expectedDisk : nil, writeProtected: selectedWriteProtected)
var media: [MCPPlaytestMedium]?
if playtestMediaApproved {
var selected = try await artifactMedia(artifact, projectKey: storage.key, primaryData: payload.2)
@@ -1128,7 +1179,7 @@ final class MCPCMOC: ObservableObject {
let origin = MCPPlaytestDiskStore.Provenance(projectKey: storage.key, artifactID: artifact.id.uuidString,
artifactDiskSHA256: expectedDisk, parentDiskID: diskID, origin: prior.origin,
originArtifactID: prior.originArtifactID, originArtifactDiskSHA256: prior.originArtifactDiskSHA256,
mediaKey: item.key, mediaBaseSHA256: item.baseSHA256)
mediaKey: item.key, mediaBaseSHA256: item.baseSHA256, writeProtected: prior.writeProtected)
selected[index] = MCPPlaytestMedium(id: item.id, name: item.name, key: item.key,
baseSHA256: item.baseSHA256, data: copy.data, provenance: origin)
}
@@ -1151,7 +1202,7 @@ final class MCPCMOC: ObservableObject {
bootCommands: scope.configuration.launchCommands.joined(separator: "\n") + "\n",
projectID: projectID!.uuidString, revision: revision, artifactID: artifact.id.uuidString, modules: modules, stopAt: stop, stopModule: stopModule, flatGuards: flatGuards, cpu: processor.workerCPU, helperURL: helperURL,
retentionDirectory: storage.directory, diskProvenance: provenance, resumedDiskID: retainedID,
graphicsBuffers: graphicsBuffers, runID: start.runID, media: media)
graphicsBuffers: graphicsBuffers, runID: start.runID, media: media, multiDrive: playtestMultiDriveApproved)
guard current() else { await owned.invalidate().value; throw problem("stale_run") }
playtest = owned
start.updatePhase("capturing_initial_state")
@@ -1387,6 +1438,63 @@ final class MCPCMOC: ObservableObject {
return Int(exactly: n)
}
private func exportBuildOutputs(_ arguments: [String: Any], projectID: String, owner: UUID) async throws -> [String: Any] {
guard arguments.count == 7, Set(arguments.keys) == ["project_id", "build_id", "artifact_id", "revision", "destination_id", "output_ids", "request_id"],
arguments["project_id"] as? String == projectID, let exporter = buildExporter,
arguments["destination_id"] as? String == exporter.destinationID,
let buildID = arguments["build_id"] as? String, builds[buildID]?["status"] as? String == "succeeded", let source = exportSources[buildID],
arguments["artifact_id"] as? String == source.source.artifactID.uuidString,
int(arguments["revision"]) == source.revision,
let outputs = arguments["output_ids"] as? [String], !outputs.isEmpty,
outputs.count <= MCPBuildExporter.maximumFiles, Set(outputs).count == outputs.count,
outputs.allSatisfy({ $0.utf8.count == 64 && $0.utf8.allSatisfy { (48...57).contains($0) || (97...102).contains($0) } }),
let request = arguments["request_id"] as? String, (1...128).contains(request.utf8.count) else { throw problem("invalid_export_selection") }
let catalog = Dictionary(uniqueKeysWithValues: source.source.products.map { ($0.identifier(artifactID: source.source.artifactID), $0) })
let selected = try outputs.sorted().map { id -> CMOCBuildOutputProduct in
guard let product = catalog[id] else { throw problem("undeclared_export_output") }; return product
}
let identityData = try JSONSerialization.data(withJSONObject: ["build_id": buildID, "artifact_id": source.source.artifactID.uuidString,
"revision": source.revision, "destination_id": exporter.destinationID, "outputs": outputs.sorted()], options: [.sortedKeys])
let identity = CMOCProject.sha256(identityData)
if let exportID = exportRequests[request], let record = exportRecords[exportID] {
guard record.identity == identity else { throw problem("request_id_conflict") }
if let delivery = record.delivery {
guard !exporting else { throw problem("export_busy_or_limit") }
exporting = true
defer { if session == owner { exporting = false } }
let work = Task.detached { try exporter.verify(delivery) }
try await withTaskCancellationHandler(operation: { try await work.value }, onCancel: { work.cancel() })
guard session == owner, active, buildExporter === exporter else { throw problem("access_denied") }
}
return record.fields
}
let count = selected.reduce(0) { $0 + $1.byteCount }
guard !exporting, exportRecords.count < MCPBuildExporter.maximumRequests,
count <= MCPBuildExporter.maximumSetBytes,
exportReservedBytes <= MCPBuildExporter.maximumSessionBytes - count else { throw problem("export_busy_or_limit") }
let exportID = UUID().uuidString
let name = "VCC-" + source.source.artifactID.uuidString + "-" + String(CMOCProject.sha256(Data(request.utf8)).prefix(16))
let record = ExportRecord(identity: identity, base: ["project_id": projectID, "build_id": buildID,
"artifact_id": source.source.artifactID.uuidString, "revision": source.revision, "configuration": source.configuration,
"destination_id": exporter.destinationID, "request_id": request, "export_id": exportID, "poll_tool": "get_build_export"])
exportRequests[request] = exportID; exportRecords[exportID] = record
exportReservedBytes += count; exporting = true
exportWork = Task {
let work = Task.detached { try exporter.export(source: source.source, products: selected, setName: name) }
do {
let delivery = try await withTaskCancellationHandler(operation: { try await work.value }, onCancel: { work.cancel() })
guard active, session == owner, buildExporter === exporter else { return }
exportRecords[exportID]?.delivery = delivery; exportRecords[exportID]?.status = "completed"
} catch {
guard active, session == owner, buildExporter === exporter else { return }
exportRecords[exportID]?.status = error is CancellationError ? "cancelled" : "failed"
exportRecords[exportID]?.reason = sanitized(error.localizedDescription)
}
if session == owner { exporting = false; exportWork = nil }
}
return record.fields
}
private func buildRecord(_ id: String) -> [String: Any]? {
guard var record = builds[id] else { return nil }
if record["revision"] as? Int != revision || refreshProblem != nil { record["status"] = "stale" }
@@ -1445,6 +1553,12 @@ final class MCPCMOC: ObservableObject {
}.value
guard session == owner, revision == expected, refreshProblem == nil, readyArtifact?.value.id == artifact.id else { throw problem("stale_revision") }
result["source_debugging"] = evidence
result["exportable_outputs"] = artifact.exportProducts.map { $0.fields(artifactID: artifact.id) }
if buildExporter != nil {
let source = try await Task.detached { try MCPBuildExporter.Source(artifact) }.value
guard session == owner, active else { throw problem("access_denied") }
exportSources[id] = (expected, artifact.configurationName, source)
}
result["playtest_disk_products"] = artifact.playtestDiskProducts.map {
["media_id": MCPPlaytestMedium.identifier(artifactID: artifact.id.uuidString, key: "disk:" + $0.relativePath),
"path": $0.relativePath, "bytes": $0.byteCount, "sha256": $0.sha256] as [String: Any]
@@ -1712,11 +1826,31 @@ final class MCPCMOC: ObservableObject {
view: MCPCMOCConsent(host: self, model: model))
consentPanel = w; consentModel = model; w.makeKeyAndOrderFront(nil)
}
fileprivate func chooseExportDirectory(_ model: CMOCDevelopmentModel) {
guard let owner = consentPanel, consentModel === model, !active, owner.isVisible, owner.attachedSheet == nil else { return }
let project = model.assistantProjectID, generation = session
let picker = NSOpenPanel(); picker.canChooseDirectories = true; picker.canChooseFiles = false
picker.allowsMultipleSelection = false; picker.canCreateDirectories = true
picker.title = "Choose Build Delivery Folder"; picker.prompt = "Approve Folder"
picker.message = "Allow this connection to create new build-delivery sets here. Existing files are never replaced."
picker.beginSheetModal(for: owner) { [weak self, weak owner, weak model] response in
Task { @MainActor in
guard let self, let owner, let model, self.consentPanel === owner, self.consentModel === model,
owner.isVisible, !self.active, self.session == generation, model.assistantProjectID == project,
response == .OK, let url = picker.url else { return }
do {
_ = try await Task.detached { try MCPBuildExporter(destination: url) }.value
guard self.session == generation, !self.active, self.consentModel === model else { return }
self.selectedExportDirectory = url; self.exportFolderName = url.lastPathComponent
} catch { self.status = "Could not approve that delivery folder. " + error.localizedDescription }
}
}
}
fileprivate func exportGrant(_ model: CMOCDevelopmentModel) {
guard let owner = consentPanel, consentModel === model, owner.isVisible,
!owner.isMiniaturized, owner.attachedSheet == nil else { return }
let project = model.assistantProjectID, generation = session
let approvedMake = allowProjectMakefile, approvedPlaytests = allowPlaytests
let approvedMake = allowProjectMakefile, approvedPlaytests = allowPlaytests, approvedExport = allowBuildExport, approvedFolder = selectedExportDirectory
let picker = NSSavePanel(); picker.title = "Share C Project for Reviewed Changes"
picker.message = "Choose a new private connection file for the local assistant."
picker.nameFieldStringValue = "VCC Plus OSS C Connection.json"
@@ -1726,7 +1860,8 @@ final class MCPCMOC: ObservableObject {
@MainActor func currentPresentation() -> Bool {
self.consentPanel === owner && self.consentModel === model && owner.isVisible &&
!owner.isMiniaturized && model.assistantProjectID == project &&
self.allowProjectMakefile == approvedMake && self.allowPlaytests == approvedPlaytests
self.allowProjectMakefile == approvedMake && self.allowPlaytests == approvedPlaytests &&
self.allowBuildExport == approvedExport && self.selectedExportDirectory == approvedFolder
}
guard currentPresentation(), self.session == generation else { return }
defer { if currentPresentation() { owner.makeKeyAndOrderFront(nil) } }
@@ -1872,11 +2007,22 @@ private struct MCPCMOCConsent: View {
if !host.active {
Toggle("Allow Disposable Playtests", isOn: $host.allowPlaytests)
if host.allowPlaytests {
Text("Allow the assistant to launch this project's built disk or resume a retained test disk in a separate 512 KB 6809 or 6309 CoCo, hold key combinations and standard joystick axes and buttons, read input diagnostics, capture its screen, declared graphics buffers and guest audio, record bounded MP4 gameplay clips with optional CoCo audio, inspect verified program stops and shared data, read up to 64 bytes at the paused test guest’s stack pointer with caller and argument interpretations only when verified, and restart its own writable test disks. Reviewed additional disk products can be inserted or ejected in the paused, idle test drive without a reset or advancing time; each private writable copy is retained. The guest controls 6309 execution mode. Audio capture advances the test guest. Mac windows, microphone and capture feedback cues are excluded. Retained originals and your current CoCo and media are preserved. Access ends when this connection or build changes.").font(.callout)
Text("Allow the assistant to launch this project's built disk or resume a retained test disk in a separate 512 KB 6809 or 6309 CoCo, hold key combinations and standard joystick axes and buttons, read input diagnostics, capture its screen, declared graphics buffers and guest audio, record bounded MP4 gameplay clips with optional CoCo audio, inspect verified program stops and shared data, read up to 64 bytes at the paused test guest’s stack pointer with caller and argument interpretations only when verified, and restart its own writable test disks. Reviewed additional disk products can be inserted or ejected in any of four paused test drives while the shared controller is idle without a reset or advancing time; each private writable copy is retained. The guest controls 6309 execution mode. Audio capture advances the test guest. Mac windows, microphone and capture feedback cues are excluded. Retained originals and your current CoCo and media are preserved. Access ends when this connection or build changes.").font(.callout)
}
if host.allowPlaytests, let media = model.project?.configuration.playtestDisks, !media.isEmpty {
Text("Additional playtest disks: " + media.joined(separator: ", ")).font(.callout).textSelection(.enabled)
}
Toggle("Allow Build Output Export", isOn: $host.allowBuildExport)
if host.allowBuildExport {
Text("Allow delivery of this connection's declared build products to one folder you approve. Each delivery creates a new set with verified original hashes; existing files are never replaced. Older successful builds remain selectable until access is revoked.").font(.callout)
HStack {
Button("Choose Delivery Folder…") { host.chooseExportDirectory(model) }
Text(host.exportFolderName ?? "No delivery folder selected").font(.callout)
}
if let paths = model.project?.configuration.exportOutputs, !paths.isEmpty {
Text("Additional delivery outputs: " + paths.joined(separator: ", ")).font(.callout).textSelection(.enabled)
}
}
Toggle("Use Project Makefile", isOn: $host.allowProjectMakefile)
if host.allowProjectMakefile {
Text("Allow builds using this project's existing Makefile and declared configurations. Make recipes and compiler inputs can execute local commands, just as Build does. Recipe or support-file changes require native review through project refresh.").font(.callout)
@@ -1892,7 +2038,8 @@ private struct MCPCMOCConsent: View {
}
Text("The assistant's model provider may receive the shared files and diagnostics.").font(.callout)
if host.active {
if host.playtestsApproved { Text("Disposable playtests and bounded read-only call context are enabled for this connection. Each test uses a separate CoCo and its own disk copies. Paused-drive media exchange is available for this connection's reviewed disk products.").font(.callout) }
if host.buildExporter != nil { Text("Build output export is enabled for the approved delivery folder. Revoke access to end this permission.").font(.callout) }
if host.playtestsApproved { Text("Disposable playtests and bounded read-only call context are enabled for this connection. Each test uses a separate CoCo and its own disk copies. Drive-targeted FD0–FD3 media exchange and insert-time write protection are available for this connection's reviewed disk products.").font(.callout) }
if let url = host.grantURL {
MCPChatGPTSetup(grantURL: url, firstPrompt: "Identify my shared VCC Plus C project and read its entry source. Describe its target and what the CoCo program does.")
}
@@ -1903,7 +2050,7 @@ private struct MCPCMOCConsent: View {
Button("Run C Build…") { Task { await host.run(selectedRun) } }.disabled(selectedRun == nil || host.running || host.building)
}
}
} else { Button("Save Private Connection…") { host.exportGrant(model) } }
} else { Button("Save Private Connection…") { host.exportGrant(model) }.disabled(host.allowBuildExport && host.exportFolderName == nil) }
if !host.runStatus.isEmpty { Text(host.runStatus).font(.callout).textSelection(.enabled) }
Text(host.status).font(.callout).textSelection(.enabled)
}.padding(18).frame(maxWidth: .infinity, alignment: .leading)
+305 -19
View File
@@ -59,15 +59,23 @@ struct MCPPlaytestDiskStore: Sendable {
let originArtifactDiskSHA256: String?
let mediaKey: String?
let mediaBaseSHA256: String?
let writeProtected: Bool?
init(projectKey: String?, artifactID: String?, artifactDiskSHA256: String?, parentDiskID: String? = nil,
origin: String = "verified_artifact", originArtifactID: String? = nil, originArtifactDiskSHA256: String? = nil,
mediaKey: String? = nil, mediaBaseSHA256: String? = nil) {
mediaKey: String? = nil, mediaBaseSHA256: String? = nil, writeProtected: Bool? = nil) {
self.projectKey = projectKey; self.artifactID = artifactID; self.artifactDiskSHA256 = artifactDiskSHA256
self.parentDiskID = parentDiskID; self.origin = origin
self.originArtifactID = originArtifactID ?? (origin == "verified_artifact" ? artifactID : nil)
self.originArtifactDiskSHA256 = originArtifactDiskSHA256 ?? (origin == "verified_artifact" ? artifactDiskSHA256 : nil)
self.mediaKey = mediaKey; self.mediaBaseSHA256 = mediaBaseSHA256
self.mediaKey = mediaKey; self.mediaBaseSHA256 = mediaBaseSHA256; self.writeProtected = writeProtected
}
func protecting(_ enabled: Bool) -> Self {
Self(projectKey: projectKey, artifactID: artifactID, artifactDiskSHA256: artifactDiskSHA256,
parentDiskID: parentDiskID, origin: origin, originArtifactID: originArtifactID,
originArtifactDiskSHA256: originArtifactDiskSHA256, mediaKey: mediaKey,
mediaBaseSHA256: mediaBaseSHA256, writeProtected: enabled)
}
var publicFields: [String: Any] {
@@ -76,6 +84,8 @@ struct MCPPlaytestDiskStore: Sendable {
"origin_artifact_id": originArtifactID as Any? ?? NSNull(),
"origin_artifact_disk_sha256": originArtifactDiskSHA256 as Any? ?? NSNull()]
if let parentDiskID { fields["parent_disk_id"] = parentDiskID }
fields["write_protected"] = writeProtected ?? false
fields["write_protection_recorded"] = writeProtected != nil
fields["media_key"] = mediaKey ?? "primary"
fields["media_base_sha256"] = (mediaBaseSHA256 ?? artifactDiskSHA256) as Any? ?? NSNull()
return fields
@@ -485,11 +495,19 @@ final class MCPPlaytest {
let source: MCPPlaytestMedium
var data: Data
var dirty = false
var writeProtected = false
var retained: MCPPlaytestDiskStore.Record?
var pendingRecordID: String?
}
private var media: [String: MediumState]?
private var mediaOrder: [String] = []
private let multiDrive: Bool
private var mountedMediaIDs: [String?] = Array(repeating: nil, count: 4)
private var pendingMediaDrive: Int?
private var lastSafeMediaExports: [Int: [String: Any]] = [:]
private var frozenDriveExports = Set<Int>()
private var mediaFreezeAcknowledged = false
private var mediaStopDrained = false
private var mountedMediaID: String?
private var mediaExchangeTask: Task<[String: Any], Error>?
private var mediaFailures: [String: (Data, String)] = [:]
@@ -499,16 +517,17 @@ final class MCPPlaytest {
private init(worker: Worker, projectID: String, revision: Int, artifactID: String, retentionDirectory: URL,
diskProvenance: MCPPlaytestDiskStore.Provenance, resumedDiskID: String?, runID: String,
processor: MCPPlaytestProcessor, media: [MCPPlaytestMedium]?,
processor: MCPPlaytestProcessor, media: [MCPPlaytestMedium]?, multiDrive: Bool,
videoArtifactWillVerify: (@Sendable (URL) throws -> Void)?) {
self.runID = runID
self.worker = worker; self.projectID = projectID; self.revision = revision; self.artifactID = artifactID
self.retentionDirectory = retentionDirectory; self.diskProvenance = diskProvenance; self.resumedDiskID = resumedDiskID
self.processor = processor
self.processor = processor; self.multiDrive = multiDrive
self.videoArtifactWillVerify = videoArtifactWillVerify
if let media {
self.media = Dictionary(uniqueKeysWithValues: media.map { ($0.id, MediumState(source: $0, data: $0.data)) })
self.media = Dictionary(uniqueKeysWithValues: media.map { ($0.id, MediumState(source: $0, data: $0.data, writeProtected: $0.provenance.writeProtected ?? false)) })
self.mediaOrder = media.map(\.id); self.mountedMediaID = media.first?.id
self.mountedMediaIDs[0] = media.first?.id
}
}
@@ -517,7 +536,7 @@ final class MCPPlaytest {
modules: [[String: Any]] = [], stopAt: UInt16? = nil, stopModule: String? = nil, flatGuards: [[String: Any]] = [], cpu: String = "6809", helperURL: URL? = nil, retentionDirectory: URL? = nil,
diskProvenance: MCPPlaytestDiskStore.Provenance? = nil, resumedDiskID: String? = nil,
graphicsBuffers: [[String: Any]] = [], runID: String = UUID().uuidString,
media: [MCPPlaytestMedium]? = nil,
media: [MCPPlaytestMedium]? = nil, multiDrive: Bool = false,
videoArtifactWillVerify: (@Sendable (URL) throws -> Void)? = nil) async throws -> MCPPlaytest {
guard let reservedID = UUID(uuidString: runID) else { throw failure("invalid_playtest_run_id") }
guard systemROM.count == 32768, diskROM.count == 8192, !disk.isEmpty, disk.count <= 512 * 1024,
@@ -561,12 +580,18 @@ final class MCPPlaytest {
let test = MCPPlaytest(worker: worker, projectID: projectID, revision: revision, artifactID: artifactID,
retentionDirectory: retentionDirectory ?? AppIdentity.supportDirectory.appendingPathComponent("Development Runs/Assistant Playtests"),
diskProvenance: provenance, resumedDiskID: resumedDiskID.map { UUID(uuidString: $0)!.uuidString }, runID: reservedID.uuidString,
processor: cpu == "6309" ? .hd6309 : .mc6809, media: media, videoArtifactWillVerify: videoArtifactWillVerify)
processor: cpu == "6309" ? .hd6309 : .mc6809, media: media, multiDrive: multiDrive, videoArtifactWillVerify: videoArtifactWillVerify)
var setup: [String: Any] = ["op": "init", "system_rom": systemROM.base64EncodedString(),
"disk_rom": diskROM.base64EncodedString(), "disk": disk.base64EncodedString(),
"boot_keys": paste.chords.map { NSNumber(value: $0) }, "modules": modules, "cpu": cpu,
"graphics_buffers": graphicsBuffers, "flat_guards": flatGuards]
if let media { setup["media_id"] = media[0].id }
if let protection = provenance.writeProtected { setup["write_protected"] = protection }
if multiDrive {
guard media != nil else { await test.invalidate().value; throw failure("invalid_playtest_media") }
setup["multi_drive"] = true
setup["write_protected"] = media?.first?.provenance.writeProtected ?? false
}
if let stopAt {
guard (modules.isEmpty && !flatGuards.isEmpty && stopModule == nil) ||
(!modules.isEmpty && flatGuards.isEmpty && stopModule != nil) else {
@@ -665,7 +690,237 @@ final class MCPPlaytest {
}
}
private func driveRow(_ status: [String: Any], drive: Int) throws -> [String: Any] {
guard let rows = status["drives"] as? [[String: Any]], rows.count == 4,
rows.enumerated().allSatisfy({ index, row in
guard let number = row["drive"] as? NSNumber, CFGetTypeID(number) != CFBooleanGetTypeID() else { return false }
return number.doubleValue == Double(index)
}) else { throw Self.failure("invalid_playtest_media_reply") }
return rows[drive]
}
private func multiMediaFields(status: [String: Any]) -> [String: Any] {
var fields = status
let workerRows = status["drives"] as? [[String: Any]] ?? []
fields["media_contract_version"] = 2
fields["drive"] = "FD0" // Existing top-level compatibility field.
fields["drives"] = (0..<4).map { drive -> [String: Any] in
var row = workerRows.count == 4 ? workerRows[drive] : ["drive": drive, "label": "FD\(drive)", "unavailable": true]
if let id = row["media_id"] as? String, let item = media?[id] {
row["base_sha256"] = item.source.baseSHA256
row["media_sha256"] = row["disk_sha256"]
row["media_key"] = item.source.key
row["name"] = item.source.name
row["provenance"] = item.source.provenance.protecting(row["write_protected"] as? Bool ?? item.writeProtected).publicFields
row["modified_from_artifact"] = row["disk_sha256"] as? String != item.source.baseSHA256
let retained = item.retained
row["retained"] = retained?.diskSHA256 == row["disk_sha256"] as? String && retained?.provenance.writeProtected == row["write_protected"] as? Bool
if let retained { row["retained_disk"] = retained.publicFields }
}
return row
}
fields["media"] = mediaOrder.compactMap { id -> [String: Any]? in
guard let item = media?[id] else { return nil }
let mounted = workerRows.first { $0["media_id"] as? String == id && $0["disk_present"] as? Bool == true }
let hash = mounted?["disk_sha256"] as? String ?? CMOCProject.sha256(item.data)
let protection = mounted?["write_protected"] as? Bool ?? item.writeProtected
var row: [String: Any] = ["media_id": id, "name": item.source.name, "media_key": item.source.key,
"base_sha256": item.source.baseSHA256, "media_sha256": hash, "byte_count": item.data.count,
"inserted": mounted != nil, "drive": mounted?["drive"] as Any? ?? NSNull(),
"dirty": mounted?["disk_dirty"] as? Bool ?? item.dirty, "write_protected": protection,
"provenance": item.source.provenance.protecting(protection).publicFields,
"modified_from_artifact": hash != item.source.baseSHA256,
"retained": item.retained?.diskSHA256 == hash && item.retained?.provenance.writeProtected == protection]
if let retained = item.retained { row["retained_disk"] = retained.publicFields }
if let parent = item.source.provenance.parentDiskID { row["resumed_from_disk_id"] = parent }
if status["media_selection_uncertain"] as? Bool == true { row["placement_uncertain"] = true }
return row
}
return fields
}
/// One bounded worker message contains one drive's bytes plus a coherent
/// four-drive metadata observation. Never concatenate four disk payloads.
private func receiveMultiMediaExport(_ status: [String: Any], drive: Int) throws {
let row = try driveRow(status, drive: drive)
guard let exported = status["exported_drive"] as? [String: Any], NSDictionary(dictionary: exported).isEqual(to: row),
let present = row["disk_present"] as? Bool, let hash = row["disk_sha256"] as? String,
let protection = row["write_protected"] as? Bool else { throw Self.failure("invalid_playtest_media_reply") }
let id = row["media_id"] as? String
let pendingMatches = mediaCommitPending && pendingMediaDrive == drive && id == pendingMediaSelection
guard id == mountedMediaIDs[drive] || pendingMatches else { throw Self.failure("invalid_playtest_media_reply") }
if !present {
guard id == nil, hash.isEmpty, status["disk_base64"] == nil,
(row["byte_count"] as? NSNumber)?.intValue == 0 else { throw Self.failure("invalid_playtest_media_reply") }
mountedMediaIDs[drive] = nil
} else {
guard let id, var item = media?[id], let encoded = status["disk_base64"] as? String,
let bytes = Data(base64Encoded: encoded), !bytes.isEmpty, bytes.count <= 512 * 1024,
bytes.count == (row["byte_count"] as? NSNumber)?.intValue,
CMOCProject.sha256(bytes) == hash else { throw Self.failure("invalid_playtest_media_reply") }
if item.data != bytes || item.writeProtected != protection { item.pendingRecordID = nil }
item.data = bytes; item.dirty = row["disk_dirty"] as? Bool ?? false; item.writeProtected = protection
media?[id] = item; mountedMediaIDs[drive] = id
}
mountedMediaID = mountedMediaIDs[0]
}
private func exchangeMultiMedia(_ selected: String?, expectedSHA: String?, drive: Int,
writeProtected: Bool?, isCurrent: (() -> Bool)?) async throws -> [String: Any] {
guard valid, isCurrent?() != false else { throw Self.failure("stale_run") }
if let selected {
guard media?[selected] != nil else { throw Self.failure("invalid_playtest_media_selection") }
guard !mountedMediaIDs.enumerated().contains(where: { $0.offset != drive && $0.element == selected }) else {
throw Self.failure("playtest_media_already_inserted")
}
}
var frozen: [Int: [String: Any]] = [:]
for index in 0..<4 {
let snapshot = try await worker.request(["op": "export_media", "drive": index])
try receiveMultiMediaExport(snapshot, drive: index)
if let first = frozen[0] {
for key in ["field_clock", "cycles", "generation", "boot", "pc"] {
guard let a = first[key] as? NSNumber, let b = snapshot[key] as? NSNumber, a == b else {
throw WorkerTransportFailure(reason: "playtest_media_advanced_guest")
}
}
}
frozen[index] = snapshot
}
guard let before = frozen[drive] else { throw Self.failure("invalid_playtest_media_reply") }
let oldRow = try driveRow(before, drive: drive), expectedOldID = mountedMediaIDs[drive]
guard valid, isCurrent?() != false, let generation = oldRow["media_generation"] as? NSNumber,
let oldHash = oldRow["disk_sha256"] as? String else { throw Self.failure("stale_playtest_media") }
if let selected, let item = media?[selected], expectedSHA != CMOCProject.sha256(item.data) {
throw Self.failure("playtest_media_hash_mismatch")
}
var old: [String: Any] = ["media_id": expectedOldID as Any? ?? NSNull(), "media_sha256": oldHash,
"drive": drive, "dirty": oldRow["disk_dirty"] as? Bool ?? false, "retained": false,
"write_protected": oldRow["write_protected"] as? Bool ?? false]
if let expectedOldID {
let retained = try await retainMedium(expectedOldID)
old["retained"] = true; old["retained_disk"] = retained.publicFields
}
guard valid, isCurrent?() != false, mountedMediaIDs[drive] == expectedOldID else { throw Self.failure("stale_run") }
var request: [String: Any] = ["op": "exchange_media", "drive": drive,
"expected_media_generation": generation, "expected_disk_sha256": oldHash]
if let selected, let item = media?[selected] {
request["media_id"] = selected; request["disk_base64"] = item.data.base64EncodedString()
request["write_protected"] = writeProtected ?? item.writeProtected
}
lastSafeMediaExports = frozen
mediaCommitPending = true; pendingMediaDrive = drive; pendingMediaSelection = selected
let after: [String: Any]
do { after = try await worker.request(request) }
catch let error as WorkerRejection { mediaCommitPending = false; pendingMediaDrive = nil; pendingMediaSelection = nil; throw error }
// Acknowledged commit is authoritative even if the grant expires now.
mountedMediaIDs[drive] = selected; mountedMediaID = mountedMediaIDs[0]
mediaCommitPending = false; pendingMediaDrive = nil; pendingMediaSelection = nil
let next = try driveRow(after, drive: drive)
let selectedSHA = selected.flatMap { media?[$0] }.map { CMOCProject.sha256($0.data) } ?? ""
guard next["disk_sha256"] as? String == selectedSHA, next["media_id"] as? String == selected,
next["disk_present"] as? Bool == (selected != nil),
(next["media_generation"] as? NSNumber)?.intValue == generation.intValue + 1,
after["previous_disk_sha256"] as? String == oldHash else { throw WorkerTransportFailure(reason: "invalid_playtest_media_reply") }
if let selected, var item = media?[selected], let effective = next["write_protected"] as? Bool {
if effective != item.writeProtected { item.pendingRecordID = nil }
item.writeProtected = effective; media?[selected] = item
}
for index in 0..<4 where index != drive {
guard NSDictionary(dictionary: try driveRow(before, drive: index)).isEqual(to: try driveRow(after, drive: index)) else {
throw WorkerTransportFailure(reason: "playtest_unrelated_drive_changed")
}
}
for key in ["field_clock", "cycles", "generation", "boot", "pc"] {
guard let a = before[key] as? NSNumber, let b = after[key] as? NSNumber, a == b else { throw WorkerTransportFailure(reason: "playtest_media_advanced_guest") }
}
var result = mediaFields(status: after)
result["target_drive"] = drive; result["previous_media"] = old
result["exchange"] = selected == nil ? "ejected" : "inserted"
result["guest_advanced"] = false; result["guest_reset"] = false
return result
}
private func performMultiMediaPersistence() async throws -> [String: Any] {
if let pending = mediaExchangeTask { _ = await pending.result }
if finished, let finalReceipt { return finalReceipt }
if !mediaFreezeAcknowledged {
do {
var result = try await worker.request(["op": "stop"])
guard result["media_frozen"] as? Bool == true else { throw Self.failure("invalid_playtest_media_reply") }
_ = try driveRow(result, drive: 0)
mediaFreezeAcknowledged = true; exportedStatus = result
guard let primary = mediaOrder.first, let bytes = media?[primary]?.data else { throw Self.failure("invalid_playtest_media") }
exportedDisk = bytes // Retry marker, not a claim that all drives were drained.
do { try await retainVideoMetadata(result) }
catch { result["video_retention_error"] = "The video artifact could not be verified; disk retention continues."; exportedStatus = result }
} catch let error as WorkerTransportFailure {
// Only a fully observed paused four-drive export can recover a
// lost exchange reply. It is never substituted after execution.
guard lastSafeMediaExports.count == 4, let before = lastSafeMediaExports[0] else { throw error }
var result = before
result.removeValue(forKey: "disk_base64"); result.removeValue(forKey: "exported_drive")
result["media_selection_uncertain"] = true
result["uncertain_drives"] = pendingMediaDrive.map { [$0] } ?? Array(0..<4)
if var rows = result["drives"] as? [[String: Any]] {
for index in (pendingMediaDrive.map { [$0] } ?? Array(0..<4)) {
rows[index]["media_id"] = NSNull(); rows[index]["disk_present"] = NSNull()
rows[index]["inserted"] = NSNull(); rows[index]["selection_uncertain"] = true
rows[index]["disk_sha256"] = NSNull(); rows[index]["media_generation"] = NSNull()
mountedMediaIDs[index] = nil
}
result["drives"] = rows
if pendingMediaDrive == nil || pendingMediaDrive == 0 {
result["media_id"] = NSNull(); result["disk_present"] = NSNull(); result["disk_sha256"] = NSNull()
}
}
mountedMediaID = mountedMediaIDs[0]
exportedStatus = result; mediaFreezeAcknowledged = true; mediaStopDrained = true
frozenDriveExports = Set(0..<4)
exportedDisk = mediaOrder.first.flatMap { media?[$0]?.data }
}
}
do {
for drive in 0..<4 where !frozenDriveExports.contains(drive) {
let result = try await worker.request(["op": "export_media", "drive": drive])
try receiveMultiMediaExport(result, drive: drive)
// Each reply must match the STOP observation, with no execution
// or selection change while bounded exports are drained.
guard let frozen = exportedStatus,
NSDictionary(dictionary: try driveRow(frozen, drive: drive)).isEqual(to: try driveRow(result, drive: drive)) else {
throw Self.failure("playtest_frozen_media_changed")
}
frozenDriveExports.insert(drive)
}
if !mediaStopDrained {
do { _ = try await worker.request(["op": "finish_stop"]) }
catch is WorkerTransportFailure { /* Every mounted disk was already drained and verified. */ }
mediaStopDrained = true
}
var retained: [[String: Any]] = []
for id in mediaOrder {
let record = try await retainMedium(id)
var fields = record.publicFields; fields["media_id"] = id; fields["name"] = media?[id]?.source.name
retained.append(fields)
}
guard let primary = mediaOrder.first, let record = media?[primary]?.retained else { throw Self.failure("playtest_disk_export_failed") }
retainedDiskRecord = record; retainedDiskURL = try MCPPlaytestDiskStore.diskURL(directory: retentionDirectory, id: record.id)
var result = mediaFields(status: exportedStatus ?? [:])
result["disk_retained"] = true; result["retained_disk_id"] = record.id
result["retained_disk_sha256"] = record.diskSHA256; result["retained_disk"] = record.publicFields
result["retained_media"] = retained; result["status"] = "stopped"
finished = true; retentionError = nil; worker.close()
let receipt = scoped(result); finalReceipt = receipt
exportedDisk = nil; exportedStatus = nil; Self.pendingRetentions.removeValue(forKey: runID)
return receipt
} catch {
retentionError = error.localizedDescription; Self.pendingRetentions[runID] = self
throw error
}
}
private func mediaFields(status: [String: Any]) -> [String: Any] {
if multiDrive { return multiMediaFields(status: status) }
var fields = status
let actualID = status["media_id"] == nil ? mountedMediaID : status["media_id"] as? String
let present = status["disk_present"] as? Bool ?? (mountedMediaID != nil)
@@ -689,6 +944,7 @@ final class MCPPlaytest {
/// Only called with a bounded, complete export from the app-owned helper.
/// Keep these bytes even if the lease was revoked while the pipe was read.
private func receiveMediaExport(_ status: [String: Any]) throws {
if multiDrive { try receiveMultiMediaExport(status, drive: 0); return }
guard media != nil, let present = status["disk_present"] as? Bool else { throw Self.failure("invalid_playtest_media_reply") }
if !present {
guard (mountedMediaID == nil || (mediaCommitPending && pendingMediaSelection == nil)),
@@ -713,11 +969,22 @@ final class MCPPlaytest {
private func retainMedium(_ id: String) async throws -> MCPPlaytestDiskStore.Record {
guard var item = media?[id] else { throw Self.failure("invalid_playtest_media_selection") }
let hash = CMOCProject.sha256(item.data)
if let existing = item.retained, existing.diskSHA256 == hash { return existing }
if let existing = item.retained, existing.diskSHA256 == hash,
!multiDrive || existing.provenance.writeProtected == item.writeProtected {
guard let projectKey = existing.provenance.projectKey,
let artifactHash = existing.provenance.artifactDiskSHA256 else { throw Self.failure("invalid_playtest_disk_provenance") }
let loaded = try await MCPPlaytestDiskStore.load(directory: retentionDirectory, id: existing.id,
expectedSHA256: hash, projectKey: projectKey, artifactDiskSHA256: artifactHash,
mediaKey: existing.provenance.mediaKey ?? "primary", mediaBaseSHA256: existing.provenance.mediaBaseSHA256)
guard loaded.record.id == existing.id, loaded.record.runID == existing.runID,
loaded.record.provenance == existing.provenance, loaded.record.diskSHA256 == existing.diskSHA256,
loaded.record.byteCount == existing.byteCount, loaded.data == item.data else { throw Self.failure("retained_disk_changed") }
return existing
}
let recordID = item.pendingRecordID ?? UUID().uuidString
item.pendingRecordID = recordID; media?[id] = item
let stored = try await MCPPlaytestDiskStore.save(directory: retentionDirectory, runID: runID,
data: item.data, provenance: item.source.provenance, recordID: recordID)
data: item.data, provenance: multiDrive ? item.source.provenance.protecting(item.writeProtected) : item.source.provenance, recordID: recordID)
// The paused worker and serialized owner cannot change this medium
// during the off-main-thread durable write.
guard var current = media?[id], current.data == item.data else { throw Self.failure("playtest_media_changed") }
@@ -725,7 +992,9 @@ final class MCPPlaytest {
return stored
}
private func exchangeMedia(_ selected: String?, expectedSHA: String?, isCurrent: (() -> Bool)?) async throws -> [String: Any] {
private func exchangeMedia(_ selected: String?, expectedSHA: String?, isCurrent: (() -> Bool)?,
drive: Int = 0, writeProtected: Bool? = nil) async throws -> [String: Any] {
if multiDrive { return try await exchangeMultiMedia(selected, expectedSHA: expectedSHA, drive: drive, writeProtected: writeProtected, isCurrent: isCurrent) }
guard valid, isCurrent?() != false else { throw Self.failure("stale_run") }
let before = try await worker.request(["op": "export_media"])
let expectedOldID = mountedMediaID
@@ -751,6 +1020,7 @@ final class MCPPlaytest {
"expected_disk_sha256": oldHash]
if let selected, let item = media?[selected] {
request["media_id"] = selected; request["disk_base64"] = item.data.base64EncodedString()
if let protection = item.source.provenance.writeProtected { request["write_protected"] = protection }
}
lastSafeMediaExport = before
mediaCommitPending = true; pendingMediaSelection = selected
@@ -781,6 +1051,7 @@ final class MCPPlaytest {
}
private func performMediaPersistence() async throws -> [String: Any] {
if multiDrive { return try await performMultiMediaPersistence() }
if let pending = mediaExchangeTask { _ = await pending.result }
if finished, let finalReceipt { return finalReceipt }
if exportedDisk == nil {
@@ -835,6 +1106,8 @@ final class MCPPlaytest {
/// The host rechecks project/revision/artifact identity before dispatching.
/// Cached write receipts are still bound to this live lease, never replayed.
func reply(_ tool: String, arguments: [String: Any], isCurrent: (() -> Bool)? = nil) async throws -> [String: Any] {
var arguments = arguments
if tool == "exchange_playtest_media", multiDrive, arguments["drive"] == nil { arguments["drive"] = 0 }
guard valid, arguments["run_id"] as? String == runID else { throw Self.failure("stale_run") }
guard !busy else { throw Self.failure("playtest_busy") }
busy = true
@@ -903,10 +1176,22 @@ final class MCPPlaytest {
}
if tool == "exchange_playtest_media" {
guard media != nil, let action = arguments["action"] as? String,
["insert", "eject"].contains(action),
Set(arguments.keys) == (action == "insert" ? ["run_id", "request_id", "action", "media_id", "media_sha256"] : ["run_id", "request_id", "action"]) else {
throw Self.failure("invalid_arguments")
}
["insert", "eject"].contains(action) else { throw Self.failure("invalid_arguments") }
var required: Set<String> = action == "insert" ? ["run_id", "request_id", "action", "media_id", "media_sha256"] : ["run_id", "request_id", "action"]
if multiDrive { required.insert("drive") }
let optional: Set<String> = multiDrive && action == "insert" ? ["write_protected"] : []
guard required.isSubset(of: Set(arguments.keys)), Set(arguments.keys).isSubset(of: required.union(optional)) else { throw Self.failure("invalid_arguments") }
let drive: Int
if multiDrive {
guard let value = arguments["drive"] as? NSNumber, CFGetTypeID(value) != CFBooleanGetTypeID(),
value.doubleValue.isFinite, value.doubleValue == Double(value.intValue), (0...3).contains(value.intValue) else { throw Self.failure("invalid_arguments") }
drive = value.intValue
} else { drive = 0 }
let protection: Bool?
if let value = arguments["write_protected"] {
guard let number = value as? NSNumber, CFGetTypeID(number) == CFBooleanGetTypeID() else { throw Self.failure("invalid_arguments") }
protection = number.boolValue
} else { protection = nil }
let selected: String?
if action == "insert" {
guard let id = arguments["media_id"] as? String, media?[id] != nil,
@@ -918,7 +1203,7 @@ final class MCPPlaytest {
} else { selected = nil }
mutationRequestsAccepted += 1
accepted[requestID] = (signature, scoped(["request_id": requestID, "status": "interrupted"]))
let exchange = Task { try await self.exchangeMedia(selected, expectedSHA: arguments["media_sha256"] as? String, isCurrent: isCurrent) }
let exchange = Task { try await self.exchangeMedia(selected, expectedSHA: arguments["media_sha256"] as? String, isCurrent: isCurrent, drive: drive, writeProtected: protection) }
mediaExchangeTask = exchange
defer { mediaExchangeTask = nil }
var result: [String: Any]
@@ -1045,7 +1330,7 @@ final class MCPPlaytest {
}
}
do {
lastSafeMediaExport = nil
lastSafeMediaExport = nil; lastSafeMediaExports.removeAll()
var result = try await worker.request(request)
guard valid else { throw Self.failure("stale_run") }
try await retainVideoMetadata(result)
@@ -1089,7 +1374,7 @@ final class MCPPlaytest {
guard !busy else { throw Self.failure("playtest_busy") }
busy = true
defer { busy = false }
if let operation = request["op"] as? String, ["continue", "step", "stop_at"].contains(operation) { lastSafeMediaExport = nil }
if let operation = request["op"] as? String, ["continue", "step", "stop_at"].contains(operation) { lastSafeMediaExport = nil; lastSafeMediaExports.removeAll() }
let result = try await worker.request(request)
guard valid else { throw Self.failure("stale_run") }
try await retainVideoMetadata(result)
@@ -1097,7 +1382,7 @@ final class MCPPlaytest {
}
private func scoped(_ result: [String: Any]) -> [String: Any] {
var result = result
var result = multiDrive && media != nil ? mediaFields(status: result) : result
result["run_id"] = runID; result["project_id"] = projectID
result["revision"] = revision; result["artifact_id"] = artifactID
result["requested_processor"] = processor.rawValue
@@ -1122,7 +1407,8 @@ final class MCPPlaytest {
result["boot_disk_provenance"] = diskProvenance.publicFields
if let id = mountedMediaID, let current = media?[id] {
result["disk_origin"] = current.source.provenance.origin
result["disk_provenance"] = current.source.provenance.publicFields
let currentProtection = (result["drives"] as? [[String: Any]])?.first?["write_protected"] as? Bool ?? current.writeProtected
result["disk_provenance"] = multiDrive ? current.source.provenance.protecting(currentProtection).publicFields : current.source.provenance.publicFields
} else {
result["disk_origin"] = NSNull(); result["disk_provenance"] = NSNull()
}
+33 -10
View File
@@ -1227,7 +1227,8 @@ final class MachineModel: ObservableObject {
}
func loadBASICSource(_ source: String, run: Bool, breakpoints: Set<Int> = [],
review: (expected: VCCMachineSnapshot, existing: String)? = nil) async -> VCCMachineSnapshot? {
review: (expected: VCCMachineSnapshot, existing: String)? = nil,
reviewIsCurrent: (() -> Bool)? = nil) async -> VCCMachineSnapshot? {
guard !busy, !diskSaving, state != .closed else {
fileError = "The machine is busy. Try the BASIC transfer again when it is ready."
return nil
@@ -1235,17 +1236,39 @@ final class MachineModel: ObservableObject {
busy = true; inputEpoch += 1; fileError = nil
defer { busy = false }
let points = breakpoints.sorted().map { NSNumber(value: $0) }
let result = await diskStep { completion in
if let review {
controller.assistantLoad(source: source, breakpoints: points, expected: review.expected, existing: review.existing, completion: completion)
} else {
controller.basicLoadSource(source, run: run, breakpoints: points, completion: completion)
let retryDeadline = ContinuousClock.now.advanced(by: .seconds(2))
while true {
if review != nil {
guard reviewIsCurrent?() != false, !Task.isCancelled else {
fileError = Task.isCancelled ? "The BASIC transfer was cancelled." : "The approved revision or connection changed."
return nil
}
}
let result = await diskStep { completion in
if let review {
controller.assistantLoad(source: source, breakpoints: points, expected: review.expected, existing: review.existing, completion: completion)
} else {
controller.basicLoadSource(source, run: run, breakpoints: points, completion: completion)
}
}
if let error = result.errorMessage {
// A running ROM can leave its input loop between readiness and
// loading. This exact core refusal precedes every mutation;
// each retry rechecks the same reviewed machine/source/media.
guard review != nil, reviewIsCurrent != nil,
error == "Wait at the BASIC OK prompt before loading or running from the editor; use BREAK to stop the current program first",
ContinuousClock.now.advanced(by: .milliseconds(45)) < retryDeadline else {
fileError = error; return nil
}
do { try await Task.sleep(for: .milliseconds(45)) }
catch { fileError = "The BASIC transfer was cancelled."; return nil }
guard ContinuousClock.now < retryDeadline else { fileError = error; return nil }
continue // Approval and cancellation are rechecked after the wait.
}
binaryName = nil
if run { focusRequest += 1 }
return result
}
if let error = result.errorMessage { fileError = error; return nil }
binaryName = nil
if run { focusRequest += 1 }
return result
}
func configureBASICBreakpoints(_ lines: Set<Int>, source: String) async -> Bool {
guard !busy, !diskSaving, state != .closed else { return false }
@@ -16,8 +16,8 @@ final class AssemblyBuildServiceTests: XCTestCase {
override func setUpWithError() throws {
root = FileManager.default.temporaryDirectory.appendingPathComponent("Assembly tests " + UUID().uuidString)
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
runtime = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
.appendingPathComponent("LocalResources/ToolchainBundle")
runtime = vccQualificationToolchain(URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
.appendingPathComponent("LocalResources/ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: runtime.appendingPathComponent("bin/lwasm").path),
"Stage the bundled LWTools runtime for assembly workflow tests.")
}
+123 -3
View File
@@ -1,9 +1,15 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import XCTest
import AppKit
/// The interpreter is the tokenizer oracle. Optional private ROMs never enter Git.
@MainActor
final class BASICBridgeTests: XCTestCase {
override func setUp() async throws {
try await super.setUp()
await MainActor.run { _ = NSApplication.shared }
}
private func command(_ body: (@escaping @Sendable (VCCMachineSnapshot) -> Void) -> Void) async -> VCCMachineSnapshot {
await withCheckedContinuation { continuation in body { continuation.resume(returning: $0) } }
}
@@ -184,7 +190,121 @@ final class BASICBridgeTests: XCTestCase {
}
}
func testReviewedBASICLoadRetriesOnlyPromptRefusalAndPreservesReviewAuthority() async throws {
_ = NSApplication.shared
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let roms = mac.appendingPathComponent("LocalResources/ROMs")
for file in ["coco3.rom", "disk11.rom"] {
try XCTSkipUnless(FileManager.default.fileExists(atPath: roms.appendingPathComponent(file).path), "Stage private BASIC ROMs")
}
let suite = "ReviewedBASICRetry-" + UUID().uuidString
let root = FileManager.default.temporaryDirectory.appendingPathComponent(suite)
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
let defaults = try XCTUnwrap(UserDefaults(suiteName: suite))
defer { defaults.removePersistentDomain(forName: suite); try? FileManager.default.removeItem(at: root) }
let controller = VCCMachineController()
let machine = MachineModel(diskStore: .init(url: root.appendingPathComponent("drives.json")), controller: controller,
displayDefaults: defaults, inputStore: .init(url: root.appendingPathComponent("input.json")))
do {
for _ in 0..<300 where machine.busy { try await Task.sleep(for: .milliseconds(20)) }
for use6309 in [false, true] {
try await MCPBASICRun.bootFixture(machine, romDirectory: roms, use6309: use6309)
let emptySource = await machine.readBASICSource()
let existing = try XCTUnwrap(emptySource)
let initial = await machine.mcpMachineSnapshot()
// Held Shift deterministically causes the exact read-only core
// refusal. Release only when approval is checked after that
// refused attempt and its retry wait, never before dispatch.
controller.setKeyboardMask(CocoKeyboard.shift)
var approvalChecks = 0
let loaded = await machine.loadBASICSource("10 GOTO 10\n", run: true,
review: (initial, existing), reviewIsCurrent: {
approvalChecks += 1
if approvalChecks == 2 { controller.setKeyboardMask(0) }
return true
})
XCTAssertGreaterThanOrEqual(approvalChecks, 2)
let started = try XCTUnwrap(loaded, machine.fileError ?? "Reviewed retry failed")
XCTAssertEqual(started.generation, initial.generation)
XCTAssertEqual(started.debuggerProgramRevision, initial.debuggerProgramRevision + 1,
"Only the successful queue transaction may install the program")
try await settle(controller)
let source = await machine.readBASICSource()
let runningSource = try XCTUnwrap(source)
let expected = await machine.mcpMachineSnapshot()
let original = try await programBytes(controller)
let replacement = "10 PRINT 99\n"
var staleChecks = 0
let stale = await machine.loadBASICSource(replacement, run: true, review: (initial, runningSource),
reviewIsCurrent: { staleChecks += 1; return true })
XCTAssertNil(stale); XCTAssertEqual(staleChecks, 1)
XCTAssertEqual(machine.fileError, "The CoCo or its loaded program changed. Start a new reviewed run.")
var sourceChecks = 0
let changedSource = await machine.loadBASICSource(replacement, run: true,
review: (expected, runningSource + "20 REM NOT REVIEWED\n"),
reviewIsCurrent: { sourceChecks += 1; return true })
XCTAssertNil(changedSource); XCTAssertEqual(sourceChecks, 1)
XCTAssertEqual(machine.fileError, "The program in BASIC memory changed. Review it before continuing.")
var revokedChecks = 0
let revoked = await machine.loadBASICSource(replacement, run: true, review: (expected, runningSource),
reviewIsCurrent: { revokedChecks += 1; return revokedChecks == 1 })
XCTAssertNil(revoked); XCTAssertEqual(revokedChecks, 2)
XCTAssertEqual(machine.fileError, "The approved revision or connection changed.")
var cancelledChecks = 0
let cancelled = Task { @MainActor in
await machine.loadBASICSource(replacement, run: true, review: (expected, runningSource),
reviewIsCurrent: {
cancelledChecks += 1
if cancelledChecks == 2 { withUnsafeCurrentTask { $0?.cancel() } }
return true
})
}
let cancelledResult = await cancelled.value
XCTAssertNil(cancelledResult); XCTAssertEqual(cancelledChecks, 2)
XCTAssertEqual(machine.fileError, "The BASIC transfer was cancelled.")
var boundedChecks = 0
let clock = ContinuousClock()
let began = clock.now
let bounded = await machine.loadBASICSource(replacement, run: true, review: (expected, runningSource),
reviewIsCurrent: { boundedChecks += 1; return true })
XCTAssertNil(bounded); XCTAssertGreaterThan(boundedChecks, 2)
XCTAssertLessThan(clock.now - began, .seconds(3), "An executing program must not cause unbounded retry")
XCTAssertEqual(machine.fileError, "Wait at the BASIC OK prompt before loading or running from the editor; use BREAK to stop the current program first")
controller.setKeyboardMask(CocoKeyboard.shift)
let legacyBegan = clock.now
let legacy = await machine.loadBASICSource(replacement, run: true, review: (expected, runningSource))
controller.setKeyboardMask(0)
XCTAssertNil(legacy)
XCTAssertLessThan(clock.now - legacyBegan, .seconds(1), "A review tuple without live approval must remain a single attempt")
XCTAssertEqual(machine.fileError, "Wait at the BASIC OK prompt before loading or running from the editor; use BREAK to stop the current program first")
var ordinaryChecks = 0
let ordinary = await machine.loadBASICSource(replacement, run: true,
reviewIsCurrent: { ordinaryChecks += 1; return true })
XCTAssertNil(ordinary); XCTAssertEqual(ordinaryChecks, 0, "Ordinary loading remains a single unreviewed operation")
let after = await machine.mcpMachineSnapshot()
XCTAssertEqual(after.generation, expected.generation)
XCTAssertEqual(after.debuggerProgramRevision, expected.debuggerProgramRevision)
let preserved = try await programBytes(controller)
XCTAssertEqual(preserved, original)
XCTAssertEqual(after.disks.first?.name, expected.disks.first?.name)
XCTAssertEqual(after.disks.first?.mounted, expected.disks.first?.mounted)
}
} catch {
await withCheckedContinuation { done in machine.shutdown { done.resume() } }
throw error
}
await withCheckedContinuation { done in machine.shutdown { done.resume() } }
}
func testReviewedBASICRunChecksRealMenuColorsPromptAndStaleSource() async throws {
_ = NSApplication.shared // This fixture also runs alone in Apple's hostless XCTest runner.
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let roms = mac.appendingPathComponent("LocalResources/ROMs")
for file in ["coco3.rom", "disk11.rom"] {
@@ -310,7 +430,7 @@ final class BASICBridgeTests: XCTestCase {
func testPlanetEditorStartersAcceptKeyboardAndReturnToBASIC() async throws {
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let tools = mac.appendingPathComponent("LocalResources/ToolchainBundle")
let tools = vccQualificationToolchain(mac.appendingPathComponent("LocalResources/ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: tools.appendingPathComponent("bin/lwasm").path))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: tools.appendingPathComponent("bin/cmoc").path))
let root = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
@@ -377,7 +497,7 @@ final class BASICBridgeTests: XCTestCase {
func testExportedBootDisksRunByDOSAndByTheirManualCommands() async throws {
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let tools = mac.appendingPathComponent("LocalResources/ToolchainBundle")
let tools = vccQualificationToolchain(mac.appendingPathComponent("LocalResources/ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: tools.appendingPathComponent("bin/cmoc").path))
let service = AssemblyBuildService(toolchain: tools)
let root = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
@@ -440,7 +560,7 @@ final class BASICBridgeTests: XCTestCase {
func testAssembledProgramRunsInAllBASICPresetsAndFromDiskBASICExport() async throws {
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let tools = mac.appendingPathComponent("LocalResources/ToolchainBundle")
let tools = vccQualificationToolchain(mac.appendingPathComponent("LocalResources/ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: tools.appendingPathComponent("bin/lwasm").path),
"Stage the local universal toolchain")
let service = AssemblyBuildService(toolchain: tools)
@@ -3,6 +3,17 @@ import XCTest
import AppKit
import SwiftUI
/// Explicit test-only input keeps compiler qualification away from normal app staging.
/// Xcode forwards TEST_RUNNER_VCC_TEST_TOOLCHAIN_DIR to this environment variable.
func vccQualificationToolchain(_ fallback: URL) -> URL {
guard let path = ProcessInfo.processInfo.environment["VCC_TEST_TOOLCHAIN_DIR"] else { return fallback }
XCTAssertTrue(path.hasPrefix("/"), "Compiler qualification requires an absolute runtime path")
let candidate = URL(fileURLWithPath: path, isDirectory: true)
XCTAssertTrue(FileManager.default.isExecutableFile(atPath: candidate.appendingPathComponent("bin/cmoc").path),
"Explicit compiler qualification input is unavailable; do not silently use another runtime")
return candidate
}
final class CMOCBuildServiceTests: XCTestCase {
private var folder: URL!
override func setUpWithError() throws {
@@ -146,8 +157,8 @@ final class CMOCBuildServiceTests: XCTestCase {
}
func testAssistantBuildsOrdinarySourcesWithOnlyItsOwnRecipe() async throws {
let runtime = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
.appendingPathComponent("LocalResources/ToolchainBundle")
let runtime = vccQualificationToolchain(URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
.appendingPathComponent("LocalResources/ToolchainBundle"))
guard FileManager.default.isExecutableFile(atPath: runtime.appendingPathComponent("bin/cmoc").path) else {
throw XCTSkip("Stage the bundled CMOC tools")
}
@@ -609,7 +620,7 @@ final class CMOCBuildServiceTests: XCTestCase {
}
func testRealBundledToolsExposeCompilerAssemblerLinkerAndMakeFailures() async throws {
let runtime = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources/ToolchainBundle")
let runtime = vccQualificationToolchain(URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources/ToolchainBundle"))
try XCTSkipUnless(CMOCBuildService.requiredExecutables.allSatisfy {
FileManager.default.isExecutableFile(atPath: runtime.appendingPathComponent("bin/" + $0).path)
}, "Stage the bundled CMOC/LWTools/Make runtime")
@@ -1205,7 +1216,7 @@ final class CMOCBuildServiceTests: XCTestCase {
func testBundledLibrariesBuildUnmodifiedCoCoLettersMakefile() async throws {
let repo = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()
let runtime = repo.appendingPathComponent("platforms/macos/LocalResources/ToolchainBundle")
let runtime = vccQualificationToolchain(repo.appendingPathComponent("platforms/macos/LocalResources/ToolchainBundle"))
try XCTSkipUnless(FileManager.default.fileExists(atPath: runtime.appendingPathComponent("share/cmoc/lib/libdskcon-standalone.a").path), "Stage the optional standalone disk library")
let root = folder.appendingPathComponent("CoCo Letters")
try FileManager.default.copyItem(at: repo.appendingPathComponent("third_party/examples/coco-letters"), to: root)
@@ -1418,7 +1429,7 @@ final class CMOCBuildServiceTests: XCTestCase {
XCTAssertEqual(artifact.sources["main.c"], Data(CMOCProject.starterSource.utf8))
}
func testGeneratedMakefileBuildsMultipleCFilesDependenciesResourcesAndDiskWithBundledTools() async throws {
let runtime = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources/ToolchainBundle")
let runtime = vccQualificationToolchain(URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources/ToolchainBundle"))
guard FileManager.default.isExecutableFile(atPath: runtime.appendingPathComponent("bin/perl").path) else { throw XCTSkip("Stage the complete bundled compiler and Perl runtime") }
var generated = CMOCMakefileSettings()
generated.sources = ["main.c", "src/game.c", "generated/data.c"]
@@ -18,7 +18,7 @@ final class CMOCCallStackIntegrationTests: XCTestCase {
}
private func fixture(optimized: Bool = false) async throws -> Fixture {
let resources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources")
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let rom = resources.appendingPathComponent("ROMs/coco3.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path)
&& FileManager.default.fileExists(atPath: rom.path), "Local licensed CoCo ROM and staged toolchain are required")
@@ -131,7 +131,7 @@ final class CMOCDevelopmentTests: XCTestCase {
}
@MainActor func testCompiledEditedProgramStopsAtVerifiedCLineOnBothCPUs() async throws {
let resources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources")
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let romURL = resources.appendingPathComponent("ROMs/coco3.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path)
&& FileManager.default.fileExists(atPath: romURL.path), "Local licensed CoCo ROM and staged toolchain are required")
@@ -178,7 +178,7 @@ final class CMOCDevelopmentTests: XCTestCase {
@MainActor private func checkDiskAPIRoundTrip(standalone: Bool) async throws {
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let resources = mac.appendingPathComponent("LocalResources")
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let romURL = resources.appendingPathComponent("ROMs/coco3.rom")
let diskROMURL = resources.appendingPathComponent("ROMs/disk11.rom")
try XCTSkipUnless(FileManager.default.fileExists(atPath: toolchain.appendingPathComponent("share/cmoc/lib/libdecbfile.a").path)
@@ -321,9 +321,9 @@ final class CMOCDevelopmentTests: XCTestCase {
}
@MainActor func testCallerSelectionPreservesExecutionAndResetsOnStepOrStaleSource() async throws {
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let staged = mac.appendingPathComponent("LocalResources/ToolchainBundle")
let staged = vccQualificationToolchain(mac.appendingPathComponent("LocalResources/ToolchainBundle"))
let bundled = Bundle.main.resourceURL!.appendingPathComponent("Toolchain")
let toolchain = FileManager.default.isExecutableFile(atPath: bundled.appendingPathComponent("bin/cmoc").path) ? bundled : staged
let toolchain = vccQualificationToolchain(FileManager.default.isExecutableFile(atPath: bundled.appendingPathComponent("bin/cmoc").path) ? bundled : staged)
let romURL = mac.appendingPathComponent("LocalResources/ROMs/coco3.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path)
&& FileManager.default.fileExists(atPath: romURL.path), "Stage the local compiler and CoCo ROM")
@@ -488,7 +488,7 @@ final class CMOCDevelopmentTests: XCTestCase {
@MainActor func testDefaultHelloDiskLaunchRunsWithoutImplicitBreakpointAndHonorsExplicitStops() async throws {
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let resources = mac.appendingPathComponent("LocalResources")
let tools = resources.appendingPathComponent("ToolchainBundle")
let tools = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let rom = resources.appendingPathComponent("ROMs/coco3.rom"), diskROM = resources.appendingPathComponent("ROMs/disk11.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: tools.appendingPathComponent("bin/cmoc").path) &&
FileManager.default.fileExists(atPath: rom.path) && FileManager.default.fileExists(atPath: diskROM.path), "Stage local tools and ROMs")
@@ -599,9 +599,9 @@ final class CMOCDevelopmentTests: XCTestCase {
@MainActor func testRealBuildMappingBecomesStaleWhenEditorChanges() async throws {
let bundled = Bundle.main.resourceURL!.appendingPathComponent("Toolchain")
let staged = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
.appendingPathComponent("LocalResources/ToolchainBundle")
let toolchain = FileManager.default.isExecutableFile(atPath: bundled.appendingPathComponent("bin/cmoc").path) ? bundled : staged
let staged = vccQualificationToolchain(URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
.appendingPathComponent("LocalResources/ToolchainBundle"))
let toolchain = vccQualificationToolchain(FileManager.default.isExecutableFile(atPath: bundled.appendingPathComponent("bin/cmoc").path) ? bundled : staged)
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path),
"This integration check requires the bundled development toolchain")
let folder = FileManager.default.temporaryDirectory.appendingPathComponent("CMOCDevelopmentTests-\(UUID().uuidString)")
@@ -18,7 +18,7 @@ final class CMOCFloatingPointIntegrationTests: XCTestCase {
}
private func fixture() async throws -> Fixture {
let resources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources")
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let rom = resources.appendingPathComponent("ROMs/coco3.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path)
&& FileManager.default.fileExists(atPath: rom.path), "Local licensed CoCo ROM and staged toolchain are required")
@@ -191,7 +191,7 @@ final class CMOCNavigationTests: XCTestCase {
}
@MainActor func testReferenceNavigationKeepsSuccessfulBuildIdentity() async throws {
let resources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources")
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path), "Staged toolchain required")
let root = FileManager.default.temporaryDirectory.appendingPathComponent("CMOCNavigationBuild-" + UUID().uuidString)
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
@@ -19,7 +19,7 @@ final class CMOCSourceDebugTests: XCTestCase {
}
private func fixture() async throws -> Fixture {
let resources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources")
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let rom = resources.appendingPathComponent("ROMs/coco3.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path)
&& FileManager.default.fileExists(atPath: rom.path), "Local licensed CoCo ROM and staged toolchain are required")
@@ -1046,7 +1046,7 @@ final class CMOCMultiFileExecutionTests: XCTestCase {
@MainActor func testHelloDiskDOSAndLOADMRunTheSameProgramOnBothCPUs() async throws {
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let resources = mac.appendingPathComponent("LocalResources")
let runtime = resources.appendingPathComponent("ToolchainBundle")
let runtime = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let romURL = resources.appendingPathComponent("ROMs/coco3.rom"), diskROMURL = resources.appendingPathComponent("ROMs/disk11.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: runtime.appendingPathComponent("bin/cmoc").path) && FileManager.default.fileExists(atPath: romURL.path) && FileManager.default.fileExists(atPath: diskROMURL.path), "Stage local tools and ROMs")
let root = FileManager.default.temporaryDirectory.appendingPathComponent("CMOCHelloDOS-" + UUID().uuidString)
@@ -1100,7 +1100,7 @@ final class CMOCMultiFileExecutionTests: XCTestCase {
@MainActor func testMultiFileQuickloadAndDiskBootStopAtVerifiedSourceOnBothCPUs() async throws {
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let resources = mac.appendingPathComponent("LocalResources"), toolchain = resources.appendingPathComponent("ToolchainBundle")
let resources = mac.appendingPathComponent("LocalResources"), toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let romURL = resources.appendingPathComponent("ROMs/coco3.rom"), diskROMURL = resources.appendingPathComponent("ROMs/disk11.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path) &&
FileManager.default.fileExists(atPath: romURL.path) && FileManager.default.fileExists(atPath: diskROMURL.path),
@@ -1240,7 +1240,7 @@ final class CMOCLiveBreakpointModelTests: XCTestCase {
}
@MainActor func testPausedLiveToggleKeepsInstructionUpdatesAndRejectsUnobservedMemoryEdits() async throws {
let resources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources")
let toolchain = resources.appendingPathComponent("ToolchainBundle"), romURL = resources.appendingPathComponent("ROMs/coco3.rom")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle")), romURL = resources.appendingPathComponent("ROMs/coco3.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path) &&
FileManager.default.fileExists(atPath: romURL.path), "Staged tools and a licensed local CoCo ROM are required")
let folder = FileManager.default.temporaryDirectory.appendingPathComponent("CMOCLiveBreakpoints-" + UUID().uuidString)
@@ -263,8 +263,8 @@ final class CMOCVariableDebugTests: XCTestCase {
XCTAssertThrowsError(try parse(floating(5, String(repeating: "x", count: 129))))
}
func testCompilerTagsActualFloatingFormatsIncludingNestedTypes() throws {
let runtime = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
.appendingPathComponent("LocalResources/ToolchainBundle")
let runtime = vccQualificationToolchain(URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
.appendingPathComponent("LocalResources/ToolchainBundle"))
let compiler = runtime.appendingPathComponent("bin/cmoc")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: compiler.path), "Staged compiler required")
let root = FileManager.default.temporaryDirectory.appendingPathComponent("CMOCFloatFormats-" + UUID().uuidString)
@@ -318,7 +318,7 @@ final class CMOCVariableDebugTests: XCTestCase {
}
func testMetadataPathsDoNotDependOnLiveIncrementalWorkspaceLifetime() async throws {
let resources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources")
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path), "Staged compiler required")
let root = FileManager.default.temporaryDirectory.appendingPathComponent("CMOCMetadataLive-" + UUID().uuidString)
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
@@ -348,7 +348,7 @@ final class CMOCVariableDebugTests: XCTestCase {
func testLongCompilerTypeRecordsUseOnlyVerifiedMatchingAssembly() async throws {
let resources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
.appendingPathComponent("LocalResources")
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path), "Staged compiler required")
let root = FileManager.default.temporaryDirectory.appendingPathComponent("CMOCLongMetadata-" + UUID().uuidString)
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
@@ -18,7 +18,7 @@ final class CMOCVariableTreeIntegrationTests: XCTestCase {
}
private func fixture() async throws -> Fixture {
let resources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources")
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let rom = resources.appendingPathComponent("ROMs/coco3.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path)
&& FileManager.default.fileExists(atPath: rom.path), "Local licensed CoCo ROM and staged toolchain are required")
@@ -16,7 +16,7 @@ final class CMOCWorkflowHardeningTests: XCTestCase {
return try XCTUnwrap(value)
}
@MainActor func testFailedCancelledAndCleanBuildsKeepLastRunnableAndLoadedIdentity() async throws {
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let rom = resources.appendingPathComponent("ROMs/coco3.rom")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path)
&& FileManager.default.fileExists(atPath: rom.path), "Staged toolchain and local CoCo ROM required")
@@ -102,7 +102,7 @@ final class CMOCWorkflowHardeningTests: XCTestCase {
}
}
@MainActor func testMissingOpenFilesPreserveTextAndInvalidateBuildWithoutRecreatingFiles() async throws {
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path), "Staged toolchain required")
let root = FileManager.default.temporaryDirectory.appendingPathComponent("CMOCMissingFiles-\(UUID().uuidString)")
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
@@ -0,0 +1,321 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import AppKit
import Darwin
import XCTest
final class MCPBuildExportTests: XCTestCase {
private var root: URL!
override func setUpWithError() throws {
root = FileManager.default.temporaryDirectory.appendingPathComponent("VCC export tests " + UUID().uuidString)
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: false)
}
override func tearDownWithError() throws { if let root { try? FileManager.default.removeItem(at: root) } }
private func artifact(_ name: String = "Artifact", files: [String: Data] = ["GAME.BIN": Data([0,1,2]), "HOME.DSK": Data(repeating: 1, count: 161280), "DATA.DSK": Data(repeating: 2, count: 161280), "COCOMAN.dsk": Data(repeating: 1, count: 161280)]) throws -> CMOCBuildArtifact {
let directory = root.appendingPathComponent(name)
try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: false)
for (path,data) in files {
let url = directory.appendingPathComponent(path)
try FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)
try data.write(to: url)
}
let source = Data("int main(void){return 0;}".utf8)
try source.write(to: directory.appendingPathComponent("main.c"))
return CMOCBuildArtifact(id: UUID(), directory: directory, source: String(decoding: source, as: UTF8.self), sourceData: source,
sourceSHA256: CMOCProject.sha256(source), binaryData: files["GAME.BIN"] ?? Data(), buildLog: "",
outputPaths: Array(files.keys) + ["main.c"],
exportProducts: files.map { CMOCBuildOutputProduct(relativePath: $0.key, byteCount: $0.value.count, sha256: CMOCProject.sha256($0.value)) }.sorted { $0.relativePath < $1.relativePath })
}
private func destination(_ name: String = "Deliveries") throws -> URL {
let url = root.appendingPathComponent(name)
try FileManager.default.createDirectory(at: url, withIntermediateDirectories: false)
return url
}
func testSeparateExactSetsPreserveAliasesAndOriginalIdentity() throws {
let release = try artifact("Release"), debug = try artifact("Debug", files: ["GAME.BIN":Data([4,5,6]),"HOME.DSK":Data(repeating:3,count:161280),"DATA.DSK":Data(repeating:4,count:161280),"COCOMAN.dsk":Data(repeating:3,count:161280)])
let folder = try destination(), exporter = try MCPBuildExporter(destination: folder)
for (name,artifact) in [("VCC-Release",release),("VCC-Debug",debug)] {
let source = try MCPBuildExporter.Source(artifact)
XCTAssertEqual(source.artifactID,artifact.id)
let delivery = try exporter.export(source: source, products: artifact.exportProducts, setName: name)
try exporter.verify(delivery)
for product in delivery.products {
let bytes=try Data(contentsOf:folder.appendingPathComponent(name).appendingPathComponent(product.relativePath))
XCTAssertEqual(bytes.count,product.byteCount);XCTAssertEqual(CMOCProject.sha256(bytes),product.sha256)
}
XCTAssertEqual(try Data(contentsOf:folder.appendingPathComponent(name+"/HOME.DSK")),try Data(contentsOf:folder.appendingPathComponent(name+"/COCOMAN.dsk")))
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:name))
}
XCTAssertNotEqual(release.exportProducts.first?.identifier(artifactID:release.id),debug.exportProducts.first?.identifier(artifactID:debug.id))
}
func testUndeclaredAndTraversalSelectionsNeverCopySource() throws {
let artifact=try artifact(),exporter=try MCPBuildExporter(destination:destination()),source=try MCPBuildExporter.Source(artifact)
for path in ["main.c","../outside","/etc/passwd"] {
let product=CMOCBuildOutputProduct(relativePath:path,byteCount:1,sha256:CMOCProject.sha256(Data([0])))
XCTAssertThrowsError(try exporter.export(source:source,products:[product],setName:"VCC-Invalid"))
}
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-../escape"))
}
func testChangedOutputAndLinkedLeafAreRejected() throws {
let artifact=try artifact(),source=try MCPBuildExporter.Source(artifact),exporter=try MCPBuildExporter(destination:destination())
let output=artifact.directory.appendingPathComponent("GAME.BIN")
try Data([9,9,9]).write(to:output)
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Changed"))
try FileManager.default.removeItem(at:output)
let external=root.appendingPathComponent("outside.bin");try Data([0,1,2]).write(to:external)
try FileManager.default.createSymbolicLink(at:output,withDestinationURL:external)
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Linked"))
try FileManager.default.removeItem(at:output)
try FileManager.default.linkItem(at:external,to:output)
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-HardLinked"))
XCTAssertEqual(try Data(contentsOf:external),Data([0,1,2]))
}
func testLinkedParentAndReplacedArtifactDirectoryAreRejected() throws {
let artifact=try artifact(files:["nested/GAME.BIN":Data([1])]),source=try MCPBuildExporter.Source(artifact)
let exporter=try MCPBuildExporter(destination:destination())
let parent=artifact.directory.appendingPathComponent("nested"),moved=root.appendingPathComponent("moved")
try FileManager.default.moveItem(at:parent,to:moved)
try FileManager.default.createSymbolicLink(at:parent,withDestinationURL:moved)
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Parent"))
let movedArtifact=root.appendingPathComponent("Old Artifact")
try FileManager.default.moveItem(at:artifact.directory,to:movedArtifact)
try FileManager.default.createDirectory(at:artifact.directory,withIntermediateDirectories:false)
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Replaced"))
}
func testChangedAndLinkedDestinationAreRejected() throws {
let artifact=try artifact(),source=try MCPBuildExporter.Source(artifact),folder=try destination()
let exporter=try MCPBuildExporter(destination:folder),moved=root.appendingPathComponent("Old Delivery Folder")
try FileManager.default.moveItem(at:folder,to:moved)
try FileManager.default.createDirectory(at:folder,withIntermediateDirectories:false)
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Replaced"))
try FileManager.default.removeItem(at:folder)
try FileManager.default.createSymbolicLink(at:folder,withDestinationURL:moved)
XCTAssertThrowsError(try MCPBuildExporter(destination:folder))
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Linked"))
}
func testReplacementBetweenStagingAndCommitDoesNotPublish() throws {
let artifact=try artifact(),source=try MCPBuildExporter.Source(artifact),folder=try destination(),moved=root.appendingPathComponent("Moved")
let exporter=try MCPBuildExporter(destination:folder)
exporter.beforeCommit = {
try FileManager.default.moveItem(at:folder,to:moved)
try FileManager.default.createDirectory(at:folder,withIntermediateDirectories:false)
}
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Race"))
XCTAssertFalse(FileManager.default.fileExists(atPath:folder.appendingPathComponent("VCC-Race").path))
XCTAssertFalse(FileManager.default.fileExists(atPath:moved.appendingPathComponent("VCC-Race").path))
}
func testRevocationBeforeCommitAndPartialFailureKeepPriorData() throws {
let artifact=try artifact(),source=try MCPBuildExporter.Source(artifact),folder=try destination()
let prior=folder.appendingPathComponent("prior.txt");try Data("keep".utf8).write(to:prior)
let exporter=try MCPBuildExporter(destination:folder)
exporter.beforeCommit = { exporter.invalidate() }
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Revoked"))
let failing=try MCPBuildExporter(destination:folder)
failing.afterFile = { _ in throw POSIXError(.ENOSPC) }
XCTAssertThrowsError(try failing.export(source:source,products:artifact.exportProducts,setName:"VCC-Failed"))
XCTAssertEqual(try FileManager.default.contentsOfDirectory(atPath:folder.path),["prior.txt"])
XCTAssertEqual(try Data(contentsOf:prior),Data("keep".utf8))
}
func testRetryVerificationRefusesChangedMissingExtraOrLinkedDeliveredBytes() throws {
let artifact=try artifact(),source=try MCPBuildExporter.Source(artifact),folder=try destination(),exporter=try MCPBuildExporter(destination:folder)
let delivery=try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Delivery")
let product=folder.appendingPathComponent("VCC-Delivery/GAME.BIN")
try Data([7,7,7]).write(to:product)
XCTAssertThrowsError(try exporter.verify(delivery))
try Data([0,1,2]).write(to:product)
try exporter.verify(delivery)
let extra=folder.appendingPathComponent("VCC-Delivery/unrequested.txt");try Data([1]).write(to:extra)
XCTAssertThrowsError(try exporter.verify(delivery))
try FileManager.default.removeItem(at:extra);try FileManager.default.removeItem(at:product)
XCTAssertThrowsError(try exporter.verify(delivery))
try FileManager.default.createSymbolicLink(at:product,withDestinationURL:artifact.directory.appendingPathComponent("GAME.BIN"))
XCTAssertThrowsError(try exporter.verify(delivery))
}
func testConcurrentDestinationConflictCannotReplacePriorSet() throws {
let artifact=try artifact(),source=try MCPBuildExporter.Source(artifact),folder=try destination(),exporter=try MCPBuildExporter(destination:folder)
let prior=folder.appendingPathComponent("VCC-Conflict")
exporter.beforeCommit = { try FileManager.default.createDirectory(at:prior,withIntermediateDirectories:false);try Data("preserve".utf8).write(to:prior.appendingPathComponent("mine")) }
XCTAssertThrowsError(try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Conflict"))
XCTAssertEqual(try Data(contentsOf:prior.appendingPathComponent("mine")),Data("preserve".utf8))
}
func testCancellationLeavesNoPartialSet() async throws {
let artifact=try artifact(),source=try MCPBuildExporter.Source(artifact),folder=try destination(),exporter=try MCPBuildExporter(destination:folder)
let work=Task.detached { () throws -> Void in
withUnsafeCurrentTask { $0?.cancel() }
_ = try exporter.export(source:source,products:artifact.exportProducts,setName:"VCC-Cancelled")
}
do { try await work.value;XCTFail("Cancelled export succeeded") } catch { XCTAssertTrue(error is CancellationError) }
XCTAssertTrue(try FileManager.default.contentsOfDirectory(atPath:folder.path).isEmpty)
}
func testDeclaredExportConfigurationSeparatesInputsAndDirectories() throws {
var config=CMOCProjectConfiguration();config.exportOutputs=["delivery/alias.dsk"]
XCTAssertEqual(try config.validated().exportOutputs,["delivery/alias.dsk"])
config.exportOutputs=["main.c"];XCTAssertThrowsError(try config.validated())
config.exportOutputs=["../secret"];XCTAssertThrowsError(try config.validated())
config.exportOutputs=["a","a/b"];XCTAssertThrowsError(try config.validated())
config.exportOutputs=["A.dsk","a.DSK"];XCTAssertThrowsError(try config.validated())
config.exportOutputs=[".git/config"];XCTAssertThrowsError(try config.validated())
}
}
@MainActor
final class MCPBuildExportAccessTests: XCTestCase {
#if DEBUG
func testPublicHelperBuildsReleaseThenDebugAndExportsOriginalProductsWithScopedPermission() async throws {
_ = NSApplication.shared
let resources = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("LocalResources")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let helper = Bundle(for: Self.self).bundleURL.deletingLastPathComponent().appendingPathComponent("vcc-mcp")
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: helper.path) && FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path), "Build the public helper and stage the reviewed compiler runtime.")
let folder = FileManager.default.temporaryDirectory.appendingPathComponent("MCP public build export " + UUID().uuidString)
try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: false)
let suite = "MCPBuildExport." + UUID().uuidString, defaults = try XCTUnwrap(UserDefaults(suiteName: suite))
defer { defaults.removePersistentDomain(forName: suite); try? FileManager.default.removeItem(at: folder) }
let machine = MachineModel(diskStore: .init(url: folder.appendingPathComponent("disks.json")), displayDefaults: defaults,
inputStore: .init(url: folder.appendingPathComponent("input.json")), restoreMediaOnLaunch: false)
defer { machine.shutdown() }
let model = CMOCDevelopmentModel(machine: machine, toolchain: toolchain, defaults: defaults,
buildRoot: folder.appendingPathComponent("Builds"), recoveryRoot: folder.appendingPathComponent("Recovery"))
var project = try CMOCProject.create(at: folder.appendingPathComponent("Project"))
var configuration = project.configuration
configuration.binary = "GAME.BIN"; configuration.diskImage = "HOME.DSK"; configuration.diskTarget = "all"
configuration.playtestDisks = ["DATA.DSK"]; configuration.exportOutputs = ["COCOMAN.dsk"]
try JSONEncoder().encode(configuration).write(to: project.directory.appendingPathComponent(CMOCProject.configurationFilename))
let source = """
#include <cmoc.h>
int main(void) {
#ifdef RELEASE
printf("NORMAL RELEASE\\n");
#else
printf("NORMAL DEBUG\\n");
#endif
return 0;
}
"""
try Data(source.utf8).write(to: project.directory.appendingPathComponent("main.c"))
let makefile = """
ifeq ($(VCC_CONFIGURATION),Release)
FLAGS = -O2 -DRELEASE
else
FLAGS = -O0 -fno-omit-frame-pointer
endif
all: GAME.BIN HOME.DSK DATA.DSK COCOMAN.dsk
GAME.BIN: main.c
\tcmoc --coco --intermediate $(FLAGS) -o GAME.BIN main.c
HOME.DSK: GAME.BIN
\tperl -e 'print "\\xff" x 161280' > HOME.DSK
\twritecocofile HOME.DSK GAME.BIN
DATA.DSK:
\tperl -e 'print "\\xff" x 161280' > DATA.DSK
COCOMAN.dsk: HOME.DSK
\tcp HOME.DSK COCOMAN.dsk
clean:
\trm -f GAME.BIN HOME.DSK DATA.DSK COCOMAN.dsk
"""
try Data(makefile.utf8).write(to: project.directory.appendingPathComponent("Makefile"))
project = try CMOCProject.open(at: project.directory); try model.adopt(project)
let destination = folder.appendingPathComponent("Delivery")
try FileManager.default.createDirectory(at: destination, withIntermediateDirectories: false)
let host = MCPCMOC(), grant = folder.appendingPathComponent("grant.json")
let clientSource = resources.deletingLastPathComponent().appendingPathComponent("Tools/MCP/test-helper.py")
func run(_ script: String) async throws -> String {
try await Task.detached {
let process = Process(), output = Pipe()
process.executableURL = URL(fileURLWithPath: "/usr/bin/env")
process.arguments = ["python3", "-c", script, clientSource.path, helper.path, grant.path, destination.path]
process.standardOutput = output; process.standardError = output
let deadline = DispatchWorkItem { if process.isRunning { process.terminate() } }
DispatchQueue.global().asyncAfter(deadline: .now() + 150, execute: deadline)
defer { deadline.cancel() }
try process.run(); let bytes = try output.fileHandleForReading.readToEnd() ?? Data(); process.waitUntilExit()
let text = String(decoding: bytes, as: UTF8.self)
guard process.terminationStatus == 0 else { throw NSError(domain: "MCPBuildExportFixture", code: Int(process.terminationStatus), userInfo: [NSLocalizedDescriptionKey: text]) }
return text
}.value
}
let setup = """
import importlib.util,json,sys,time,hashlib
from pathlib import Path
spec=importlib.util.spec_from_file_location('client',sys.argv[1]);m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
def result(c,tool,**args):
reply=c.call(tool,**args)['result']
assert not reply.get('isError'),(tool,reply)
return reply['structuredContent']
"""
do {
try await host.exportCallContextRegression(model, at: grant, playtests: false, exportFolder: destination)
let passed = try await run(setup + """
with m.Client(sys.argv[2],Path(sys.argv[3])) as c:
c.handshake('2025-11-25')
catalog={t['name']:t for t in c.request('tools/list')['result']['tools']}
assert {'export_build_outputs','get_build_export'} <= set(catalog)
caps=result(c,'get_capabilities');project=caps['project_id'];revision=caps['revision']
dest=caps['export_destinations'][0]['destination_id']
builds=[]
for configuration in ('Release','Debug'):
build=result(c,'build_project',project_id=project,revision=revision,request_id='build-'+configuration,configuration=configuration,action='disk')
for _ in range(1600):
state=result(c,'get_build',build_id=build['build_id'])
if state['status']!='building':break
time.sleep(.025)
assert state['status']=='succeeded',state
assert len(state['exportable_outputs'])==4,state
builds.append(state)
directories=[]
for index,state in enumerate(builds):
args=dict(project_id=project,build_id=state['build_id'],artifact_id=state['artifact_id'],revision=state['revision'],destination_id=dest,output_ids=[p['output_id'] for p in state['exportable_outputs']],request_id='deliver-'+str(index))
accepted=result(c,'export_build_outputs',**args)
for _ in range(800):
exported=result(c,'get_build_export',project_id=project,export_id=accepted['export_id'])
if not exported['busy']:break
time.sleep(.01)
assert exported['status']=='completed',exported
assert exported['artifact_id']==state['artifact_id'] and exported['build_id']==state['build_id']
assert exported['revision']==state['revision'] and exported['configuration']==state['configuration']
directories.append(exported['delivery_directory'])
expected={p['output_id']:p for p in state['exportable_outputs']}
for p in exported['outputs']:
data=(Path(sys.argv[4])/p['relative_filename']).read_bytes()
assert len(data)==p['bytes']==expected[p['output_id']]['bytes']
assert hashlib.sha256(data).hexdigest()==p['sha256']==expected[p['output_id']]['sha256']
home=Path(sys.argv[4])/exported['delivery_directory']/'HOME.DSK'
alias=home.with_name('COCOMAN.dsk');assert home.read_bytes()==alias.read_bytes()
retry=result(c,'export_build_outputs',**args);assert retry==exported,(retry,exported)
for changed in ({'artifact_id':'wrong'},{'build_id':'wrong'},{'project_id':'wrong'},{'revision':revision+1},{'destination_id':'wrong'},{'output_ids':['main.c']},{'output_ids':[args['output_ids'][0]]}):
rejected=c.call('export_build_outputs',**{**args,**changed})
assert rejected.get('error') or rejected.get('result',{}).get('isError'),rejected
if index==1:
home.write_bytes(b'changed by owner')
rejected=c.call('export_build_outputs',**args)
assert rejected['result'].get('isError'),rejected
assert home.read_bytes()==b'changed by owner'
assert len(set(directories))==2
assert len(list(Path(sys.argv[4]).iterdir()))==2
print('PASS real approved Make Release/Debug builds and exact separate four-product exports; retries, alias identity, identity/destination/selection conflicts and tamper refusal')
""")
XCTAssertTrue(passed.contains("PASS real approved Make"), passed)
await host.revoke().value
try await host.exportCallContextRegression(model, at: grant, playtests: false)
let refused = try await run(setup + """
with m.Client(sys.argv[2],Path(sys.argv[3])) as c:
c.handshake('2025-11-25')
names={t['name'] for t in c.request('tools/list')['result']['tools']}
assert 'export_build_outputs' not in names and 'get_build_export' not in names
assert not result(c,'get_capabilities')['build_output_export']
# Forging grant metadata can expose a helper schema, but not host permission.
path=Path(sys.argv[3]);grant=json.loads(path.read_text());grant['toolset']=13;grant['buildExport']=True;path.write_text(json.dumps(grant));path.chmod(0o600)
with m.Client(sys.argv[2],path) as c:
c.handshake('2025-11-25')
caps=result(c,'get_capabilities');assert not caps['build_output_export']
rejected=c.call('export_build_outputs',project_id=caps['project_id'],build_id='wrong',artifact_id='wrong',revision=caps['revision'],destination_id='wrong',output_ids=['x'*64],request_id='forged')
assert rejected['result'].get('isError'),rejected
print('PASS absent native consent and forged client permission cannot authorize export')
""")
XCTAssertTrue(refused.contains("PASS absent native consent"), refused)
await host.revoke().value
} catch { await host.revoke().value; throw error }
}
#endif
}
@@ -89,7 +89,7 @@ final class MCPCallContextAccessTests: XCTestCase {
func testRealCGrantOwnsFrozenSevenArgumentContextAndRejectsStaleAuthority() async throws {
_ = NSApplication.shared
let localToolchainBundle = resources.appendingPathComponent("ToolchainBundle")
let localToolchainBundle = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let roms = resources.appendingPathComponent("ROMs")
try XCTSkipUnless(["cmoc", "make", "perl", "writecocofile"].allSatisfy {
FileManager.default.isExecutableFile(atPath: localToolchainBundle.appendingPathComponent("bin/" + $0).path)
@@ -156,7 +156,7 @@ final class MCPCallContextAccessTests: XCTestCase {
do {
try await host.exportCallContextRegression(model, at: grantFile, helperURL: worker, roms: roms)
let grant = try readGrant(grantFile)
XCTAssertEqual(grant["toolset"] as? Int, 12)
XCTAssertEqual(grant["toolset"] as? Int, 13)
XCTAssertEqual(grant["playtestVideo"] as? Bool, true)
XCTAssertEqual(grant["playtestCallContext"] as? Bool, true)
let capabilities = try await result("get_capabilities", grant: grant)
@@ -333,7 +333,7 @@ final class MCPCallContextAccessTests: XCTestCase {
let machine = MachineModel(diskStore: .init(url: root.appendingPathComponent("disks.json")), displayDefaults: defaults,
inputStore: .init(url: root.appendingPathComponent("input.json")), restoreMediaOnLaunch: false)
defer { machine.shutdown() }
let model = CMOCDevelopmentModel(machine: machine, toolchain: resources.appendingPathComponent("ToolchainBundle"),
let model = CMOCDevelopmentModel(machine: machine, toolchain: vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle")),
defaults: defaults, buildRoot: root.appendingPathComponent("Builds"), recoveryRoot: root.appendingPathComponent("Recovery"))
let project = try CMOCProject.create(at: root.appendingPathComponent("Project"))
try model.adopt(project)
@@ -408,7 +408,7 @@ final class MCPCallContextAccessTests: XCTestCase {
func testPublicMediaGrantBindsArtifactsRetainsEveryDiskAndResumesOnBothProcessors() async throws {
_ = NSApplication.shared
let toolchain = resources.appendingPathComponent("ToolchainBundle")
let toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
let roms = resources.appendingPathComponent("ROMs")
try XCTSkipUnless(["cmoc", "make", "perl", "writecocofile"].allSatisfy {
FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/" + $0).path)
@@ -469,11 +469,16 @@ final class MCPCallContextAccessTests: XCTestCase {
do {
try await host.exportCallContextRegression(model, at: grantFile, helperURL: worker, roms: roms)
let grant = try readGrant(grantFile)
XCTAssertEqual(grant["toolset"] as? Int, 12)
XCTAssertEqual(grant["toolset"] as? Int, 13)
XCTAssertEqual(grant["playtestVideo"] as? Bool, true)
XCTAssertEqual(grant["playtestMedia"] as? Bool, true)
XCTAssertEqual(grant["playtestMultiDrive"] as? Bool, true)
XCTAssertEqual(grant["buildExport"] as? Bool, false)
let capabilities = try await result("get_capabilities", grant: grant)
XCTAssertEqual(capabilities["playtest_media_exchange"] as? Bool, true)
XCTAssertEqual(capabilities["playtest_media_drives"] as? [Int], [0, 1, 2, 3])
XCTAssertEqual(capabilities["playtest_media_version"] as? Int, 2)
XCTAssertEqual(capabilities["playtest_media_write_protection"] as? Bool, true)
XCTAssertEqual((capabilities["tools"] as? [String])?.count, 35)
let scope: [String: Any] = ["project_id": try XCTUnwrap(capabilities["project_id"] as? String),
"revision": try XCTUnwrap(capabilities["revision"] as? Int)]
@@ -96,7 +96,7 @@ final class MCPDebuggerInspectionTests: XCTestCase {
}
func testOrdinaryCMOCStopsAtMainWithCompiledWatchAndNoDisk() async throws {
let root = try directory(), toolchain = resources.appendingPathComponent("ToolchainBundle")
let root = try directory(), toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path),
"Requires the local staged toolchain.")
let machine = try await machine(at: root, enhanced: true)
@@ -142,7 +142,7 @@ final class MCPDebuggerInspectionTests: XCTestCase {
XCTAssertNotEqual(paused.debuggerProgramRevision, snapshot.machine.debuggerProgramRevision)
}
func testHelloDiskKeepsCapturedInspectionAfterContinueAndEject() async throws {
let root = try directory(), toolchain = resources.appendingPathComponent("ToolchainBundle")
let root = try directory(), toolchain = vccQualificationToolchain(resources.appendingPathComponent("ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: toolchain.appendingPathComponent("bin/cmoc").path),
"Requires the local staged toolchain.")
let machine = try await machine(at: root, enhanced: false)
@@ -1829,6 +1829,469 @@ final class MCPPlaytestTests: XCTestCase {
catch { XCTAssertTrue(error.localizedDescription.contains("stale_run")) }
}
func testOwnedMultipleDrivesReadBothWriteOnlyHomeAndRetainIndependentlyOnBothProcessors() async throws {
let (helper, system, diskROM) = try inputs()
for cpu in ["6809", "6309"] {
for homeDrive in 0...2 {
let dataDrive = homeDrive + 1
let root = FileManager.default.temporaryDirectory.appendingPathComponent("VCCMultiDrive-" + UUID().uuidString)
defer { try? FileManager.default.removeItem(at: root) }
var home = disk(), data = disk()
home.replaceSubrange(0..<4, with: Data("HOME".utf8))
data.replaceSubrange(0..<4, with: Data("DATA".utf8))
let declaration = declaredMedia(artifact: UUID().uuidString, project: "multi-drive-\(cpu)-\(homeDrive)", primary: home, world: data)
// DSKI$ returns two 128-byte strings per sector. Reserve a
// normal BASIC string heap for both disks and the save buffers.
let source = "CLEAR2000\n5 H=\(homeDrive):D=\(dataDrive)\n10 IFINKEY$=\"\"THEN10\n20 DSKI$H,0,1,A$,B$:DSKI$D,0,1,C$,E$:PRINTLEFT$(A$,4);\":\";LEFT$(C$,4)\n30 A$=\"SAVE\"+STRING$(124,88):B$=STRING$(128,89):DSKO$H,0,2,A$,B$:DSKI$H,0,2,A$,B$:PRINTLEFT$(A$,4):GOTO10\nRUN\n"
let test = try await MCPPlaytest.start(systemROM: system, diskROM: diskROM, disk: home,
bootCommands: source, projectID: "multi-drive-\(cpu)-\(homeDrive)", revision: 1,
artifactID: declaration.proof.artifactID!, cpu: cpu, helperURL: helper,
retentionDirectory: root, diskProvenance: declaration.proof, media: declaration.media, multiDrive: true)
defer { test.invalidate() }
_ = try await test.pausePlaytest()
func exchange(_ drive: Int, _ id: String?, _ hash: String?, _ requestID: String, protection: Bool? = nil) async throws -> [String: Any] {
var request: [String: Any] = ["run_id": test.runID, "request_id": requestID, "action": id == nil ? "eject" : "insert", "drive": drive]
if let id { request["media_id"] = id; request["media_sha256"] = hash }
if let protection { request["write_protected"] = protection }
return try await test.reply("exchange_playtest_media", arguments: request)
}
let before = try await test.capture()
XCTAssertEqual((before["drives"] as? [[String: Any]])?.count, 4)
for invalid: Any in [true, 1.5, -1, 4, "1"] {
await expectDiskFailure {
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id": test.runID, "request_id": "invalid-drive", "action": "eject", "drive": invalid])
}
}
for invalid: Any in [1, "true"] {
await expectDiskFailure {
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id": test.runID, "request_id": "invalid-protection", "action": "insert", "drive": dataDrive,
"media_id": declaration.media[1].id, "media_sha256": declaration.media[1].baseSHA256, "write_protected": invalid])
}
}
await expectDiskFailure {
_ = try await exchange(dataDrive, declaration.media[0].id, declaration.media[0].baseSHA256, "duplicate-mount")
}
if homeDrive != 0 {
_ = try await exchange(0, nil, nil, "eject-home")
_ = try await exchange(homeDrive, declaration.media[0].id, declaration.media[0].baseSHA256, "move-home")
}
let inserted = try await exchange(dataDrive, declaration.media[1].id, declaration.media[1].baseSHA256, "data", protection: true)
let insertedRows = try XCTUnwrap(inserted["drives"] as? [[String: Any]])
XCTAssertEqual(insertedRows[dataDrive]["write_protected"] as? Bool, true)
XCTAssertEqual(insertedRows[homeDrive]["write_protected"] as? Bool, false)
XCTAssertEqual(inserted["field_clock"] as? Int, before["field_clock"] as? Int)
XCTAssertEqual(inserted["target_drive"] as? Int, dataDrive)
XCTAssertEqual(inserted["media_id"] as? String, homeDrive == 0 ? declaration.media[0].id : nil)
let retry = try await exchange(dataDrive, declaration.media[1].id, declaration.media[1].baseSHA256, "data", protection: true)
XCTAssertEqual(inserted as NSDictionary, retry as NSDictionary)
await expectDiskFailure { _ = try await exchange(homeDrive, declaration.media[1].id, declaration.media[1].baseSHA256, "data", protection: true) }
await expectDiskFailure { _ = try await exchange(dataDrive, declaration.media[1].id, declaration.media[1].baseSHA256, "data", protection: false) }
_ = try await test.continuePlaytest()
_ = try await test.reply("playtest_input", arguments: ["run_id": test.runID, "request_id": "read-and-save", "steps": [["keys": ["r"], "fields": 18], ["keys": [], "fields": 420]]])
_ = try await test.pausePlaytest()
let saved = try await test.capture()
let text = saved["screen_text"] as? String ?? ""
XCTAssertTrue(text.contains("HOME:DATA"), text)
XCTAssertTrue(text.contains("SAVE"), text)
let rows = try XCTUnwrap(saved["drives"] as? [[String: Any]])
XCTAssertGreaterThan((rows[homeDrive]["disk_reads"] as? Int) ?? 0, 0)
XCTAssertGreaterThan((rows[homeDrive]["disk_writes"] as? Int) ?? 0, 0)
XCTAssertGreaterThan((rows[dataDrive]["disk_reads"] as? Int) ?? 0, 0)
XCTAssertEqual(rows[dataDrive]["disk_writes"] as? Int, 0)
XCTAssertEqual(rows[dataDrive]["disk_sha256"] as? String, CMOCProject.sha256(data))
XCTAssertNotEqual(rows[homeDrive]["disk_sha256"] as? String, CMOCProject.sha256(home))
let restarted = try await test.reply("restart_playtest", arguments: ["run_id": test.runID, "request_id": "restart-all"])
let restartedRows = try XCTUnwrap(restarted["drives"] as? [[String: Any]])
for drive in 0..<4 {
XCTAssertEqual(restartedRows[drive]["media_id"] as? String, rows[drive]["media_id"] as? String)
XCTAssertEqual(restartedRows[drive]["disk_sha256"] as? String, rows[drive]["disk_sha256"] as? String)
XCTAssertEqual(restartedRows[drive]["write_protected"] as? Bool, rows[drive]["write_protected"] as? Bool)
}
let stopArgs: [String: Any] = ["run_id": test.runID, "request_id": "stop"]
let stopped = try await test.reply("stop_playtest", arguments: stopArgs)
let repeated = try await test.reply("stop_playtest", arguments: stopArgs)
XCTAssertEqual(stopped as NSDictionary, repeated as NSDictionary)
let retained = try XCTUnwrap(stopped["retained_media"] as? [[String: Any]])
XCTAssertEqual(retained.count, 2)
XCTAssertEqual(Set(retained.compactMap { $0["retained_disk_id"] as? String }).count, 2)
for (index, medium) in declaration.media.enumerated() {
let record = try XCTUnwrap(retained.first { $0["media_id"] as? String == medium.id })
let id = try XCTUnwrap(record["retained_disk_id"] as? String), hash = try XCTUnwrap(record["disk_sha256"] as? String)
let loaded = try await MCPPlaytestDiskStore.load(directory: root, id: id, expectedSHA256: hash,
projectKey: declaration.key, artifactDiskSHA256: declaration.proof.artifactDiskSHA256!,
mediaKey: medium.key, mediaBaseSHA256: medium.baseSHA256)
XCTAssertEqual(loaded.record.provenance.writeProtected, index == 1)
if index == 1 { XCTAssertEqual(loaded.data, data) }
else { XCTAssertEqual(String(decoding: loaded.data[256..<260], as: UTF8.self), "SAVE") }
}
}
}
}
func testMultiDriveDefaultFD0RetryIdentityAndIndependentEqualByteCopies() async throws {
let (helper, system, diskROM) = try inputs()
let root = FileManager.default.temporaryDirectory.appendingPathComponent("VCCMultiIdentity-" + UUID().uuidString)
defer { try? FileManager.default.removeItem(at: root) }
let original = disk(), declaration = declaredMedia(artifact: UUID().uuidString, project: "multi-identity", primary: original, world: original)
let test = try await MCPPlaytest.start(systemROM: system, diskROM: diskROM, disk: original,
bootCommands: "10 GOTO10\nRUN\n", projectID: "multi-identity", revision: 1,
artifactID: declaration.proof.artifactID!, helperURL: helper, retentionDirectory: root,
diskProvenance: declaration.proof, media: declaration.media, multiDrive: true)
defer { test.invalidate() }
_ = try await test.pausePlaytest()
let omitted: [String: Any] = ["run_id": test.runID, "request_id": "default-eject", "action": "eject"]
let ejected = try await test.reply("exchange_playtest_media", arguments: omitted)
var explicit = omitted; explicit["drive"] = 0
let explicitRetry = try await test.reply("exchange_playtest_media", arguments: explicit)
XCTAssertEqual(explicitRetry as NSDictionary, ejected as NSDictionary)
for drive in 0...1 {
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id": test.runID, "request_id": "insert-\(drive)", "action": "insert", "drive": drive,
"media_id": declaration.media[drive].id, "media_sha256": declaration.media[drive].baseSHA256])
}
let snapshot = try await test.capture()
let rows = try XCTUnwrap(snapshot["drives"] as? [[String: Any]])
XCTAssertNotEqual(rows[0]["media_id"] as? String, rows[1]["media_id"] as? String)
XCTAssertEqual(rows[0]["disk_sha256"] as? String, rows[1]["disk_sha256"] as? String)
let stopped = try await test.reply("stop_playtest", arguments: ["run_id": test.runID, "request_id": "stop"])
XCTAssertEqual((stopped["retained_media"] as? [[String: Any]])?.count, 2)
}
func testMultiDriveStopDrainsFourLargeDisksWithinTheExistingWireLimit() async throws {
let (helper, system, diskROM) = try inputs()
let root = FileManager.default.temporaryDirectory.appendingPathComponent("VCCFourDriveDrain-" + UUID().uuidString)
defer { try? FileManager.default.removeItem(at: root) }
let artifact = UUID().uuidString, project = "four-drive-drain", projectKey = CMOCProject.sha256(Data(project.utf8))
let base = disk(), primaryHash = CMOCProject.sha256(base)
let media = (0..<4).map { index -> MCPPlaytestMedium in
// 80-track single-sided raw images are valid and fit the per-image
// budget. Four base64 payloads would exceed the 1 MiB wire bound.
var bytes = index == 0 ? base : Data(repeating: UInt8(40 + index), count: 80 * 18 * 256)
bytes[0] = UInt8(index)
let key = index == 0 ? "primary" : "disk:drive\(index).dsk", hash = CMOCProject.sha256(bytes)
let proof = MCPPlaytestDiskStore.Provenance(projectKey: projectKey, artifactID: artifact,
artifactDiskSHA256: primaryHash, mediaKey: key, mediaBaseSHA256: hash)
return MCPPlaytestMedium(id: MCPPlaytestMedium.identifier(artifactID: artifact, key: key), name: "drive\(index).dsk",
key: key, baseSHA256: hash, data: bytes, provenance: proof)
}
// Keep primary hash and actual bytes identical for artifact binding.
let primary = media[0]
let test = try await MCPPlaytest.start(systemROM: system, diskROM: diskROM, disk: primary.data,
bootCommands: "10 GOTO10\nRUN\n", projectID: project, revision: 1, artifactID: artifact,
helperURL: helper, retentionDirectory: root, diskProvenance: primary.provenance, media: media, multiDrive: true)
defer { test.invalidate() }
_ = try await test.pausePlaytest()
for drive in 1...3 {
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id": test.runID, "request_id": "drive-\(drive)", "action": "insert", "drive": drive,
"media_id": media[drive].id, "media_sha256": media[drive].baseSHA256])
}
let stopped = try await test.reply("stop_playtest", arguments: ["run_id": test.runID, "request_id": "stop"])
let records = try XCTUnwrap(stopped["retained_media"] as? [[String: Any]])
XCTAssertEqual(records.count, 4)
for medium in media {
let record = try XCTUnwrap(records.first { $0["media_id"] as? String == medium.id })
XCTAssertEqual(record["disk_sha256"] as? String, medium.baseSHA256)
let id = try XCTUnwrap(record["retained_disk_id"] as? String)
XCTAssertEqual(try Data(contentsOf: MCPPlaytestDiskStore.diskURL(directory: root, id: id)), medium.data)
}
}
func testMultiDriveRetentionCanRetryAfterFrozenWorkerExit() async throws {
let (helper, system, diskROM) = try inputs()
let root = FileManager.default.temporaryDirectory.appendingPathComponent("VCCMultiRetentionRetry-" + UUID().uuidString)
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true, attributes: [.posixPermissions: 0o700])
defer { try? FileManager.default.removeItem(at: root) }
let blocked = root.appendingPathComponent("retained")
try Data("not a folder".utf8).write(to: blocked)
let original = disk(); var data = disk(); data[0] = 81
let declaration = declaredMedia(artifact: UUID().uuidString, project: "multi-retention-retry", primary: original, world: data)
let test = try await MCPPlaytest.start(systemROM: system, diskROM: diskROM, disk: original,
bootCommands: "10 PRINT 47\nSAVE\"HOME\"\n", projectID: "multi-retention-retry", revision: 1,
artifactID: declaration.proof.artifactID!, helperURL: helper, retentionDirectory: blocked,
diskProvenance: declaration.proof, media: declaration.media, multiDrive: true)
defer { test.invalidate() }
_ = try await test.pausePlaytest()
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id": test.runID, "request_id": "data", "action": "insert", "drive": 1,
"media_id": declaration.media[1].id, "media_sha256": declaration.media[1].baseSHA256])
let before = try await test.capture()
let beforeRows = try XCTUnwrap(before["drives"] as? [[String: Any]])
let stop: [String: Any] = ["run_id": test.runID, "request_id": "stop"]
await expectDiskFailure { _ = try await test.reply("stop_playtest", arguments: stop) }
XCTAssertNotNil(test.retentionError)
let pending = try await test.capture()
XCTAssertEqual(pending["status"] as? String, "retention_pending")
try FileManager.default.removeItem(at: blocked)
let stopped = try await test.reply("stop_playtest", arguments: stop)
XCTAssertNil(test.retentionError)
let records = try XCTUnwrap(stopped["retained_media"] as? [[String: Any]])
XCTAssertEqual(records.count, 2)
for index in 0...1 {
let record = try XCTUnwrap(records.first { $0["media_id"] as? String == declaration.media[index].id })
XCTAssertEqual(record["disk_sha256"] as? String, beforeRows[index]["disk_sha256"] as? String)
}
}
func testOwnedDriveProtectionBlocksGuestWriteAndCanBeChangedWithReview() async throws {
let (helper, system, diskROM) = try inputs()
for cpu in ["6809", "6309"] {
let root = FileManager.default.temporaryDirectory.appendingPathComponent("VCCOwnedWriteProtect-" + UUID().uuidString)
defer { try? FileManager.default.removeItem(at: root) }
let original = disk(), declaration = declaredMedia(artifact: UUID().uuidString, project: "protected-" + cpu, primary: original, world: original)
let program = "CLEAR2000\n10 IFINKEY$=\"\"THEN10\n20 A$=STRING$(128,88):B$=STRING$(128,89):DSKO$0,0,2,A$,B$:PRINT\"WROTE HOME\":GOTO10\nRUN\n"
let test = try await MCPPlaytest.start(systemROM: system, diskROM: diskROM, disk: original,
bootCommands: program, projectID: "protected-" + cpu, revision: 1, artifactID: declaration.proof.artifactID!, cpu: cpu,
helperURL: helper, retentionDirectory: root, diskProvenance: declaration.proof, media: declaration.media, multiDrive: true)
defer { test.invalidate() }
_ = try await test.pausePlaytest()
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id": test.runID, "request_id": "protect", "action": "insert",
"media_id": declaration.media[0].id, "media_sha256": declaration.media[0].baseSHA256, "write_protected": true])
_ = try await test.continuePlaytest()
_ = try await test.reply("playtest_input", arguments: ["run_id": test.runID, "request_id": "protected-write",
"steps": [["keys": ["r"], "fields": 18], ["keys": [], "fields": 180]]])
_ = try await test.pausePlaytest()
let refused = try await test.capture()
let rows = try XCTUnwrap(refused["drives"] as? [[String: Any]])
XCTAssertEqual(rows[0]["disk_sha256"] as? String, declaration.media[0].baseSHA256)
XCTAssertEqual(rows[0]["disk_writes"] as? Int, 0)
XCTAssertTrue((refused["screen_text"] as? String ?? "").contains("WP ERROR"), refused["screen_text"] as? String ?? "")
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id": test.runID, "request_id": "unprotect", "action": "insert", "drive": 0,
"media_id": declaration.media[0].id, "media_sha256": declaration.media[0].baseSHA256, "write_protected": false])
_ = try await test.reply("restart_playtest", arguments: ["run_id": test.runID, "request_id": "restart"])
_ = try await test.reply("playtest_input", arguments: ["run_id": test.runID, "request_id": "writable-write",
"steps": [["keys": ["r"], "fields": 18], ["keys": [], "fields": 240]]])
_ = try await test.pausePlaytest()
let written = try await test.capture()
let writtenRows = try XCTUnwrap(written["drives"] as? [[String: Any]])
XCTAssertGreaterThan(writtenRows[0]["disk_writes"] as? Int ?? 0, 0)
XCTAssertNotEqual(writtenRows[0]["disk_sha256"] as? String, declaration.media[0].baseSHA256)
XCTAssertTrue((written["screen_text"] as? String ?? "").contains("WROTE HOME"))
_ = try await test.reply("stop_playtest", arguments: ["run_id": test.runID, "request_id": "stop"])
}
}
func testMultiDriveExchangeChecksSharedControllerAndMalformedDriveBeforeMutation() async throws {
let (helper, system, diskROM) = try inputs()
for cpu in ["6809", "6309"] {
let worker = try MediaWorkerClient(helper); defer { worker.close() }
// Real guest selects FD0 and starts a read with motor disabled;
// even an otherwise empty FD3 must refuse its own exchange.
let commands = try CocoPaste("POKE65344,1:POKE65352,128\n", mode: .text)
_ = try await worker.request(["op": "init", "system_rom": system.base64EncodedString(), "disk_rom": diskROM.base64EncodedString(),
"disk": disk().base64EncodedString(), "boot_keys": commands.chords.map { NSNumber(value: $0) }, "cpu": cpu, "multi_drive": true])
_ = try await worker.request(["op": "pause"])
let before = try await worker.request(["op": "media_status"])
XCTAssertEqual(before["floppy_busy"] as? Bool, true)
for drive: Any in [true, 1.25, -1, 4] {
await expectDiskFailure {
_ = try await worker.request(["op": "exchange_media", "drive": drive, "expected_media_generation": 0, "expected_disk_sha256": ""])
}
}
do {
_ = try await worker.request(["op": "exchange_media", "drive": 3, "expected_media_generation": 0, "expected_disk_sha256": ""])
XCTFail("A pending FD0 command must block FD3 replacement")
} catch { XCTAssertTrue(error.localizedDescription.contains("playtest_media_busy")) }
let after = try await worker.request(["op": "media_status"])
XCTAssertEqual(before["drives"] as? NSArray, after["drives"] as? NSArray)
for key in ["field_clock", "cycles", "generation", "pc", "boot"] { XCTAssertEqual(before[key] as? NSNumber, after[key] as? NSNumber) }
let frozen = try await worker.request(["op": "stop"])
XCTAssertEqual(frozen["media_frozen"] as? Bool, true)
for drive in 0..<4 { _ = try await worker.request(["op": "export_media", "drive": drive]) }
_ = try await worker.request(["op": "finish_stop"])
}
}
/// These are bounded negative protocol fixtures, not emulator evidence.
/// Actual guest I/O is covered by the independent both-CPU tests above.
private func faultingMultiDriveHelper(_ mode: String, root: URL) throws -> URL {
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true, attributes: [.posixPermissions: 0o700])
let path = root.appendingPathComponent("multi-wire-fixture")
let source = """
#!/usr/bin/env python3
import sys,json,base64,hashlib,os
mode=\(String(reflecting: mode))
disks=[None]*4; ids=[None]*4; gens=[0]*4; protections=[False]*4; originals=['']*4
cpu='6809'; frozen=False; failed_export=False
def digest(data): return hashlib.sha256(data).hexdigest() if data else ''
def row(drive):
data=disks[drive]
return {'drive':drive,'label':'FD'+str(drive),'inserted':data is not None,'disk_present':data is not None,
'media_id':ids[drive],'disk_original_sha256':originals[drive],'disk_sha256':digest(data),
'media_generation':gens[drive],'byte_count':len(data) if data else 0,'disk_dirty':False,
'write_protected':protections[drive],'disk_reads':0,'disk_writes':0,'mount_read_bytes':0,'mount_write_bytes':0}
def status():
first=row(0)
return {'cpu':cpu,'processor':'HD6309' if cpu=='6309' else 'MC6809','state':'paused',
'media_id':first['media_id'],'disk_present':first['disk_present'],'disk_sha256':first['disk_sha256'],
'disk_original_sha256':first['disk_original_sha256'],'media_generation':gens[0],
'disk_dirty':False,'floppy_busy':False,'field_clock':0,'cycles':100,'generation':1,'boot':1,'pc':100,
'drives':[row(d) for d in range(4)]}
for line in sys.stdin:
r=json.loads(line); op=r['op']; end=False
with open(os.path.join(os.path.dirname(__file__),'trace.jsonl'),'a') as trace: trace.write(json.dumps(r)+'\\n')
if op=='init':
disks[0]=base64.b64decode(r['disk']); ids[0]=r['media_id']; cpu=r['cpu']; originals[0]=digest(disks[0]); out=status()
elif op=='export_media':
drive=r['drive']
if mode=='partial-stop' and frozen and drive==2 and not os.path.exists(os.path.join(os.path.dirname(__file__),'retry')):
print(json.dumps({'error':'fixture_partial_drain'}),flush=True); continue
out=status(); out['exported_drive']=row(drive)
if disks[drive] is not None: out['disk_base64']=base64.b64encode(disks[drive]).decode()
if mode=='wrong-target' and not frozen and drive==1 and not failed_export:
out['exported_drive']['media_id']='foreign'; failed_export=True
elif op in ('media_status','capture','pause'): out=status()
elif op=='exchange_media':
drive=r['drive']; old=digest(disks[drive]); ids[drive]=r.get('media_id')
disks[drive]=base64.b64decode(r['disk_base64']) if ids[drive] else None
protections[drive]=r.get('write_protected',False); originals[drive]=digest(disks[drive]); gens[drive]+=1
if mode=='exit-after-commit': os._exit(0)
if mode=='mark-after-commit':
with open(os.path.join(os.path.dirname(__file__),'committed'),'w') as marker: marker.write('committed')
out=status(); out['previous_disk_sha256']=old; out['target_drive']=drive
elif op=='stop':
frozen=True; out=status(); out['media_frozen']=True
elif op=='finish_stop': out=status(); end=True
else:
print(json.dumps({'error':'unexpected_operation'}),flush=True); continue
print(json.dumps({'result':out}),flush=True)
if end: break
"""
try Data(source.utf8).write(to: path)
try FileManager.default.setAttributes([.posixPermissions: 0o700], ofItemAtPath: path.path)
return path
}
func testMultiDriveLostCommitRetainsAllFrozenCopiesAndMarksOnlyTargetUncertain() async throws {
let root = FileManager.default.temporaryDirectory.appendingPathComponent("VCCMultiLostReply-" + UUID().uuidString)
defer { try? FileManager.default.removeItem(at: root) }
let helper = try faultingMultiDriveHelper("exit-after-commit", root: root)
let original = disk(); var data = disk(); data[0] = 93
let declaration = declaredMedia(artifact: UUID().uuidString, project: "multi-lost", primary: original, world: data)
let test = try await MCPPlaytest.start(systemROM: Data(repeating: 0, count: 32768), diskROM: Data(repeating: 0, count: 8192), disk: original,
bootCommands: "PRINT1\n", projectID: "multi-lost", revision: 1, artifactID: declaration.proof.artifactID!, helperURL: helper,
retentionDirectory: root.appendingPathComponent("retained"), diskProvenance: declaration.proof, media: declaration.media, multiDrive: true)
await expectDiskFailure {
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id": test.runID,"request_id":"lost","action":"insert","drive":1,
"media_id":declaration.media[1].id,"media_sha256":declaration.media[1].baseSHA256])
}
await test.invalidate().value
let receipt = try XCTUnwrap(test.finalReceipt)
XCTAssertEqual(receipt["media_selection_uncertain"] as? Bool, true)
XCTAssertEqual(receipt["uncertain_drives"] as? [Int], [1])
let drives = try XCTUnwrap(receipt["drives"] as? [[String: Any]])
XCTAssertEqual(drives[0]["media_id"] as? String, declaration.media[0].id)
XCTAssertTrue(drives[1]["media_id"] is NSNull)
let retained = try XCTUnwrap(receipt["retained_media"] as? [[String: Any]])
XCTAssertEqual(retained.count, 2)
for medium in declaration.media {
let row = try XCTUnwrap(retained.first { $0["media_id"] as? String == medium.id })
XCTAssertEqual(row["disk_sha256"] as? String, medium.baseSHA256)
}
}
func testMultiDrivePartialDrainRetriesWithoutASecondStopOrRepeatedEarlierExport() async throws {
let root = FileManager.default.temporaryDirectory.appendingPathComponent("VCCMultiPartialDrain-" + UUID().uuidString)
defer { try? FileManager.default.removeItem(at: root) }
let helper = try faultingMultiDriveHelper("partial-stop", root: root)
let original = disk(), declaration = declaredMedia(artifact: UUID().uuidString, project: "multi-partial", primary: original, world: original)
let test = try await MCPPlaytest.start(systemROM: Data(repeating: 0, count: 32768), diskROM: Data(repeating: 0, count: 8192), disk: original,
bootCommands: "PRINT1\n", projectID: "multi-partial", revision: 1, artifactID: declaration.proof.artifactID!, helperURL: helper,
retentionDirectory: root.appendingPathComponent("retained"), diskProvenance: declaration.proof, media: declaration.media, multiDrive: true)
defer { test.invalidate() }
let stop: [String: Any] = ["run_id":test.runID,"request_id":"stop"]
await expectDiskFailure { _ = try await test.reply("stop_playtest", arguments: stop) }
XCTAssertNotNil(test.retentionError)
try Data("retry".utf8).write(to: root.appendingPathComponent("retry"))
let stopped = try await test.reply("stop_playtest", arguments: stop)
XCTAssertEqual(stopped["disk_retained"] as? Bool, true)
let trace = try String(contentsOf: root.appendingPathComponent("trace.jsonl"), encoding: .utf8).split(separator:"\n").map {
try XCTUnwrap(JSONSerialization.jsonObject(with: Data($0.utf8)) as? [String: Any])
}
XCTAssertEqual(trace.filter { $0["op"] as? String == "stop" }.count, 1)
for drive in 0...1 { XCTAssertEqual(trace.filter { $0["op"] as? String == "export_media" && $0["drive"] as? Int == drive }.count, 1) }
XCTAssertEqual(trace.filter { $0["op"] as? String == "export_media" && $0["drive"] as? Int == 2 }.count, 2)
}
func testMultiDriveWrongExportTargetCannotPoisonAnotherMedium() async throws {
let root = FileManager.default.temporaryDirectory.appendingPathComponent("VCCMultiWrongExport-" + UUID().uuidString)
defer { try? FileManager.default.removeItem(at: root) }
let helper = try faultingMultiDriveHelper("wrong-target", root: root)
let original = disk(); var data = disk(); data[0] = 95
let declaration = declaredMedia(artifact: UUID().uuidString, project: "multi-wrong", primary: original, world: data)
let store = root.appendingPathComponent("retained")
let test = try await MCPPlaytest.start(systemROM: Data(repeating: 0, count: 32768), diskROM: Data(repeating: 0, count: 8192), disk: original,
bootCommands: "PRINT1\n", projectID: "multi-wrong", revision: 1, artifactID: declaration.proof.artifactID!, helperURL: helper,
retentionDirectory: store, diskProvenance: declaration.proof, media: declaration.media, multiDrive: true)
defer { test.invalidate() }
await expectDiskFailure {
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id":test.runID,"request_id":"wrong","action":"insert","drive":1,
"media_id":declaration.media[1].id,"media_sha256":declaration.media[1].baseSHA256])
}
let stopped = try await test.reply("stop_playtest", arguments: ["run_id":test.runID,"request_id":"stop"])
let records = try XCTUnwrap(stopped["retained_media"] as? [[String: Any]])
for medium in declaration.media {
let record = try XCTUnwrap(records.first { $0["media_id"] as? String == medium.id })
let id = try XCTUnwrap(record["retained_disk_id"] as? String)
XCTAssertEqual(try Data(contentsOf: MCPPlaytestDiskStore.diskURL(directory: store,id:id)), medium.data)
}
}
func testMultiDriveRechecksRetainedOutgoingBytesBeforeAnotherReplacement() async throws {
let root = FileManager.default.temporaryDirectory.appendingPathComponent("VCCMultiRetentionEvidence-" + UUID().uuidString)
defer { try? FileManager.default.removeItem(at: root) }
let helper = try faultingMultiDriveHelper("normal", root: root)
let original = disk(); var data = disk(); data[0] = 97
let declaration = declaredMedia(artifact: UUID().uuidString, project: "multi-retained-evidence", primary: original, world: data)
let store = root.appendingPathComponent("retained")
let test = try await MCPPlaytest.start(systemROM: Data(repeating: 0, count: 32768), diskROM: Data(repeating: 0, count: 8192), disk: original,
bootCommands: "PRINT1\n", projectID: "multi-retained-evidence", revision: 1, artifactID: declaration.proof.artifactID!, helperURL: helper,
retentionDirectory: store, diskProvenance: declaration.proof, media: declaration.media, multiDrive: true)
defer { test.invalidate() }
let eject = try await test.reply("exchange_playtest_media", arguments: ["run_id":test.runID,"request_id":"eject","action":"eject"])
let previous = try XCTUnwrap(eject["previous_media"] as? [String: Any])
let retained = try XCTUnwrap(previous["retained_disk"] as? [String: Any])
let retainedID = try XCTUnwrap(retained["retained_disk_id"] as? String)
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id":test.runID,"request_id":"restore","action":"insert",
"media_id":declaration.media[0].id,"media_sha256":declaration.media[0].baseSHA256])
let url = try MCPPlaytestDiskStore.diskURL(directory: store,id:retainedID)
try data.write(to: url)
await expectDiskFailure {
_ = try await test.reply("exchange_playtest_media", arguments: ["run_id":test.runID,"request_id":"changed-evidence","action":"insert",
"media_id":declaration.media[1].id,"media_sha256":declaration.media[1].baseSHA256])
}
let unchanged = try await test.capture()
XCTAssertEqual(unchanged["media_id"] as? String, declaration.media[0].id)
XCTAssertEqual(unchanged["disk_sha256"] as? String, declaration.media[0].baseSHA256)
XCTAssertEqual(try Data(contentsOf:url), data, "The failed swap must not silently repair changed retention evidence")
try original.write(to:url)
_ = try await test.reply("stop_playtest", arguments:["run_id":test.runID,"request_id":"stop"])
}
func testMultiDriveLateAuthorityLossPreservesAcknowledgedTargetReceipt() async throws {
let root = FileManager.default.temporaryDirectory.appendingPathComponent("VCCMultiLateAuthority-" + UUID().uuidString)
defer { try? FileManager.default.removeItem(at: root) }
let helper = try faultingMultiDriveHelper("mark-after-commit", root:root)
let original = disk(); var data = disk(); data[0] = 99
let declaration = declaredMedia(artifact: UUID().uuidString, project:"multi-late-authority", primary:original,world:data)
let test = try await MCPPlaytest.start(systemROM:Data(repeating:0,count:32768),diskROM:Data(repeating:0,count:8192),disk:original,
bootCommands:"PRINT1\n",projectID:"multi-late-authority",revision:1,artifactID:declaration.proof.artifactID!,helperURL:helper,
retentionDirectory:root.appendingPathComponent("retained"),diskProvenance:declaration.proof,media:declaration.media,multiDrive:true)
defer { test.invalidate() }
let request: [String:Any] = ["run_id":test.runID,"request_id":"commit","action":"insert","drive":1,"write_protected":true,
"media_id":declaration.media[1].id,"media_sha256":declaration.media[1].baseSHA256]
do {
_ = try await test.reply("exchange_playtest_media",arguments:request,isCurrent:{ !FileManager.default.fileExists(atPath:root.appendingPathComponent("committed").path) })
XCTFail("A committed exchange cannot return through expired authority")
} catch { XCTAssertTrue(error.localizedDescription.contains("stale_run_after_commit")) }
let acknowledged = try await test.reply("exchange_playtest_media",arguments:request)
XCTAssertEqual(acknowledged["target_drive"] as? Int,1)
let rows = try XCTUnwrap(acknowledged["drives"] as? [[String:Any]])
XCTAssertEqual(rows[1]["media_id"] as? String,declaration.media[1].id)
XCTAssertEqual(rows[1]["media_generation"] as? Int,1)
XCTAssertEqual(rows[1]["write_protected"] as? Bool,true)
let stopped = try await test.reply("stop_playtest",arguments:["run_id":test.runID,"request_id":"stop"])
let records = try XCTUnwrap(stopped["retained_media"] as? [[String:Any]])
XCTAssertEqual(records.first { $0["media_id"] as? String == declaration.media[1].id }?["write_protected"] as? Bool,true)
}
private func declaredMedia(artifact: String, project: String, primary: Data, world: Data)
-> (key: String, proof: MCPPlaytestDiskStore.Provenance, media: [MCPPlaytestMedium]) {
let key = CMOCProject.sha256(Data(project.utf8)), primaryHash = CMOCProject.sha256(primary)
@@ -220,7 +220,7 @@ final class SoftwareLibraryCuratedLaunchTests: XCTestCase {
@MainActor func testRealDOSStartupLoadsAuthoredHelloDiskOnBothCPUs() async throws {
let fixture = try Fixture(); defer { fixture.cleanup() }
let mac = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()
let tools = mac.appendingPathComponent("LocalResources/ToolchainBundle")
let tools = vccQualificationToolchain(mac.appendingPathComponent("LocalResources/ToolchainBundle"))
try XCTSkipUnless(FileManager.default.isExecutableFile(atPath: tools.appendingPathComponent("bin/cmoc").path), "Stage optional bundled tools")
_ = try fixture.initialProfile(realROMs: true)
let template = mac.deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("examples/cmoc/HelloDisk")
@@ -27,6 +27,32 @@ final class SoftwareLibraryPublishedGameTests: XCTestCase {
diskSHA256: "d05ab25fd90171b048cce54f3af18ca6d0bd81335e138044ff05315e99cbf582", ramKiB: 128, keyboardOnly: false)
]
}
/// These are candidate source-rebuild identities, not publication receipts.
/// Independently replayed in owned folders with the pinned unsigned development
/// runtime; this is not execution of the Developer ID-signed packaged compiler.
private struct CandidateSourceBaseline: Sendable {
let sourceZIP: String
let makefile: String
let binary: String
let disk: String
static let runtimeManifest = "a4dd934aed84a0b139e1d88b8a607d52ff7f6fc66c3bd3be30db7fd5d40dcbef"
static let compiler = "5769c5ffe14f0adad61c41aa72337261acc6fd882e7e6656bdcf350b414930a1"
static let wrapper = "b83e6ea79da5160cd85f5b7665524f19f717a4a6e76e12e661900dc071a1cea6"
static let reviewed: [String: Self] = [
"bone-quest": .init(sourceZIP: "99f9770965f9d2061f764ebe704da95f7f037a42c5df21a959b558b25d704da6",
makefile: "b0e9816d4b1712cd903b1e51ebb5c80901fb45ba4233f6b091e6e97fe5cdd1d7",
binary: "f57e5818d070009cb2713fe4d70f8f0cba2bd2e5c54833d4911348a708bdb0f0",
disk: "8614c31b92a5f3b70b7b35792414b7fd43042614de2bda4b6ff508711f157a8d"),
"capital-quest": .init(sourceZIP: "5f0cbc6ad58594a1c21a77079b2db4a2862546b6f701c2d515fe04f9727568f3",
makefile: "880c46b17747ed0cbe33c386b21f319b9e453ab64cab185bd7f802293226a886",
binary: "9b2fe10ebca6c515d3cb45f649ea772058be4186b8abac3fec95c3b69d955e6b",
disk: "28a07495e1afa5702fd7c9def0aa2c94d8671ec6cfd6de2c57d5b92b4aa0c930"),
"quadrapassel": .init(sourceZIP: "710c8e1e9d6cfbd800d5719e30ad2057aa9bade8c81f8d1e5374634b4d208438",
makefile: "70144a013bdf2ad4c7ea996b53a1d304d7f440236d91f22fc7e63481fb258a92",
binary: "4893e44f7ba33c3fa3b8f8268588104038dd402fae7cd3dcdbeeca11aa3e6df5",
disk: "49e931b0530214d9cdb2afd4f5a1f3819695b3267e70fec04dcc69f86fc5ce9f")
]
}
private struct Game: Sendable {
let fixture: Fixture
let publicationID: String
@@ -148,7 +174,7 @@ final class SoftwareLibraryPublishedGameTests: XCTestCase {
}
throw ProfileFailure.message("Published-game fixture did not settle")
}
@MainActor private func withMachine(output: URL, use6309: Bool,
@MainActor private func withMachine(output: URL, use6309: Bool, startingMachine: MachineSettings? = nil,
body: (MachineModel, VCCMachineController, UserDefaults) async throws -> Void) async throws {
_ = NSApplication.shared // Standalone hostless runs still need AppKit's input lifecycle.
let suite = "PublishedGame-" + UUID().uuidString
@@ -166,6 +192,7 @@ final class SoftwareLibraryPublishedGameTests: XCTestCase {
&& FileManager.default.fileExists(atPath: profile.media.rom!.path), "Stage explicit local CoCo/Disk BASIC ROM inputs")
profile.sound = false; profile.videoOutput = 0
profile.machine.ram = 2; profile.machine.use6309 = !use6309
if let startingMachine { profile.machine = startingMachine }
profile.input.right.source = .keyboard; profile.input.left.source = .none
var cartridges = CartridgeAssignments(); cartridges.multiPak = true; cartridges.mpiConfigured = true
cartridges.physicalSlot = 4; cartridges.slots[4].kind = .floppy; profile.media.cartridges = cartridges
@@ -209,6 +236,32 @@ final class SoftwareLibraryPublishedGameTests: XCTestCase {
guard made else { throw ProfileFailure.message("Published acceptance image could not be rendered") }
rgba = pixels
}
func changedPixelFraction(comparedTo before: Raster) -> Double {
guard width == before.width, height == before.height else { return 1 }
var changed = 0
for offset in stride(from: 0, to: rgba.count, by: 4) {
if (0..<3).contains(where: { abs(Int(rgba[offset + $0]) - Int(before.rgba[offset + $0])) > 28 }) { changed += 1 }
}
return Double(changed) / Double(width * height)
}
/// Compare only authored, static PLAY UI in the 320x192 reference.
/// Coordinates map through the captured active picture, never full-frame
/// borders. Black background, pieces, preview tiles and numbers are omitted.
func staticForegroundMatch(to reference: Raster, regions: [CGRect]) -> (score: Double, pixels: Int, matched: Int) {
var foreground = 0, matched = 0
for region in regions {
guard region.minX >= 0, region.minY >= 0,
region.maxX <= CGFloat(reference.width), region.maxY <= CGFloat(reference.height) else { return (0, 0, 0) }
for y in Int(region.minY)..<Int(region.maxY) { for x in Int(region.minX)..<Int(region.maxX) {
let r = (y * reference.width + x) * 4
if (0..<3).allSatisfy({ reference.rgba[r + $0] <= 28 }) { continue }
foreground += 1
let a = ((y * height / reference.height) * width + x * width / reference.width) * 4
if (0..<3).allSatisfy({ abs(Int(rgba[a + $0]) - Int(reference.rgba[r + $0])) <= 28 }) { matched += 1 }
} }
}
return (foreground > 100 ? Double(matched) / Double(foreground) : 0, foreground, matched)
}
func similarity(to reference: Raster) -> Double {
var histogram: [UInt32: Int] = [:]
for index in stride(from: 0, to: reference.rgba.count, by: 4) {
@@ -325,6 +378,257 @@ final class SoftwareLibraryPublishedGameTests: XCTestCase {
XCTAssertEqual(afterBuild.logicalMemory, before.logicalMemory)
return report
}
@MainActor private func startCandidateDOS(_ model: MachineModel, controller: VCCMachineController) async throws {
// Native owned-media qualification observes the core's readiness only.
// The shared-program MCP screen surface intentionally rejects writable
// disks; it is not the permission path for this disposable native session.
// Visible OK precedes BASIC's direct-input loop, so require both actual
// direct input and a stable final OK on mature guest fields before typing.
let initial = await step(controller.snapshot)
guard initial.errorMessage == nil else {
throw ProfileFailure.message(initial.errorMessage ?? "Candidate Disk BASIC startup failed")
}
var ready = false, readyObservations = 0
var firstReadyField: UInt64?
var lastText = "(unavailable)"
var last = initial
let deadline = ContinuousClock.now.advanced(by: .seconds(15))
while ContinuousClock.now < deadline {
let readiness = await step(controller.assistantReadiness)
let (text, snapshot): (String?, VCCMachineSnapshot) = await withCheckedContinuation { done in
controller.inspectScreenText { done.resume(returning: ($0, $1)) }
}
last = snapshot; lastText = text ?? "(unavailable)"
guard readiness.errorMessage == nil, snapshot.errorMessage == nil,
readiness.state == .running, snapshot.state == .running,
readiness.generation == initial.generation, snapshot.generation == initial.generation else {
throw ProfileFailure.message(snapshot.errorMessage ?? readiness.errorMessage ?? "Candidate Disk BASIC changed during startup readiness checks")
}
let lines = (text ?? "").split(separator: "\n").map { $0.trimmingCharacters(in: .whitespaces) }.filter { !$0.isEmpty }
guard !lines.contains(where: { $0.hasPrefix("?") }) else {
throw ProfileFailure.message("Candidate Disk BASIC reported an error before DOS; no command was sent")
}
if readiness.assistantDirectPrompt?.boolValue == true,
readiness.assistantEmptyBASIC?.boolValue == true,
lines.last == "OK", readiness.pasteRemaining == 0, snapshot.pasteRemaining == 0 {
readyObservations += 1
if firstReadyField == nil { firstReadyField = readiness.frames }
if readyObservations >= 2, let firstReadyField, readiness.frames >= firstReadyField + 6 {
ready = true; break
}
} else { readyObservations = 0; firstReadyField = nil }
try await Task.sleep(for: .milliseconds(100))
}
guard ready else {
throw ProfileFailure.message("Candidate disk did not reach stable native direct Disk BASIC readiness; no command was sent. Screen: " + lastText +
String(format: " PC %04X, frame %llu.", last.programCounter, last.frames))
}
try await settle(model)
guard model.canPaste else { throw ProfileFailure.message("Candidate Disk BASIC was not ready for ordinary keyboard input") }
model.startPaste(try CocoPaste("DOS\n", mode: .text))
try await settle(model)
}
/// The published-binary test below deliberately retains its original hash
/// contract. This separate opt-in checks the reviewed compiler's different
/// outputs and actually boots those outputs, never a substituted old disk.
@MainActor func testReviewedCMOC101SourceRebuildsBootAndRespondOnBothGuestCPUs() async throws {
guard let path = ProcessInfo.processInfo.environment["VCC_TEST_TOOLCHAIN_DIR"] else {
throw XCTSkip("Set the pinned unsigned development toolchain and private published-game fixture inputs for current-compiler qualification")
}
guard path.hasPrefix("/") else { throw ProfileFailure.message("Candidate compiler qualification requires an absolute runtime path") }
let toolchain = URL(fileURLWithPath: path)
let manifestData = try Data(contentsOf: toolchain.appendingPathComponent("manifest.json"))
let compilerData = try Data(contentsOf: toolchain.appendingPathComponent("libexec/cmoc"))
let wrapperData = try Data(contentsOf: toolchain.appendingPathComponent("bin/cmoc"))
guard Self.sha(manifestData) == CandidateSourceBaseline.runtimeManifest,
Self.sha(compilerData) == CandidateSourceBaseline.compiler,
Self.sha(wrapperData) == CandidateSourceBaseline.wrapper else {
throw ProfileFailure.message("Unknown candidate compiler/runtime identity: independently review and qualify new rebuild baselines before accepting these bytes")
}
let inputs = try await inputs()
var results: [[String: Any]] = []
for game in inputs.games {
guard let expected = CandidateSourceBaseline.reviewed[game.slug],
game.owned.source.package.sha256 == expected.sourceZIP else {
throw ProfileFailure.message("The published source package has no reviewed candidate rebuild baseline")
}
let gameOutput = inputs.output.appendingPathComponent(game.slug)
try FileManager.default.createDirectory(at: gameOutput, withIntermediateDirectories: true)
let importer = SoftwareLibrarySourceImporter(cacheDirectory: gameOutput.appendingPathComponent("Candidate source originals"))
let imported = try await importer.importProject(game.owned.source, to: gameOutput.appendingPathComponent("Candidate Source With Spaces"))
guard Self.sha(try Data(contentsOf: imported.originalPackage)) == expected.sourceZIP else {
throw ProfileFailure.message("Candidate source archive differs from the reviewed immutable package")
}
let project = try CMOCProject.open(at: imported.projectDirectory)
let originalInputs = try project.inputFiles()
let originalMakefile = try Data(contentsOf: project.makefileURL)
guard Self.sha(originalMakefile) == expected.makefile else {
throw ProfileFailure.message("Candidate source Makefile differs from the reviewed unmodified recipe")
}
let build = try await CMOCBuildService(toolchain: toolchain, buildRoot: gameOutput.appendingPathComponent("Candidate source qualification"))
.build(project: project, overlays: [:], action: .disk, configuration: "Release")
let disk = try Data(contentsOf: XCTUnwrap(build.diskURL))
guard Self.sha(build.binaryData) == expected.binary, build.diskSHA256 == expected.disk,
Self.sha(disk) == expected.disk else {
throw ProfileFailure.message("Candidate compiler output differs from the independently replayed exact BIN/DSK baseline")
}
XCTAssertEqual(build.configurationName, "Release")
XCTAssertEqual(try project.inputFiles(), originalInputs, "Candidate compilation must preserve every imported input")
XCTAssertEqual(try Data(contentsOf: project.makefileURL), originalMakefile)
let hero = try artwork(game.record["artwork"]["hero"], id: game.slug + "-candidate-title")
let referenceData = try await SoftwareLibraryArtworkCache().thumbnail(for: hero, directory: gameOutput.appendingPathComponent("Artwork"))
let reference = try Raster(referenceData)
let gameplayReferenceSHA = "dd6c5b0e02e3a7c995056a436a4379ab617c7a0c60ddf246ad5ac9163e5239b8"
// Source-authored stable captions and all four well borders only.
// Exclude board cells, NEXT/HOLD previews and changing score values.
let gameplayStaticRegions: [CGRect] = [
CGRect(x: 32, y: 0, width: 168, height: 8),
CGRect(x: 32, y: 32, width: 40, height: 8),
CGRect(x: 32, y: 64, width: 40, height: 8),
CGRect(x: 32, y: 96, width: 40, height: 8),
CGRect(x: 216, y: 24, width: 32, height: 8),
CGRect(x: 216, y: 80, width: 32, height: 8),
CGRect(x: 32, y: 144, width: 48, height: 8),
CGRect(x: 32, y: 168, width: 72, height: 8),
CGRect(x: 118, y: 22, width: 84, height: 2),
CGRect(x: 118, y: 184, width: 84, height: 2),
CGRect(x: 118, y: 24, width: 2, height: 160),
CGRect(x: 200, y: 24, width: 2, height: 160)
]
let gameplayReference: Raster?
if game.slug == "quadrapassel" {
let gameplayData = try Data(contentsOf: imported.projectDirectory.appendingPathComponent("docs/manual/images/gameplay.png"))
guard Self.sha(gameplayData) == gameplayReferenceSHA else {
throw ProfileFailure.message("The source-authored Quadrapassel PLAY reference changed; review it before accepting gameplay qualification")
}
let raster = try Raster(gameplayData)
guard raster.width == 320, raster.height == 192 else {
throw ProfileFailure.message("The reviewed Quadrapassel PLAY reference must use its authored 320x192 coordinates")
}
gameplayReference = raster
} else { gameplayReference = nil }
for use6309 in [false, true] {
let output = gameOutput.appendingPathComponent(use6309 ? "candidate-6309" : "candidate-6809")
try FileManager.default.createDirectory(at: output, withIntermediateDirectories: true)
let working = output.appendingPathComponent("CandidateWorking.DSK")
try disk.write(to: working, options: .withoutOverwriting)
var settings = MachineSettings()
settings.use6309 = use6309; settings.ram = game.fixture.ramKiB == 128 ? 0 : 1
try await withMachine(output: output, use6309: use6309, startingMachine: settings) { model, controller, _ in
try await model.insertDiskFromMedia(working, drive: 0, execution: .run, reset: .coldRestart)
try await startCandidateDOS(model, controller: controller)
let (first, titleSimilarity) = try await waitForTitle(reference: reference, controller: controller,
output: output.appendingPathComponent("candidate-first-title.png"))
XCTAssertEqual(first.use6309, use6309)
XCTAssertEqual(first.ramConfiguration, UInt(settings.ram))
XCTAssertEqual(first.videoOutput, 0); XCTAssertTrue(first.disks[0].mounted)
XCTAssertFalse(first.debuggerDevelopmentAttached)
XCTAssertNil(first.errorMessage)
XCTAssertEqual(first.cpuOverclock, 1); XCTAssertEqual(first.frameInterval, 1); XCTAssertFalse(first.fastForward)
// An idle title must remain recognizable before ordinary input.
// A cursor blink or an animated tile alone cannot qualify a start.
try await Task.sleep(nanoseconds: 500_000_000)
let idle = await step(controller.snapshot)
let titleArea = reference.width == 640 && reference.height == 480 ? VideoGeometry.fullFrame : idle.activeVideoRect
let idleRaster = try Raster(ScreenCapture(pixels: idle.pixels, area: titleArea).png())
let idleTitleSimilarity = idleRaster.similarity(to: reference)
guard idle.state == .running, idle.generation == first.generation, idle.errorMessage == nil,
idleTitleSimilarity >= 0.95 else {
throw ProfileFailure.message("Candidate title changed before start input; inspect the idle scene before accepting a transition")
}
let beforePixels = try ScreenCapture(pixels: first.pixels, area: VideoGeometry.fullFrame).png()
let before = try Raster(beforePixels)
let key = game.slug == "quadrapassel" ? " " : "1"
var keyboard = CocoKeyboard()
keyboard.press(code: game.slug == "quadrapassel" ? 49 : 18, characters: key)
let mask = keyboard.mask
XCTAssertNotEqual(mask, 0)
controller.setKeyboardMask(mask)
try await Task.sleep(nanoseconds: 200_000_000)
controller.setKeyboardMask(0)
var progress: (VCCMachineSnapshot, Data, Double, Double)?
var gameplayProof: (score: Double, pixels: Int, matched: Int)?
var changedFrames = 0
for _ in 0..<80 {
try await Task.sleep(nanoseconds: 100_000_000)
let snapshot = await step(controller.snapshot)
guard snapshot.state == .running, snapshot.generation == first.generation,
snapshot.frames > idle.frames + 4, snapshot.pasteRemaining == 0, snapshot.errorMessage == nil else { continue }
let png = try ScreenCapture(pixels: snapshot.pixels, area: VideoGeometry.fullFrame).png()
let difference = try Raster(png).changedPixelFraction(comparedTo: before)
let sceneArea = reference.width == 640 && reference.height == 480 ? VideoGeometry.fullFrame : snapshot.activeVideoRect
let scene = try Raster(ScreenCapture(pixels: snapshot.pixels, area: sceneArea).png())
let titleSimilarity = scene.similarity(to: reference)
let staticMatch: (score: Double, pixels: Int, matched: Int)?
if let gameplayReference {
let activeScene = try Raster(ScreenCapture(pixels: snapshot.pixels, area: snapshot.activeVideoRect).png())
staticMatch = activeScene.staticForegroundMatch(to: gameplayReference, regions: gameplayStaticRegions)
} else { staticMatch = nil }
let gameplayReady = staticMatch.map { $0.score >= 0.95 && $0.pixels > 100 } ?? true
changedFrames = difference >= 0.005 && titleSimilarity < 0.90 && gameplayReady ? changedFrames + 1 : 0
if changedFrames >= 2 {
progress = (snapshot, png, difference, titleSimilarity); gameplayProof = staticMatch; break
}
}
guard let progress else { throw ProfileFailure.message("Candidate-built game did not leave its stable title scene after normal start input") }
let (guestText, inspected): (String?, VCCMachineSnapshot) = await withCheckedContinuation { done in
controller.inspectScreenText { done.resume(returning: ($0, $1)) }
}
XCTAssertNil(inspected.errorMessage)
XCTAssertEqual(inspected.generation, first.generation)
if let guestText {
let lines = guestText.uppercased().split(whereSeparator: \.isNewline).map { $0.trimmingCharacters(in: .whitespaces) }
guard !lines.contains(where: { $0 == "OK" || $0.hasPrefix("?") }) else {
throw ProfileFailure.message("Candidate start input returned to BASIC or an error prompt instead of remaining in the game")
}
}
XCTAssertEqual(progress.0.cpuOverclock, 1); XCTAssertEqual(progress.0.frameInterval, 1); XCTAssertFalse(progress.0.fastForward)
try progress.1.write(to: output.appendingPathComponent("candidate-after-start-key.png"), options: .atomic)
_ = await step(controller.pause); try await settle(model)
let retainedBeforeRestart = try await model.snapshotDiskCopy(inDrive: 0)
model.reset(); try await settle(model); model.resume(); try await settle(model)
let retainedAfterRestart = try await model.snapshotDiskCopy(inDrive: 0)
XCTAssertEqual(retainedAfterRestart, retainedBeforeRestart, "Cold restart must keep the owned working disk rather than replace it from a published package")
try await startCandidateDOS(model, controller: controller)
let (second, restartSimilarity) = try await waitForTitle(reference: reference, controller: controller,
output: output.appendingPathComponent("candidate-restarted-title.png"))
XCTAssertNotEqual(second.generation, first.generation)
XCTAssertEqual(second.use6309, use6309); XCTAssertEqual(second.ramConfiguration, UInt(settings.ram))
XCTAssertNil(second.errorMessage)
XCTAssertEqual(second.cpuOverclock, 1); XCTAssertEqual(second.frameInterval, 1); XCTAssertFalse(second.fastForward)
XCTAssertEqual(Self.sha(try Data(contentsOf: XCTUnwrap(build.diskURL))), expected.disk, "The frozen candidate artifact must not be the guest's writable copy")
var gameplayReceipt: [String: Any] = [:]
if let gameplayProof {
gameplayReceipt = ["gameplay_reference_sha256": gameplayReferenceSHA,
"gameplay_reference_size": [320, 192],
"gameplay_static_regions": gameplayStaticRegions.map { [Int($0.minX), Int($0.minY), Int($0.width), Int($0.height)] },
"gameplay_static_foreground_pixels": gameplayProof.pixels,
"gameplay_static_matched_pixels": gameplayProof.matched,
"gameplay_static_foreground_similarity": gameplayProof.score,
"gameplay_static_matching_observations": changedFrames]
}
results.append(["game": game.slug, "cpu": use6309 ? "6309" : "6809", "host_architecture": Self.architecture,
"source_zip_sha256": expected.sourceZIP, "makefile_sha256": expected.makefile,
"compiler_sha256": CandidateSourceBaseline.compiler, "runtime_manifest_sha256": CandidateSourceBaseline.runtimeManifest,
"runtime_kind": "pinned_unsigned_development_runtime", "packaged_compiler_execution": false,
"configuration": "Release", "candidate_binary_sha256": expected.binary, "candidate_disk_sha256": expected.disk,
"published_disk_sha256": game.fixture.diskSHA256, "candidate_is_published": false,
"ram_kib": game.fixture.ramKiB, "first_title_foreground_similarity": titleSimilarity,
"restart_title_foreground_similarity": restartSimilarity, "normal_start_key": key == " " ? "space" : key,
"idle_title_foreground_similarity": idleTitleSimilarity, "post_start_title_foreground_similarity": progress.3,
"stock_speed": true, "basic_or_error_prompt_after_start": false,
"visible_changed_pixel_fraction": progress.2, "normal_input_fields_advanced": progress.0.frames - first.frames,
"working_disk_preserved_across_restart": true,
"coverage": "Exact unsigned-development-runtime rebuild, normal DOS startup, rendered title, ordinary start-key title-to-game transition and cold restart; not packaged compiler execution or a full game playthrough"].merging(gameplayReceipt) { _, proof in proof })
try JSONSerialization.data(withJSONObject: results, options: [.prettyPrinted, .sortedKeys])
.write(to: inputs.output.appendingPathComponent("CandidateSourceAcceptance.json"), options: .atomic)
}
}
}
XCTAssertEqual(results.count, Fixture.approved.count * 2)
}
@MainActor func testPublishedFirstAndCachedPlaySourceAndManualAcceptance() async throws {
let inputs = try await inputs()
var results: [[String: Any]] = []
+26 -2
View File
@@ -53,6 +53,22 @@ static NSArray<NSDictionary *> *MCPProjectTools(BOOL assembly, BOOL interactive,
@{@"run_id":identifier, @"request_id":keyRequestID, @"keys":MCPGuestKeySchema(NO)}, NO)]];
}
// Destination permission is granted natively and never inferred from Make access.
static NSArray<NSDictionary *> *MCPBuildExportTools() {
NSDictionary *id = @{@"type":@"string",@"minLength":@1,@"maxLength":@128};
NSDictionary *properties = @{@"project_id":id,@"build_id":id,@"artifact_id":id,
@"revision":@{@"type":@"integer",@"minimum":@0},@"destination_id":id,@"request_id":id,
@"output_ids":@{@"type":@"array",@"items":id,@"minItems":@1,@"maxItems":@64,@"uniqueItems":@YES}};
return @[
@{@"name":@"export_build_outputs",@"description":@"Deliver selected exportable_outputs from an exact successful build to its natively approved destination_id. Supply the original build revision and artifact_id, including for an earlier Release after building Debug. Creates a new exclusive delivery set; never replaces files. Returns export_id/status immediately; poll get_build_export. Retry the identical request_id to reuse and verify the original delivery. Changed selections conflict; changed source/destination bytes fail. No paths or arbitrary workspace files are accepted. Limits: 64 files, 64 MiB/file, 128 MiB/set, 512 MiB and 64 requests per connection, one active export.",
@"inputSchema":@{@"type":@"object",@"properties":properties,@"required":[properties.allKeys sortedArrayUsingSelector:@selector(compare:)],@"additionalProperties":@NO},
@"annotations":@{@"readOnlyHint":@NO,@"openWorldHint":@NO}},
@{@"name":@"get_build_export",@"description":@"Poll one owned export_id. A completed receipt preserves original project/build/artifact/revision/configuration identities and reports delivered relative filenames, original sizes and SHA-256 hashes. Independently verify these bytes; an identical export retry verifies the existing delivery rather than silently repairing changes.",
@"inputSchema":@{@"type":@"object",@"properties":@{@"project_id":id,@"export_id":id},@"required":@[@"project_id",@"export_id"],@"additionalProperties":@NO},
@"annotations":@{@"readOnlyHint":@YES,@"openWorldHint":@NO}}
];
}
// Added only when the running app explicitly advertises project refresh.
static NSArray<NSDictionary *> *MCPProjectRefreshTools() {
NSDictionary *identifier = @{@"type":@"string", @"minLength":@1, @"maxLength":@128};
@@ -129,7 +145,7 @@ static NSArray<NSDictionary *> *MCPPlaytestCallContextTools() {
// Fresh reviewed media-aware C playtest grants only. The two insertion fields
// are action-specific in discovery as well as helper/host validation.
static NSArray<NSDictionary *> *MCPPlaytestMediaTools() {
static NSArray<NSDictionary *> *MCPPlaytestMediaTools(BOOL multiDrive = NO) {
NSDictionary *identifier = @{ @"type":@"string", @"minLength":@1, @"maxLength":@64 };
NSDictionary *mediaID = @{ @"type":@"string", @"minLength":@1, @"maxLength":@64,
@"pattern":@"^[A-Za-z0-9_-]{1,64}$", @"description":@"Opaque ID from list_playtest_media; never a host path." };
@@ -141,6 +157,14 @@ static NSArray<NSDictionary *> *MCPPlaytestMediaTools() {
@"action":@{ @"type":@"string", @"enum":@[ @"insert" ] }, @"media_id":mediaID, @"media_sha256":sha };
NSDictionary *ejectProperties = @{ @"run_id":identifier, @"request_id":identifier,
@"action":@{ @"type":@"string", @"enum":@[ @"eject" ] } };
if (multiDrive) {
NSDictionary *drive = @{@"type":@"integer",@"minimum":@0,@"maximum":@3,@"default":@0,
@"description":@"Target FD0–FD3. Omission means FD0; never wraps."};
NSMutableDictionary *insert = [insertProperties mutableCopy]; insert[@"drive"] = drive;
insert[@"write_protected"] = @{@"type":@"boolean",@"description":@"Optional owned-copy write protection. Omission preserves its setting; false cannot override format-imposed protection."};
insertProperties = insert;
NSMutableDictionary *eject = [ejectProperties mutableCopy]; eject[@"drive"] = drive; ejectProperties = eject;
}
NSMutableDictionary *exchangeProperties = [insertProperties mutableCopy];
exchangeProperties[@"action"] = @{ @"type":@"string", @"enum":@[ @"insert", @"eject" ] };
return @[
@@ -148,7 +172,7 @@ static NSArray<NSDictionary *> *MCPPlaytestMediaTools() {
@"inputSchema":@{ @"type":@"object", @"properties":listProperties,
@"required":@[ @"project_id", @"revision", @"artifact_id" ], @"additionalProperties":@NO },
@"annotations":@{ @"readOnlyHint":@YES, @"openWorldHint":@NO } },
@{ @"name":@"exchange_playtest_media", @"description":@"Insert or eject FD0 in a paused owned disposable run while its floppy controller is idle. Insert requires media_id and exact media_sha256 from that run's listing; eject forbids both. Uses only reviewed artifact-bound private writable disks, preserving every disk across swaps and restart and retaining all disks when the run stops. A successful exchange neither resets nor advances the guest; receipts identify old/new media, hashes, dirty/retained state and clock. Failed exchange preserves the mounted disk and data. Reuse request_id only for the identical action and selection; changed plans conflict. No arbitrary paths, personal media, memory or register writes.",
@{ @"name":@"exchange_playtest_media", @"description":multiDrive ? @"Insert/eject only the selected drive FD0–FD3 (optional drive defaults to 0) in a paused owned run with the shared floppy controller idle. Insert requires reviewed media_id and exact current hash; optional boolean write_protected changes only that owned copy. Eject forbids media/hash/protection fields. Reject duplicate mounting of one writable copy. Old FD0 fields retain their meaning; drives lists all four placements, current/original hashes, generations, write protection and actual read/write byte transfers. Preserve all copies independently through exchange, cold restart, stop and retention. No reset, guest time advance, default-drive change or personal-session access. Reuse request_id only for the identical normalized drive/action/selection/protection plan." : @"Insert or eject FD0 in a paused owned disposable run while its floppy controller is idle. Insert requires media_id and exact media_sha256 from that run's listing; eject forbids both. Uses only reviewed artifact-bound private writable disks, preserving every disk across swaps and restart and retaining all disks when the run stops. A successful exchange neither resets nor advances the guest; receipts identify old/new media, hashes, dirty/retained state and clock. Failed exchange preserves the mounted disk and data. Reuse request_id only for the identical action and selection; changed plans conflict. No arbitrary paths, personal media, memory or register writes.",
@"inputSchema":@{ @"type":@"object", @"properties":exchangeProperties,
@"required":@[ @"run_id", @"request_id", @"action" ], @"additionalProperties":@NO,
@"oneOf":@[
+6 -1
View File
@@ -495,8 +495,13 @@ int main(int argc, char **argv) {
const bool mediaExchange = [grant[@"kind"] isEqual:@"cmoc"] && toolset >= 11 &&
[grant[@"playtest"] isEqual:@YES] && CFGetTypeID((__bridge CFTypeRef)grant[@"playtest"]) == CFBooleanGetTypeID() &&
[grant[@"playtestMedia"] isEqual:@YES] && CFGetTypeID((__bridge CFTypeRef)grant[@"playtestMedia"]) == CFBooleanGetTypeID();
const bool multiDrive = mediaExchange && toolset >= 13 &&
[grant[@"playtestMultiDrive"] isEqual:@YES] && CFGetTypeID((__bridge CFTypeRef)grant[@"playtestMultiDrive"]) == CFBooleanGetTypeID();
tools = [MCPProjectTools([grant[@"kind"] isEqual:@"assembly"], toolset >= 3,
customMake) arrayByAddingObjectsFromArray:manualTools];
if ([grant[@"kind"] isEqual:@"cmoc"] && toolset >= 13 &&
[grant[@"buildExport"] isEqual:@YES] && CFGetTypeID((__bridge CFTypeRef)grant[@"buildExport"]) == CFBooleanGetTypeID())
tools = [tools arrayByAddingObjectsFromArray:MCPBuildExportTools()];
if ([grant[@"kind"] isEqual:@"cmoc"] && toolset >= 6 && [grant[@"projectRefresh"] isEqual:@YES])
tools = [tools arrayByAddingObjectsFromArray:MCPProjectRefreshTools()];
if ([grant[@"kind"] isEqual:@"cmoc"] && toolset >= 7 && [grant[@"projectDiagnostics"] isEqual:@YES])
@@ -519,7 +524,7 @@ int main(int argc, char **argv) {
CFGetTypeID((__bridge CFTypeRef)grant[@"playtestCallContext"]) == CFBooleanGetTypeID())
tools = [tools arrayByAddingObjectsFromArray:MCPPlaytestCallContextTools()];
if (mediaExchange)
tools = [tools arrayByAddingObjectsFromArray:MCPPlaytestMediaTools()];
tools = [tools arrayByAddingObjectsFromArray:MCPPlaytestMediaTools(multiDrive)];
} else {
tools = [@[tool(@"get_capabilities", @"Identify the connected VCC Plus session and selected BASIC document.", nil),
tool(@"read_source", @"Read the selected BASIC draft using its document_id from get_capabilities.", @"document_id")]
+85 -31
View File
@@ -281,7 +281,10 @@ class Playtest {
}
void armStop() { armEvidence(stops, stopModule); }
void armInspection() { armEvidence({}, {}); }
uint64_t consumed = 0, fieldClock = 0, bootNumber = 0, mediaGeneration = 0;
uint64_t consumed = 0, fieldClock = 0, bootNumber = 0;
std::array<uint64_t, 4> mediaGenerations{}, mountReadBases{}, mountWriteBases{};
bool multiDrive = false, frozenForRetention = false;
unsigned drainedDrives = 0;
VCCPlaytestVideoWriter *videoWriter = nil;
NSMutableDictionary *videoInfo = nil;
NSURL *videoDirectory = nil;
@@ -332,54 +335,80 @@ class Playtest {
else if (fieldClock - videoFirstField >= videoMaximumFields) finishVideo(@"field_limit");
}
Processor processor = Processor::MC6809;
NSString *originalDiskHash = nil, *currentMediaID = nil;
NSString *diskHash() const {
const auto *image = floppy ? floppy->image(0) : nullptr;
NSMutableArray *originalDiskHashes = [NSMutableArray arrayWithObjects:@"", @"", @"", @"", nil];
NSMutableArray *currentMediaIDs = [NSMutableArray arrayWithObjects:NSNull.null, NSNull.null, NSNull.null, NSNull.null, nil];
NSString *mediaID(unsigned drive) const {
id value = currentMediaIDs[drive];
return [value isKindOfClass:NSString.class] ? value : nil;
}
NSString *diskHash(unsigned drive = 0) const {
const auto *image = floppy ? floppy->image(drive) : nullptr;
return image ? sha256(image->bytes()) : @"";
}
NSDictionary *driveStatus(unsigned drive) const {
const auto *image = floppy->image(drive);
return @{@"drive": @(drive), @"label": [NSString stringWithFormat:@"FD%u", drive],
@"inserted": @(image != nullptr), @"disk_present": @(image != nullptr),
@"media_id": mediaID(drive) ?: (id)NSNull.null,
@"disk_original_sha256": originalDiskHashes[drive], @"disk_sha256": diskHash(drive),
@"media_generation": @(mediaGenerations[drive]), @"byte_count": @(image ? image->bytes().size() : 0),
@"disk_dirty": @(image && image->dirty()), @"write_protected": @(image && image->writeProtected()),
@"disk_reads": @(floppy->readEvents(drive)), @"disk_writes": @(floppy->writeEvents(drive)),
@"mount_read_bytes": @(floppy->readEvents(drive) - mountReadBases[drive]),
@"mount_write_bytes": @(floppy->writeEvents(drive) - mountWriteBases[drive])};
}
void requireMediaExchangeState() const {
if (machine->snapshot().state != RunState::Paused) throw std::runtime_error("playtest_not_stopped");
// Motor activity or previously written bytes do not mean a transfer is
// pending. Only the actual FDC busy state prevents a disk exchange.
// A pending command on ANY drive protects the shared controller.
if (floppy->snapshot().busy) throw std::runtime_error("playtest_media_busy");
}
NSDictionary *exportMedia() const {
requireMediaExchangeState();
NSDictionary *exportMedia(unsigned drive = 0) {
if (!frozenForRetention) requireMediaExchangeState();
NSMutableDictionary *out = [status() mutableCopy];
if (const auto *image = floppy->image(0)) {
if (multiDrive) out[@"exported_drive"] = driveStatus(drive);
if (const auto *image = floppy->image(drive)) {
const auto& data = image->bytes();
out[@"disk_base64"] = [[NSData dataWithBytes:data.data() length:data.size()] base64EncodedStringWithOptions:0];
}
if (frozenForRetention) drainedDrives |= 1u << drive;
return out;
}
NSDictionary *exchangeMedia(NSDictionary *request) {
const unsigned drive = request[@"drive"] ? number(request[@"drive"], 0, 3) : 0;
for (NSString *key in request)
if (![@[@"op", @"expected_media_generation", @"expected_disk_sha256", @"media_id", @"disk_base64"] containsObject:key])
throw std::invalid_argument("invalid_arguments");
if (![@[@"op", @"expected_media_generation", @"expected_disk_sha256", @"media_id", @"disk_base64",
@"drive", @"write_protected"] containsObject:key]) throw std::invalid_argument("invalid_arguments");
if (!multiDrive && request[@"drive"]) throw std::invalid_argument("invalid_arguments");
const bool inserting = request[@"media_id"] != nil;
if ((request[@"disk_base64"] != nil) != inserting || request.count != (inserting ? 5u : 3u))
const NSUInteger optional = (request[@"drive"] ? 1 : 0) + (request[@"write_protected"] ? 1 : 0);
if ((request[@"disk_base64"] != nil) != inserting || request.count != (inserting ? 5u : 3u) + optional ||
(!inserting && request[@"write_protected"])) throw std::invalid_argument("invalid_arguments");
if (request[@"write_protected"] && CFGetTypeID((__bridge CFTypeRef)request[@"write_protected"]) != CFBooleanGetTypeID())
throw std::invalid_argument("invalid_arguments");
const auto expected = number(request[@"expected_media_generation"], 0, INT32_MAX);
if (![request[@"expected_disk_sha256"] isKindOfClass:NSString.class]) throw std::invalid_argument("invalid_arguments");
NSString *nextID = nil;
std::optional<VCC::Devices::DiskImage> replacement;
// Complete container validation and allocation precede any change to
// mounted media. Invalid images cannot eject or replace the old disk.
// Validate container and effective protection before changing any drive.
if (inserting) {
nextID = mediaIdentifier(request[@"media_id"]);
replacement.emplace(VCC::Devices::DiskImage::load(bytes(request[@"disk_base64"], maximumDiskBytes)));
for (unsigned other = 0; other < 4; ++other)
if (other != drive && [nextID isEqual:mediaID(other)]) throw std::invalid_argument("playtest_media_already_inserted");
replacement.emplace(VCC::Devices::DiskImage::load(bytes(request[@"disk_base64"], maximumDiskBytes),
[request[@"write_protected"] boolValue]));
}
requireMediaExchangeState();
NSString *oldHash = diskHash(), *oldID = currentMediaID;
if (uint64_t(expected) != mediaGeneration || ![request[@"expected_disk_sha256"] isEqual:oldHash])
NSString *oldHash = diskHash(drive), *oldID = mediaID(drive);
if (uint64_t(expected) != mediaGenerations[drive] || ![request[@"expected_disk_sha256"] isEqual:oldHash])
throw std::runtime_error("stale_media_exchange");
if (mediaGeneration == INT32_MAX) throw std::runtime_error("playtest_media_limit");
// The parent exports and durably retains the old image first. Explicit
// discard only releases this worker's already-retained mounted copy.
if (replacement) floppy->mount(0, std::move(*replacement), true);
else floppy->eject(0, true);
currentMediaID = nextID; originalDiskHash = diskHash(); ++mediaGeneration;
if (mediaGenerations[drive] == INT32_MAX) throw std::runtime_error("playtest_media_limit");
if (replacement) floppy->mount(drive, std::move(*replacement), true);
else floppy->eject(drive, true);
currentMediaIDs[drive] = nextID ?: (id)NSNull.null;
originalDiskHashes[drive] = diskHash(drive); ++mediaGenerations[drive];
mountReadBases[drive] = floppy->readEvents(drive); mountWriteBases[drive] = floppy->writeEvents(drive);
NSMutableDictionary *out = [status() mutableCopy];
out[@"target_drive"] = @(drive);
out[@"previous_media_id"] = oldID ?: (id)NSNull.null;
out[@"previous_disk_sha256"] = oldHash;
out[@"advances_execution"] = @NO;
@@ -420,11 +449,18 @@ class Playtest {
@"remaining_boots": @(bootNumber < 16 ? 16 - bootNumber : 0),
@"cycles": @(s.cycles), @"generation": @(s.generation), @"pc": @(s.cpu.PC),
@"state": s.state == RunState::Paused ? @"paused" : @"running",
@"disk_original_sha256": originalDiskHash ?: @"", @"disk_sha256": diskHash(),
@"disk_present": @(image != nullptr), @"media_id": currentMediaID ?: (id)NSNull.null,
@"media_generation": @(mediaGeneration), @"floppy_busy": @(floppy->snapshot().busy),
@"disk_dirty": @(image && image->dirty()), @"disk_reads": @(floppy->readEvents(0)),
@"disk_original_sha256": originalDiskHashes[0], @"disk_sha256": diskHash(),
@"disk_present": @(image != nullptr), @"media_id": mediaID(0) ?: (id)NSNull.null,
@"media_generation": @(mediaGenerations[0]), @"floppy_busy": @(floppy->snapshot().busy),
@"disk_dirty": @(image && image->dirty()), @"disk_write_protected": @(image && image->writeProtected()), @"disk_reads": @(floppy->readEvents(0)),
@"disk_writes": @(floppy->writeEvents(0)), @"isolated": @YES, @"input":inputMetadata(s) } mutableCopy];
if (multiDrive) {
NSMutableArray *drives = [NSMutableArray array];
for (unsigned drive = 0; drive < 4; ++drive) [drives addObject:driveStatus(drive)];
out[@"drives"] = drives; out[@"media_contract_version"] = @2;
out[@"drive_activity_units"] = @"transferred_data_bytes";
out[@"drive_activity_lifetime"] = @"worker lifetime; mount_* fields reset on each media generation";
}
if (videoInfo) out[@"video_recording"] = [videoInfo copy];
return out;
}
@@ -499,6 +535,11 @@ public:
rom = bytes(r[@"system_rom"], 32768, 32768);
auto diskROM = bytes(r[@"disk_rom"], 8192, 8192), disk = bytes(r[@"disk"], maximumDiskBytes);
NSString *initialMediaID = mediaIdentifier(r[@"media_id"] ?: @"primary");
if (r[@"multi_drive"] && CFGetTypeID((__bridge CFTypeRef)r[@"multi_drive"]) != CFBooleanGetTypeID())
throw std::invalid_argument("invalid_arguments");
multiDrive = [r[@"multi_drive"] boolValue];
if (r[@"write_protected"] && CFGetTypeID((__bridge CFTypeRef)r[@"write_protected"]) != CFBooleanGetTypeID())
throw std::invalid_argument("invalid_arguments");
NSArray *keys = r[@"boot_keys"];
if (![keys isKindOfClass:NSArray.class] || keys.count == 0 || keys.count > 256) throw std::invalid_argument("invalid_boot_keys");
for (NSNumber *n in keys) {
@@ -598,8 +639,8 @@ public:
MachineConfiguration config; config.processor = processor; config.ram = 1; config.frameInterval = 1;
machine->configure(config);
floppy = std::make_shared<VCC::Devices::Fd502Device>(diskROM);
floppy->mount(0,VCC::Devices::DiskImage::load(disk));
originalDiskHash = diskHash(); currentMediaID = initialMediaID;
floppy->mount(0,VCC::Devices::DiskImage::load(disk, [r[@"write_protected"] boolValue]));
originalDiskHashes[0] = diskHash(); currentMediaIDs[0] = initialMediaID;
machine->cartridges().configure({nullptr,nullptr,nullptr,nullptr,floppy},true,4);
machine->load(rom,processor);
for (const auto& buffer : graphicsBuffers)
@@ -608,13 +649,21 @@ public:
boot(); return status();
}
if (!machine || stopped) throw std::runtime_error("stale_run");
if (frozenForRetention && ![@[@"media_status", @"export_media", @"finish_stop"] containsObject:op])
throw std::runtime_error("playtest_retention_pending");
if ([op isEqual:@"finish_stop"]) {
if (!multiDrive || !frozenForRetention || r.count != 1 || drainedDrives != 15)
throw std::runtime_error("playtest_disk_export_incomplete");
stopped = true; return status();
}
if ([op isEqual:@"media_status"]) {
if (r.count != 1) throw std::invalid_argument("invalid_arguments");
return status();
}
if ([op isEqual:@"export_media"]) {
if (r.count != 1) throw std::invalid_argument("invalid_arguments");
return exportMedia();
if (r.count != 1 + (r[@"drive"] ? 1u : 0u) || (!multiDrive && r[@"drive"])) throw std::invalid_argument("invalid_arguments");
const unsigned drive = r[@"drive"] ? number(r[@"drive"], 0, 3) : 0;
return exportMedia(drive);
}
if ([op isEqual:@"exchange_media"]) return exchangeMedia(r);
if ([op isEqual:@"video_start"]) {
@@ -791,6 +840,11 @@ public:
finishVideo(@"run_stopped");
NSMutableDictionary *out = [status() mutableCopy];
if (videoInfo) out[@"video"] = [videoInfo copy];
if (multiDrive) {
frozenForRetention = true; drainedDrives = 0;
out[@"media_frozen"] = @YES;
return out; // Drain four bounded per-drive replies before finish_stop.
}
if (const auto *image = floppy->image(0)) {
const auto& disk = image->bytes();
out[@"disk_base64"] = [[NSData dataWithBytes:disk.data() length:disk.size()] base64EncodedStringWithOptions:0];
+8 -3
View File
@@ -24,9 +24,14 @@ def main():
parser.add_argument('--destination', type=Path)
args = parser.parse_args()
profile = content_profile()
source = args.source or (Path(os.environ.get('VCC_SOURCE_TOOLCHAIN_DIR') or
str(Path(os.environ['SRCROOT']) / 'LocalResources/SourceToolchainBundle'))
if profile == 'source' else Path(os.environ['SRCROOT']) / 'LocalResources/ToolchainBundle')
if args.source:
source = args.source
elif profile == 'source':
source = Path(os.environ.get('VCC_SOURCE_TOOLCHAIN_DIR') or
str(Path(os.environ['SRCROOT']) / 'LocalResources/SourceToolchainBundle'))
else:
source = Path(os.environ.get('VCC_TOOLCHAIN_DIR') or
str(Path(os.environ['SRCROOT']) / 'LocalResources/ToolchainBundle'))
destination = args.destination or (Path(os.environ['TARGET_BUILD_DIR']) /
os.environ['UNLOCALIZED_RESOURCES_FOLDER_PATH'] / 'Toolchain')
# Restrict cleanup to this build phase's app resource directory.
+115 -11
View File
@@ -519,10 +519,29 @@ final class InteractionTests: XCTestCase {
let access = app.dialogs["C Project Assistant Access"]
XCTAssertTrue(access.waitForExistence(timeout: 5))
XCTAssertTrue(access.checkBoxes["Allow Disposable Playtests"].exists)
let outputExport = access.checkBoxes["Allow Build Output Export"]
XCTAssertTrue(outputExport.exists)
XCTAssertEqual(outputExport.value as? Int, 0, "Opening Assistant must not grant delivery-folder access")
XCTAssertTrue(access.checkBoxes["Use Project Makefile"].exists)
XCTAssertTrue(access.buttons["Save Private Connection…"].exists)
let corner = access.coordinate(withNormalizedOffset: CGVector(dx: 1, dy: 1)).withOffset(CGVector(dx: -3, dy: -3))
corner.click(forDuration: 0.2, thenDragTo: corner.withOffset(CGVector(dx: 0, dy: max(0, 620 - access.frame.height))))
let accessShot = XCTAttachment(screenshot: access.screenshot())
accessShot.name = "C Development — native Assistant permission choices"; accessShot.lifetime = .keepAlways; add(accessShot)
outputExport.click()
let chooseDelivery = access.buttons["Choose Delivery Folder…"]
XCTAssertTrue(chooseDelivery.waitForExistence(timeout: 5))
XCTAssertFalse(access.buttons["Save Private Connection…"].isEnabled, "Export needs a separately approved folder")
let exportShot = XCTAttachment(screenshot: access.screenshot())
exportShot.name = "C Development — explicit build delivery folder approval"; exportShot.lifetime = .keepAlways; add(exportShot)
chooseDelivery.click()
XCTAssertTrue(app.buttons["Approve Folder"].firstMatch.waitForExistence(timeout: 5))
app.buttons["Cancel"].firstMatch.click()
XCTAssertTrue(access.waitForExistence(timeout: 5))
XCTAssertTrue(access.staticTexts["No delivery folder selected"].exists)
XCTAssertFalse(access.buttons["Save Private Connection…"].isEnabled)
outputExport.click()
XCTAssertTrue(access.buttons["Save Private Connection…"].isEnabled, "Cancelling export consent leaves ordinary connection creation available")
access.buttons[XCUIIdentifierCloseWindow].click()
XCTAssertEqual(session()[0], before[0], "Reading workspace and consent controls must not restart the CoCo")
XCTAssertEqual(try String(contentsOf: folder.appendingPathComponent("main.c"), encoding: .utf8), source)
@@ -2430,14 +2449,86 @@ final class InteractionTests: XCTestCase {
// Examine the composited live Metal surface, not just the viewport formula.
// The authored diagnostic fills its 640 × 384 active raster with color bars.
private func assertPictureAspect(scaling: String = "Sharp — Fit Window") throws {
let bitmap = try XCTUnwrap(NSBitmapImageRep(data: display.screenshot().pngRepresentation))
func bright(_ x: Int, _ y: Int) -> Bool {
var pixel = [Int](repeating: 0, count: 5)
bitmap.getPixel(&pixel, atX: x, y: y)
return pixel.prefix(3).max()! > 150
struct Observation {
let bitmap: NSBitmapImageRep
let frame: CGRect
let xs: [Int], ys: [Int]
}
let xs = (0..<bitmap.pixelsWide).filter { bright($0, bitmap.pixelsHigh / 2) }
let ys = (0..<bitmap.pixelsHigh).filter { bright(bitmap.pixelsWide / 2, $0) }
func finitePositiveFrame(_ frame: CGRect) -> Bool {
[frame.minX, frame.minY, frame.width, frame.height].allSatisfy { $0.isFinite }
&& frame.width > 0 && frame.height > 0
}
func reportFrame(_ frame: CGRect) -> [Any] {
[frame.minX, frame.minY, frame.width, frame.height].map { value -> Any in
value.isFinite ? Double(value) : String(describing: value)
}
}
let began = ContinuousClock.now
let deadline = began.advanced(by: .seconds(5))
var latest: Observation?, firstMismatch: [String: Any]?, lastDetails: [String: Any] = [:]
var stableObservations = 0, attempts = 0
while ContinuousClock.now < deadline {
attempts += 1
let element = display
let before = element.frame
let bitmap = NSBitmapImageRep(data: element.screenshot().pngRepresentation)
let frame = element.frame
let duration = began.duration(to: ContinuousClock.now).components
let elapsed = Double(duration.seconds) + Double(duration.attoseconds) / 1e18
var details: [String: Any] = ["elapsed_seconds": elapsed,
"frame_before": reportFrame(before), "frame_after": reportFrame(frame),
"finite_positive_frame": finitePositiveFrame(before) && finitePositiveFrame(frame)]
if let bitmap, bitmap.pixelsWide > 0, bitmap.pixelsHigh > 0,
finitePositiveFrame(before), finitePositiveFrame(frame) {
func bright(_ x: Int, _ y: Int) -> Bool {
var pixel = [Int](repeating: 0, count: 5)
bitmap.getPixel(&pixel, atX: x, y: y)
return pixel.prefix(3).max()! > 150
}
let xs = (0..<bitmap.pixelsWide).filter { bright($0, bitmap.pixelsHigh / 2) }
let ys = (0..<bitmap.pixelsHigh).filter { bright(bitmap.pixelsWide / 2, $0) }
if let x0 = xs.first, let x1 = xs.last, let y0 = ys.first, let y1 = ys.last {
let width = Double(x1 - x0 + 1), height = Double(y1 - y0 + 1)
let backing = Double(bitmap.pixelsWide) / frame.width
let inset = 4 * backing
let fit = min((Double(bitmap.pixelsWide) - 2 * inset) / 640,
(Double(bitmap.pixelsHigh) - 2 * inset) / 384)
let integer = scaling == "Integer Pixels" && fit >= 1
let scale = integer ? floor(fit) : fit
// Use the unchanged final assertions' exact tolerances for
// readiness; an indefinitely stretched drawable still fails.
let matches = abs(width - height * 640 / 384) <= 3
&& abs(width - 640 * scale) <= 3 && abs(height - 384 * scale) <= 3
&& abs(Double(x0) + width / 2 - Double(bitmap.pixelsWide) / 2) <= 2
&& abs(Double(y0) + height / 2 - Double(bitmap.pixelsHigh) / 2) <= 2
let stableFrame = before == frame && latest?.frame == frame
stableObservations = matches && before == frame ? (stableFrame ? stableObservations + 1 : 1) : 0
details.merge(["picture": [x0, y0, x1 - x0 + 1, y1 - y0 + 1],
"bitmap_size": [bitmap.pixelsWide, bitmap.pixelsHigh], "expected_scale": scale.isFinite ? scale as Any : String(describing: scale),
"unchanged_tolerances_satisfied": matches, "stable_observations": stableObservations]) { _, new in new }
latest = Observation(bitmap: bitmap, frame: frame, xs: xs, ys: ys)
} else {
stableObservations = 0; details["failure"] = "No bright diagnostic row or column"
}
} else {
stableObservations = 0; details["failure"] = "Display screenshot or finite positive frame unavailable"
}
lastDetails = details
if stableObservations >= 2 { break }
if firstMismatch == nil { firstMismatch = details }
if ContinuousClock.now.advanced(by: .milliseconds(100)) >= deadline { break }
Thread.sleep(forTimeInterval: 0.1) // Test runner only; the app and guest keep running.
}
let duration = began.duration(to: ContinuousClock.now).components
let report: [String: Any] = ["scaling": scaling, "attempts": attempts,
"elapsed_seconds": Double(duration.seconds) + Double(duration.attoseconds) / 1e18,
"required_stable_observations": 2, "ready": stableObservations >= 2,
"first_mismatch_or_unsettled_observation": firstMismatch.map { $0 as Any } ?? NSNull(), "final_observation": lastDetails]
let readiness = XCTAttachment(data: try JSONSerialization.data(withJSONObject: report, options: [.prettyPrinted, .sortedKeys]), uniformTypeIdentifier: "public.json")
readiness.name = "Metal picture readiness"; readiness.lifetime = .keepAlways; add(readiness)
XCTAssertGreaterThanOrEqual(stableObservations, 2, "The actual composited picture and display frame must settle within five seconds without relaxing geometry checks")
let observation = try XCTUnwrap(latest, "The actual Metal diagnostic picture was unavailable")
let bitmap = observation.bitmap, xs = observation.xs, ys = observation.ys
let width = try XCTUnwrap(xs.last) - XCTUnwrap(xs.first) + 1
let height = try XCTUnwrap(ys.last) - XCTUnwrap(ys.first) + 1
XCTAssertEqual(Double(width), Double(height) * 640 / 384, accuracy: 3,
@@ -2445,7 +2536,7 @@ final class InteractionTests: XCTestCase {
// Aspect alone also passes for a tiny picture centered in a huge
// viewport. Measure actual composited coverage and placement as well.
// Calculate expectations independently of the app's VideoGeometry.
let backing = Double(bitmap.pixelsWide) / display.frame.width
let backing = Double(bitmap.pixelsWide) / observation.frame.width
let inset = 4 * backing
let fit = min((Double(bitmap.pixelsWide) - 2 * inset) / 640,
(Double(bitmap.pixelsHigh) - 2 * inset) / 384)
@@ -4209,10 +4300,24 @@ extension InteractionTests {
let source = library.buttons["library-open-source"]
let detail = library.scrollViews.containing(.button, identifier: "library-open-source").firstMatch
for _ in 0..<8 where !source.isHittable { detail.scroll(byDeltaX: 0, deltaY: -300) }
XCTAssertTrue(source.isHittable)
XCTAssertTrue(library.descendants(matching: .any)["library-online-manual"].firstMatch.exists, "The online edition remains a distinct link")
func downloadSource(to location: URL) {
app.activate()
// XCTest can report a clipped button as hittable even when its
// center is below the scroll viewport. Qualify the actual geometry
// before clicking, including after returning from the workspace.
func sourceIsVisible() -> Bool {
let button = source.frame, viewport = detail.frame.insetBy(dx: 4, dy: 8)
return [button.minX, button.minY, button.width, button.height,
viewport.minX, viewport.minY, viewport.width, viewport.height].allSatisfy { $0.isFinite }
&& button.width > 0 && button.height > 0
&& viewport.width > 0 && viewport.height > 0
&& source.isHittable && viewport.contains(button)
}
for _ in 0..<8 where !sourceIsVisible() {
detail.scroll(byDeltaX: 0, deltaY: source.frame.minY < detail.frame.minY ? 200 : -200)
}
diskEditorWait("Open Source must be wholly inside the visible detail viewport") { sourceIsVisible() }
source.click()
let download = app.buttons["Download Source"].firstMatch
XCTAssertTrue(download.waitForExistence(timeout: 5))
@@ -4245,7 +4350,6 @@ extension InteractionTests {
let dirty = editor.value as? String
menu("Media", "Software Library…")
XCTAssertTrue(library.waitForExistence(timeout: 5))
for _ in 0..<8 where !source.isHittable { detail.scroll(byDeltaX: 0, deltaY: -300) }
downloadSource(to: secondDestination)
let cancelReview = app.buttons["Cancel"].firstMatch
XCTAssertTrue(app.staticTexts["Save changes to this project?"].firstMatch.waitForExistence(timeout: 15))
+13 -8
View File
@@ -5,6 +5,11 @@
};
"objectVersion" = 56;
"objects" = {
"66DDF50B2F00881C339F9F00" = { isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "App/MCPBuildExport.swift"; sourceTree = SOURCE_ROOT; };
"D8156871A65DFAA5E40891F8" = { isa = PBXBuildFile; fileRef = "66DDF50B2F00881C339F9F00"; };
"3E928710328383CF150F86F6" = { isa = PBXBuildFile; fileRef = "66DDF50B2F00881C339F9F00"; };
"87E2AF0BA86F733A89C4948C" = { isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Tests/MCPBuildExportTests.swift"; sourceTree = SOURCE_ROOT; };
"4A02035CF876A8F80E66524A" = { isa = PBXBuildFile; fileRef = "87E2AF0BA86F733A89C4948C"; };
"2464EE6BFE2AA97DBC5C2913" = { isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "App/CoCoCaptureFeedback.swift"; sourceTree = SOURCE_ROOT; };
"E4061E4E0AB7CA7A47624B27" = { isa = PBXBuildFile; fileRef = "2464EE6BFE2AA97DBC5C2913"; };
"337343EA275BED13114792F9" = { isa = PBXBuildFile; fileRef = "2464EE6BFE2AA97DBC5C2913"; };
@@ -694,7 +699,7 @@ DE524C5CEEB7201C899C173E = { isa = PBXBuildFile; fileRef = 2DDBE7F7A3DE72AD67CB6
"CEEB1C09197841D54A6AD5E8" = { "isa" = "PBXBuildFile"; "fileRef" = "2ECB4508563F3873B436B9EE"; };
"3AE8BC7E4A8F296EB0B7AEFD" = { "isa" = "PBXFileReference"; "lastKnownFileType" = "folder"; "path" = "Resources/About"; "sourceTree" = "<group>"; };
"370CBA86395A91DC191231AB" = { "isa" = "PBXBuildFile"; "fileRef" = "3AE8BC7E4A8F296EB0B7AEFD"; };
"53AAABD74B976C180137280A" = { "isa" = "XCBuildConfiguration"; "name" = "UITesting"; "buildSettings" = { "INFOPLIST_KEY_VCCCompanionProtocolVersion" = "1"; "COPY_PHASE_STRIP" = "NO"; "LD_RUNPATH_SEARCH_PATHS" = ( "$(inherited)", "@executable_path/../Frameworks" ); "SWIFT_ACTIVE_COMPILATION_CONDITIONS" = "$(inherited) DEBUG VCC_UI_TESTING"; "DEBUG_INFORMATION_FORMAT" = "dwarf"; "VCC_BUILD_CONTENT_PROFILE" = "source"; "VCC_SOURCE_ROM_DIR" = ""; "MARKETING_VERSION" = "3.7.0"; "INFOPLIST_FILE" = "App/Info.plist"; "ENABLE_TESTABILITY" = "YES"; "GENERATE_INFOPLIST_FILE" = "YES"; "ENABLE_USER_SCRIPT_SANDBOXING" = "NO"; "SWIFT_OBJC_BRIDGING_HEADER" = "$(SRCROOT)/Bridge/VCCMac-Bridging-Header.h"; "INFOPLIST_KEY_CFBundleDisplayName" = "VCC OSS UI Tests"; "GCC_OPTIMIZATION_LEVEL" = "0"; "SWIFT_OPTIMIZATION_LEVEL" = "-Onone"; "PRODUCT_NAME" = "VCC Plus OSS"; "PRODUCT_MODULE_NAME" = "VCCMac"; "OTHER_LDFLAGS" = "$(inherited) -larchive -framework Network"; "INFOPLIST_KEY_LSApplicationCategoryType" = "public.app-category.entertainment"; "PRODUCT_BUNDLE_IDENTIFIER" = "com.brianholman.vccplus.oss.mac.uitesting"; "CURRENT_PROJECT_VERSION" = "64"; }; };
"53AAABD74B976C180137280A" = { "isa" = "XCBuildConfiguration"; "name" = "UITesting"; "buildSettings" = { "INFOPLIST_KEY_VCCCompanionProtocolVersion" = "1"; "COPY_PHASE_STRIP" = "NO"; "LD_RUNPATH_SEARCH_PATHS" = ( "$(inherited)", "@executable_path/../Frameworks" ); "SWIFT_ACTIVE_COMPILATION_CONDITIONS" = "$(inherited) DEBUG VCC_UI_TESTING"; "DEBUG_INFORMATION_FORMAT" = "dwarf"; "VCC_BUILD_CONTENT_PROFILE" = "source"; "VCC_SOURCE_ROM_DIR" = ""; "MARKETING_VERSION" = "3.7.1"; "INFOPLIST_FILE" = "App/Info.plist"; "ENABLE_TESTABILITY" = "YES"; "GENERATE_INFOPLIST_FILE" = "YES"; "ENABLE_USER_SCRIPT_SANDBOXING" = "NO"; "SWIFT_OBJC_BRIDGING_HEADER" = "$(SRCROOT)/Bridge/VCCMac-Bridging-Header.h"; "INFOPLIST_KEY_CFBundleDisplayName" = "VCC OSS UI Tests"; "GCC_OPTIMIZATION_LEVEL" = "0"; "SWIFT_OPTIMIZATION_LEVEL" = "-Onone"; "PRODUCT_NAME" = "VCC Plus OSS"; "PRODUCT_MODULE_NAME" = "VCCMac"; "OTHER_LDFLAGS" = "$(inherited) -larchive -framework Network"; "INFOPLIST_KEY_LSApplicationCategoryType" = "public.app-category.entertainment"; "PRODUCT_BUNDLE_IDENTIFIER" = "com.brianholman.vccplus.oss.mac.uitesting"; "CURRENT_PROJECT_VERSION" = "67"; }; };
"4478F567020A87952E7BF5BE" = { "isa" = "XCBuildConfiguration"; "name" = "UITesting"; "buildSettings" = { "SWIFT_ACTIVE_COMPILATION_CONDITIONS" = "$(inherited) DEBUG"; "PRODUCT_NAME" = "VCCCore"; "DEBUG_INFORMATION_FORMAT" = "dwarf"; "GCC_OPTIMIZATION_LEVEL" = "0"; "SWIFT_OPTIMIZATION_LEVEL" = "-Onone"; "SKIP_INSTALL" = "YES"; "ENABLE_TESTABILITY" = "YES"; "EXECUTABLE_PREFIX" = "lib"; "GCC_PREPROCESSOR_DEFINITIONS" = ( "$(inherited)", "USE_DEBUG_TESTS=false" ); }; };
"6E5C730B0C1F6F8D5EB8881A" = { "isa" = "XCBuildConfiguration"; "name" = "UITesting"; "buildSettings" = { "ONLY_ACTIVE_ARCH" = "NO"; "SWIFT_ACTIVE_COMPILATION_CONDITIONS" = "$(inherited) DEBUG"; "DEBUG_INFORMATION_FORMAT" = "dwarf"; "CLANG_ENABLE_MODULES" = "YES"; "CODE_SIGN_IDENTITY" = "-"; "MACOSX_DEPLOYMENT_TARGET" = "14.0"; "CLANG_CXX_LANGUAGE_STANDARD" = "c++17"; "ENABLE_TESTABILITY" = "YES"; "GCC_OPTIMIZATION_LEVEL" = "0"; "SWIFT_OPTIMIZATION_LEVEL" = "-Onone"; "ARCHS" = "$(ARCHS_STANDARD)"; "HEADER_SEARCH_PATHS" = ( "$(inherited)", "$(SRCROOT)/../../src/core", "$(SRCROOT)/../../src" ); "SDKROOT" = "macosx"; "SWIFT_VERSION" = "5.0"; "CODE_SIGN_STYLE" = "Manual"; "DEVELOPMENT_TEAM" = ""; "VCC_BUILD_CONTENT_PROFILE" = "source"; "CLANG_ENABLE_OBJC_ARC" = "YES"; "CLANG_CXX_LIBRARY" = "libc++"; }; };
"9D61CCD0757A3005AF102148" = { "isa" = "XCBuildConfiguration"; "name" = "UITesting"; "buildSettings" = { "LD_RUNPATH_SEARCH_PATHS" = ( "$(inherited)", "$(PLATFORM_DIR)/Developer/Library/Frameworks" ); "SWIFT_ACTIVE_COMPILATION_CONDITIONS" = "$(inherited) DEBUG"; "DEBUG_INFORMATION_FORMAT" = "dwarf"; "ENABLE_TESTABILITY" = "YES"; "GENERATE_INFOPLIST_FILE" = "YES"; "SWIFT_OBJC_BRIDGING_HEADER" = "$(SRCROOT)/Bridge/VCCMac-Bridging-Header.h"; "GCC_OPTIMIZATION_LEVEL" = "0"; "SWIFT_OPTIMIZATION_LEVEL" = "-Onone"; "PRODUCT_NAME" = "VCCCoreTests"; "OTHER_LDFLAGS" = ( "$(inherited)", "-larchive", "-framework", "Network", "-framework", "XCTest" ); "FRAMEWORK_SEARCH_PATHS" = ( "$(inherited)", "$(PLATFORM_DIR)/Developer/Library/Frameworks" ); "PRODUCT_BUNDLE_IDENTIFIER" = "com.brianholman.vccplus.oss.mac.coretests"; "GCC_PREPROCESSOR_DEFINITIONS" = ( "$(inherited)", "DEBUG=1" ); }; };
@@ -1637,7 +1642,7 @@ CF5FFC06DB9D6CE02797B0DB,
7B4FBBB6612B2D28399C45D2,
39D55AADB2BB41AC896EED2A,
62F33D8AD022224C0317573C,
0BDB35B6844F49A89A878C07, "4321FD0AA20C7F0B82946B54", "3DFBD46CD8862089F96379F9", "826B9558E67AC34BEA26225B", "418DF00B8D63184FE71FD243", "3045DD0C15BAEAA7F23B3CAF", "85CE7AA889B1A2C0FCFFF709", "10272DC5592066C93FA041F0", "823FEE6E651C8F9B8CF93863", "870763EA2002E3B2DA4439BE", "C91F4031641CAF810A74D9AE", "02BDBF49088107745C157136", "E68B9E29C8124CC0233A373B", "615914186BA3B2548B75D5CF", "115A88CCADAFC2F3119AA924", "BE974B1C848989BC0130B704", "670915AEB1A6E8E73DD16F06", "C73E8C5214DDAF44FB6ABEB5", "67398F77773BE61B44309CDF", "A512EF6F56693B08DBD17623", "059802430CC64E3769130293", "D8F37E8B1DD4F745E3B1FCD3", "95C14DEEBC2DECEA14B63C7E", "24F62A09B7DF64F401D42071", "29DC442BDE3D2B7B4FD45775", "CF3CBB0CDBD1B6CFEA3D16EF", "FA88C3E6358AABD1337E5922", "4BC9819B4A3F9943EE1A02CC", "C2FCF46C10FEE516AA6A7C1E", "C5C1087220D0EF075A6CFD80", "C02E3725695AEBE122888A16", "682C73D064A7050C396114D1", "D023D7B24E79B890308F74EE", "C4BB49EC699353182587FF5E", "492621AD31DBD73FBEFAEFCC", "8D709AF3E234FFB45A016A9F", "4A6620140D28CEAF74AB1EAA", "E2AF4DB362A8922E9E59888D", "2F485164B2AA7271E11F2A68", "023A775BEE51E56DB5BCAF91", "15F739D7833A44CAF5B3AC91", "05C12D61D4309FF67ECD44D8", "3F33FFDA5EC831B47C21CAFF", "274BF8DBFCAE4D9F9CF659B2", "7B0FCC2AAC9B426E9789FDF4", "14DCF40E2F9D40AB852F3067", "8B030B1F65D547ADB72CDC9C", "D9FD79D94A81475691A9337B", "501CF758D4DC46C330E74F38", "3540482FEFE6C0885900C327", "3D8441F835BB11EBB626D5C8", "1F1B393BC2F74DA2608A4025", "948D3BF8A42B5EEE9256A3FF", "499B64CF31E06B790FF12509", "DC63F5509BBB60C804F21EBE", "3CBF793866E3496E89C6FC0A", "32F3B3EE89BC4189B1EDB269", "6C8B7480637024B236B48F65", "4B156145C2B8115D567921B8", "FB4694F019F44820F3595721", "9556017F5BAED44139E8C95D", "9169457530B9E586355CBD1A", "BFE441989FFFFD41754DC371", "3EFAD442153FD9DCDBDA67EC", "C2A5035DEE7A8B3324C7709C", "B78EF0920DBA28D1332D44F4", "B79409A51D8040EFD8875CC3", "948430C8A133C01130C6EE34", "311059DEF23BA48A0C1269B9", "06437928FCABF5604E678108", "C0DF4E6D4ADB35C6645175E4", "E5CD91056EEC957439869FF8", "F0BC21D74DEC576602D09899", "6D764A33053344DE6CD9EFD7", "CDA3087965746C417A620C1E", "CCECF8D635E33F6BA9556C45", "D02BC5EC603335A1AD2DF6F5", "FC4513AF8DD249896CA98E39", "1783422DA5EECD14E05E2408", "1628AEF6C36148D5BB593A16", "411D43282F91148E8BAAF88C", "7A6E85E66C933E4C98B02511", "456D2E032E7D4B2F84F9EFD4", "C0162F16AEC84BD880E88B6A", "5EB66C440A2E40ABBFFE50FA", "B595BD62B33A4E2EB96A6E5A", "3ED4C66E5E364794A2231258", "CC132EE385DA881BD4DCA57B", "231A0BA3D7C801225FA37FDB", "39AA931009E5460BFF8C0F28", "4C28168A52886A48F0FA7FF9", "C27E852B143EA3443A8E2C73", "1D5A41F3C73762C36AC72EB3", "9553F2FB3B6C4B4E5143F1F3", "926F4B865FD6CC400BB19AA3", "C947D24F8EFC960CFC235767", "08D3E733C8687081151C42CC", "71E50EAAD821F1FB09541F9D", "794228A6B64E2E78863C425B", "B332014BA2D8AE24963CA05F", "63CE75E10A456170B69355B5", "9239B5C8F87ED8D9765BCFF8", "F250ED34E019B0A53B6803B0", "41A4F7D652312B8714328578", "E9A02223698241E3847CC87D", "BFDDCD02FAC24F789610D128", "F2E0D60257F9D9FAEE66021D", "7C31BA40348758EE6968821D", "CFF6D73962ADF238A4C28895", "F5C6D3ABDD837F1862D88512", "515D3B8937044FDBB58D3A21", "F8DBF692CCD3D47B4B9E5C0F", "52EAAF99A6318C88B6F962D3", "11D150DB541038C00DB2D6BF", "576712309428CEC50E16AFD0", "09AB769344CF1DA512754F63", "32C8EC085FCE897D547848D5", "2E603EB797A109ADABF21A27", "D537BBBFCC4CF01677A8CED1", "C3B1FD7C03A4FA0574E38EF8", "7339FE1A16674B2588333002", "DD3367E11F4FEB184A7FBA34", "1547595B7D1B2B22EDFAF9D1", "D253E6FCD821976F74848B00",
0BDB35B6844F49A89A878C07, "4321FD0AA20C7F0B82946B54", "3DFBD46CD8862089F96379F9", "826B9558E67AC34BEA26225B", "418DF00B8D63184FE71FD243", "3045DD0C15BAEAA7F23B3CAF", "85CE7AA889B1A2C0FCFFF709", "10272DC5592066C93FA041F0", "823FEE6E651C8F9B8CF93863", "870763EA2002E3B2DA4439BE", "C91F4031641CAF810A74D9AE", "02BDBF49088107745C157136", "E68B9E29C8124CC0233A373B", "615914186BA3B2548B75D5CF", "115A88CCADAFC2F3119AA924", "BE974B1C848989BC0130B704", "670915AEB1A6E8E73DD16F06", "C73E8C5214DDAF44FB6ABEB5", "67398F77773BE61B44309CDF", "A512EF6F56693B08DBD17623", "059802430CC64E3769130293", "D8F37E8B1DD4F745E3B1FCD3", "95C14DEEBC2DECEA14B63C7E", "24F62A09B7DF64F401D42071", "29DC442BDE3D2B7B4FD45775", "CF3CBB0CDBD1B6CFEA3D16EF", "FA88C3E6358AABD1337E5922", "4BC9819B4A3F9943EE1A02CC", "C2FCF46C10FEE516AA6A7C1E", "C5C1087220D0EF075A6CFD80", "C02E3725695AEBE122888A16", "682C73D064A7050C396114D1", "D023D7B24E79B890308F74EE", "C4BB49EC699353182587FF5E", "492621AD31DBD73FBEFAEFCC", "8D709AF3E234FFB45A016A9F", "4A6620140D28CEAF74AB1EAA", "E2AF4DB362A8922E9E59888D", "2F485164B2AA7271E11F2A68", "023A775BEE51E56DB5BCAF91", "15F739D7833A44CAF5B3AC91", "05C12D61D4309FF67ECD44D8", "3E928710328383CF150F86F6", "3F33FFDA5EC831B47C21CAFF", "274BF8DBFCAE4D9F9CF659B2", "7B0FCC2AAC9B426E9789FDF4", "14DCF40E2F9D40AB852F3067", "8B030B1F65D547ADB72CDC9C", "D9FD79D94A81475691A9337B", "501CF758D4DC46C330E74F38", "3540482FEFE6C0885900C327", "3D8441F835BB11EBB626D5C8", "1F1B393BC2F74DA2608A4025", "948D3BF8A42B5EEE9256A3FF", "499B64CF31E06B790FF12509", "DC63F5509BBB60C804F21EBE", "3CBF793866E3496E89C6FC0A", "32F3B3EE89BC4189B1EDB269", "6C8B7480637024B236B48F65", "4B156145C2B8115D567921B8", "FB4694F019F44820F3595721", "9556017F5BAED44139E8C95D", "9169457530B9E586355CBD1A", "BFE441989FFFFD41754DC371", "3EFAD442153FD9DCDBDA67EC", "C2A5035DEE7A8B3324C7709C", "B78EF0920DBA28D1332D44F4", "B79409A51D8040EFD8875CC3", "948430C8A133C01130C6EE34", "311059DEF23BA48A0C1269B9", "06437928FCABF5604E678108", "C0DF4E6D4ADB35C6645175E4", "E5CD91056EEC957439869FF8", "F0BC21D74DEC576602D09899", "6D764A33053344DE6CD9EFD7", "CDA3087965746C417A620C1E", "CCECF8D635E33F6BA9556C45", "D02BC5EC603335A1AD2DF6F5", "FC4513AF8DD249896CA98E39", "1783422DA5EECD14E05E2408", "1628AEF6C36148D5BB593A16", "411D43282F91148E8BAAF88C", "7A6E85E66C933E4C98B02511", "456D2E032E7D4B2F84F9EFD4", "C0162F16AEC84BD880E88B6A", "5EB66C440A2E40ABBFFE50FA", "B595BD62B33A4E2EB96A6E5A", "3ED4C66E5E364794A2231258", "CC132EE385DA881BD4DCA57B", "231A0BA3D7C801225FA37FDB", "39AA931009E5460BFF8C0F28", "4C28168A52886A48F0FA7FF9", "C27E852B143EA3443A8E2C73", "1D5A41F3C73762C36AC72EB3", "9553F2FB3B6C4B4E5143F1F3", "926F4B865FD6CC400BB19AA3", "C947D24F8EFC960CFC235767", "08D3E733C8687081151C42CC", "71E50EAAD821F1FB09541F9D", "794228A6B64E2E78863C425B", "B332014BA2D8AE24963CA05F", "63CE75E10A456170B69355B5", "9239B5C8F87ED8D9765BCFF8", "F250ED34E019B0A53B6803B0", "41A4F7D652312B8714328578", "E9A02223698241E3847CC87D", "BFDDCD02FAC24F789610D128", "F2E0D60257F9D9FAEE66021D", "7C31BA40348758EE6968821D", "CFF6D73962ADF238A4C28895", "F5C6D3ABDD837F1862D88512", "515D3B8937044FDBB58D3A21", "F8DBF692CCD3D47B4B9E5C0F", "52EAAF99A6318C88B6F962D3", "11D150DB541038C00DB2D6BF", "576712309428CEC50E16AFD0", "09AB769344CF1DA512754F63", "32C8EC085FCE897D547848D5", "2E603EB797A109ADABF21A27", "D537BBBFCC4CF01677A8CED1", "C3B1FD7C03A4FA0574E38EF8", "7339FE1A16674B2588333002", "DD3367E11F4FEB184A7FBA34", "1547595B7D1B2B22EDFAF9D1", "D253E6FCD821976F74848B00",
"BBDFBB8C5ACFE0C680731DC2",
"8B013CC890D39A05F4ED1DAB",
"1B116EE53896E353DFC1B92F",
@@ -1698,8 +1703,8 @@ CF5FFC06DB9D6CE02797B0DB,
"INFOPLIST_KEY_LSApplicationCategoryType" = "public.app-category.entertainment";
"INFOPLIST_KEY_CFBundleDisplayName" = "VCC Plus OSS";
"INFOPLIST_FILE" = "App/Info.plist";
"VCC_BUILD_CONTENT_PROFILE" = "source"; "VCC_SOURCE_ROM_DIR" = ""; "MARKETING_VERSION" = "3.7.0";
"CURRENT_PROJECT_VERSION" = "64";
"VCC_BUILD_CONTENT_PROFILE" = "source"; "VCC_SOURCE_ROM_DIR" = ""; "MARKETING_VERSION" = "3.7.1";
"CURRENT_PROJECT_VERSION" = "67";
"LD_RUNPATH_SEARCH_PATHS" = ( "$(inherited)", "@executable_path/../Frameworks" );
"GCC_OPTIMIZATION_LEVEL" = "0";
"SWIFT_OPTIMIZATION_LEVEL" = "-Onone";
@@ -1719,8 +1724,8 @@ CF5FFC06DB9D6CE02797B0DB,
"INFOPLIST_KEY_LSApplicationCategoryType" = "public.app-category.entertainment";
"INFOPLIST_KEY_CFBundleDisplayName" = "VCC Plus OSS";
"INFOPLIST_FILE" = "App/Info.plist";
"VCC_BUILD_CONTENT_PROFILE" = "source"; "VCC_SOURCE_ROM_DIR" = ""; "MARKETING_VERSION" = "3.7.0";
"CURRENT_PROJECT_VERSION" = "64";
"VCC_BUILD_CONTENT_PROFILE" = "source"; "VCC_SOURCE_ROM_DIR" = ""; "MARKETING_VERSION" = "3.7.1";
"CURRENT_PROJECT_VERSION" = "67";
"LD_RUNPATH_SEARCH_PATHS" = ( "$(inherited)", "@executable_path/../Frameworks" );
"GCC_OPTIMIZATION_LEVEL" = "2";
"SWIFT_OPTIMIZATION_LEVEL" = "-O";
@@ -1979,7 +1984,7 @@ DE524C5CEEB7201C899C173E,
012A9C0D4AB7CCE32C24C6EC,
22E8813154B0E365571659D1,
D523E81542ABBD5AB135AA86,
B7E302195F6A9DD0DEDAAE81, "F69A6B3CA6DADD9644B13172", "E28A5CEB274AF11A9D4D64A7", "8FB86FADC3423CED521C855A", "F097A5A4144D30372FD572EC", "9A7580D6B22390B635A19F89", "BE28275CD8BD625C772155F9", "356F4572114E7AAE0F5954D9", "CAADC64B387B05820E0F1B3A", "2A41A057C987C99C16326EC3", "21BB5980BE79619891B2E0F3", "41058564FCF0CD603FF6F83B", "F112F84DEFA54BBF6A74AA9D", "64E852CA1B43CE2EE5509DC4", "43DE6A833C76FCEB0BB16373", "F0405E77CEC80758A4B05E20", "94CD4919A1DF7FB2A7F00A39", "B81E845A0F5F9ADBA178782E", "27128C761CE524CD4E616E0F", "E4A6B8FD70C6B71C8A8946F8", "E5C6EC6275ECA4B6620F751A", "1F877766F277CE8D98FC4C98", "75C2926B75F8D566C90F8814", "6A45AA20DAD66943C6609278", "F43A4EA6B12A2844D9913AFB", "30F9AA558484279D418BC2AB", "7D24D7E8433052B54A98F9B4", "66AB557EF31F72BCE23B6C20", "32336CE2F512DBFD6C8C33B6", "B144E6CCF412FA4F6ED667BE", "0E6F18DF1BB7BDC2B522D565", "88362186D105AC38CDC1F34B", "A2C86680E706C6EB896624F7", "1D76124E803555F5B3BB4858", "227B8433ABAD08C1540FDFB7", "5FE510E3299964E905F2EEC1", "1DA339454EE1D551B57EE722", "111F36A223EDA8FB8B1BAA87", "BCB4A9FFE10489971342B925", "4D475CC90EDE6383ADE44783", "1F48315B00236C831CD0B0C6", "18EBAF7CBB4C8D0AAE871090", "A09EE5D651D37597BCCE1549", "2DCC205FFB836A66A37E98B5", "F59D1FEA561570A5236F53C0", "F6973CC082553C582B6A3B7B", "68C882F50C29460AAE9C6CD9", "647C43E622AA4F1F81D75AED", "DCA00E415E794E4482CD7799", "2DD34F1B46E94A1A86EE1F03", "43EBAF4A0A62FA8383A1FF2E", "3DD59A0CA93F9FAEC2C852A2", "208538707397447D90B15973", "3B04447D7EB864E7D58E52B2", "37D733ED816B587FB560594E", "7BF84CEED0675652AF613D1A", "474645F3EE3BE43A1F533D5A", "F44C9C01432D4A6C9F4097C7", "570064B66DCCAAD7E2F3CA71", "FD32EAB5B2533D984DD976F8", "44B68B934274129184A15323", "E5FCCCC1D2A8FE933B994C9D", "B044E18CD3014FF408A9291A", "2BA7ED90FFE5683113F61261", "ACE8F17CB88D435E5F71D748", "49A277CE344C81A8103F9BD1", "F76252FB385F90EA6F98554A", "D3EC96D0345BAE991C2175CE", "24ABDC75474C17E968329F66", "24846F930A11A3874CD0E3AB", "3948D8BCE2CEDDCBAAD2D511", "C6887E3A78DD2AB54009B828", "93C59213A46CB5EAFA9D40FE", "50AB38A10915155BF160E42F", "17A0EFD8B103844E5859BA7E", "D0AF485FCA65EC7940378639", "2716C73C955C5C8E0B2B6C1A", "82C12517D7D11B3AA69F9046", "38BCC7DDD753A027AE474C89", "56C4880ED2F21F08B4AB77D4", "74760C1D3D15D406B0610E1E", "BDB17300AB97E41E167979B0", "FD98C1AE6C87F81FD173F957", "9AEDE29DCDAA6CF71A09BEA5", "FF089E4556B82BB4560B85C1", "47294DE31D6B1DFF73C290C4", "6A135315F7001AE1D296A661", "09BA63DA8E16C7E108595B1B", "0A7CDBE73C21566EC2A908D3", "4D367349850EB845038E7114", "A580B97F8529FDF40F97412C", "55A66BA933C3495997C15594", "4AA1B4842EC31035DCE480E0", "AEC4572527145FBE9E4993DD", "562BB8CFCD0A1F9ECDE21F76", "0E2C0AE2117C5F421E220499", "CE451357FC0D99AE8C4EE67B", "CB8A174452AC316EC838DA68", "70DA20F35C1A4C90BAEE10D7", "E9678311A2A8B082A9B41862", "C38AB3C3BAACF806D4058083", "C4313FB4327662C36AC72EDF", "C44D7FD306B94425BBC7A773", "F3FFC7099BA644DB94DF5CB5", "9EFF7A8D95EE43E09BBA59E4", "F21D4A4A9C944E65BC8ACD86", "B7BBF2A3F2694A568A61D386", "2A40B90F6E094760B0096543", "6F792111AA1A45F4AC43C88D", "C8F6506B61644952A9BF63A4", "B99E8482EF4D432BB75A7208", "0B98CAAED29147C2A9F41235", "6D8D6B4DBF8A47A58CF29FE9", "EF5EF6D0B9FFD1AB15254023", "E2C396BDDFD731870AF6FB2A", "F43CE0F6B2DAF81CD179CB6F", "CC132EE385DA881BD4DCA57B", "231A0BA3D7C801225FA37FDB", "F3D473087068BB633C8C702A", "1E4875CCA95460AA52AD2B81", "7EAB69413B38295B7CA296AE", "9CAE749D8AB221D102E30A7F", "3751710BBB55533CB443C9FA", "A4591BA92F742F6391030E49", "6821A09FED7BADAC6BECF31A", "9C79D4174BC1754ECEAD57F4", "0A4637851D468329C2083C52", "55DFF6E49F622F0A21413DB5", "B294A681FB145E247CD9A0AB", "013449CA1722DF0C931F9DE5", "D12EE9C1539B3AE08B63FB62", "1ACA29FFE61B4FC75D5CC2B7", "950ADC0DE4A7A40C9EFBF166", "728869EEB87FC0748D62CB24", "567330BB70007C6608EACAE1", "8E63C4558155B5BF4699C97C", "FE8B253CCFE3C9B4270392AB", "3368C67DD7A2BA752FE66836", "08BF3262C4F6D6524BBD7771", "A16F7147050A338621352C50", "84B4F9D8083AB74FCBD760BA", "5649B6F058AAAA1A3A3A2FA2", "C25E1715741B058361CDB1FD", "CA07762B315208F7D4A30C08", "203FB8FDCAC6F57D130FFF02", "07D97EEBA10839D07DCCB342", "1BDD1FF8C48D02CA10DD92FC", "A895CDF026127EFF21ADF4B0", "E69EAE49FED6446A570E8F3F", "CF3884F321A5A3DF418F1BE9", "8A282B24BDB2E894E35D6484", "34A313721E6D194EB335D349", "EF9CEB9137BF4E85B6298570", "8FDD05D1D52DBC3A1FF7783B", "CA49509E1099B7093F6720B6", "4DC3A61A9234CF72E74EC151", "E7BD192DD80EBD06DA8D317A", "3C83719349A289354BE220B7", "2D2D1B341FD336CBD1B9FABF", "BA6EAF8E9B1295BF8AA57033", "2F0B89E52F88B95187D854BC", "BACDA3E9F7E5C157E407B3BD", "26E0779073F124552DDA1FC3", "54EBA5065C7FBFC1F3BE4A2C", "A4F82DE700734CB19363B90F", "74958BD7A65C45B0831CC5D9", "CE32E653113F511ACA12E634", "DA81B746862A067A2E870F6D", "DC7C47BFE2337F926A9A9DCF", "87B596E0142295AFED133314", "7FA1319B5B2C44409E818261", "9FCD56623E462DF84A1F5D33", "1D065D4295BBB5D3EF086608", "7813F348617408CFB44D5045", "C6903FDDE3354D355CF8B003", "64C772F03DEC80943B794912", "959BDD9466FCFAE06B46D84C", "721953EDBA2Line truncated
B7E302195F6A9DD0DEDAAE81, "F69A6B3CA6DADD9644B13172", "E28A5CEB274AF11A9D4D64A7", "8FB86FADC3423CED521C855A", "F097A5A4144D30372FD572EC", "9A7580D6B22390B635A19F89", "BE28275CD8BD625C772155F9", "356F4572114E7AAE0F5954D9", "CAADC64B387B05820E0F1B3A", "2A41A057C987C99C16326EC3", "21BB5980BE79619891B2E0F3", "41058564FCF0CD603FF6F83B", "F112F84DEFA54BBF6A74AA9D", "64E852CA1B43CE2EE5509DC4", "43DE6A833C76FCEB0BB16373", "F0405E77CEC80758A4B05E20", "94CD4919A1DF7FB2A7F00A39", "B81E845A0F5F9ADBA178782E", "27128C761CE524CD4E616E0F", "E4A6B8FD70C6B71C8A8946F8", "E5C6EC6275ECA4B6620F751A", "1F877766F277CE8D98FC4C98", "75C2926B75F8D566C90F8814", "6A45AA20DAD66943C6609278", "F43A4EA6B12A2844D9913AFB", "30F9AA558484279D418BC2AB", "7D24D7E8433052B54A98F9B4", "66AB557EF31F72BCE23B6C20", "32336CE2F512DBFD6C8C33B6", "B144E6CCF412FA4F6ED667BE", "0E6F18DF1BB7BDC2B522D565", "88362186D105AC38CDC1F34B", "A2C86680E706C6EB896624F7", "1D76124E803555F5B3BB4858", "227B8433ABAD08C1540FDFB7", "5FE510E3299964E905F2EEC1", "1DA339454EE1D551B57EE722", "111F36A223EDA8FB8B1BAA87", "BCB4A9FFE10489971342B925", "4D475CC90EDE6383ADE44783", "1F48315B00236C831CD0B0C6", "18EBAF7CBB4C8D0AAE871090", "A09EE5D651D37597BCCE1549", "2DCC205FFB836A66A37E98B5", "4A02035CF876A8F80E66524A", "F59D1FEA561570A5236F53C0", "D8156871A65DFAA5E40891F8", "F6973CC082553C582B6A3B7B", "68C882F50C29460AAE9C6CD9", "647C43E622AA4F1F81D75AED", "DCA00E415E794E4482CD7799", "2DD34F1B46E94A1A86EE1F03", "43EBAF4A0A62FA8383A1FF2E", "3DD59A0CA93F9FAEC2C852A2", "208538707397447D90B15973", "3B04447D7EB864E7D58E52B2", "37D733ED816B587FB560594E", "7BF84CEED0675652AF613D1A", "474645F3EE3BE43A1F533D5A", "F44C9C01432D4A6C9F4097C7", "570064B66DCCAAD7E2F3CA71", "FD32EAB5B2533D984DD976F8", "44B68B934274129184A15323", "E5FCCCC1D2A8FE933B994C9D", "B044E18CD3014FF408A9291A", "2BA7ED90FFE5683113F61261", "ACE8F17CB88D435E5F71D748", "49A277CE344C81A8103F9BD1", "F76252FB385F90EA6F98554A", "D3EC96D0345BAE991C2175CE", "24ABDC75474C17E968329F66", "24846F930A11A3874CD0E3AB", "3948D8BCE2CEDDCBAAD2D511", "C6887E3A78DD2AB54009B828", "93C59213A46CB5EAFA9D40FE", "50AB38A10915155BF160E42F", "17A0EFD8B103844E5859BA7E", "D0AF485FCA65EC7940378639", "2716C73C955C5C8E0B2B6C1A", "82C12517D7D11B3AA69F9046", "38BCC7DDD753A027AE474C89", "56C4880ED2F21F08B4AB77D4", "74760C1D3D15D406B0610E1E", "BDB17300AB97E41E167979B0", "FD98C1AE6C87F81FD173F957", "9AEDE29DCDAA6CF71A09BEA5", "FF089E4556B82BB4560B85C1", "47294DE31D6B1DFF73C290C4", "6A135315F7001AE1D296A661", "09BA63DA8E16C7E108595B1B", "0A7CDBE73C21566EC2A908D3", "4D367349850EB845038E7114", "A580B97F8529FDF40F97412C", "55A66BA933C3495997C15594", "4AA1B4842EC31035DCE480E0", "AEC4572527145FBE9E4993DD", "562BB8CFCD0A1F9ECDE21F76", "0E2C0AE2117C5F421E220499", "CE451357FC0D99AE8C4EE67B", "CB8A174452AC316EC838DA68", "70DA20F35C1A4C90BAEE10D7", "E9678311A2A8B082A9B41862", "C38AB3C3BAACF806D4058083", "C4313FB4327662C36AC72EDF", "C44D7FD306B94425BBC7A773", "F3FFC7099BA644DB94DF5CB5", "9EFF7A8D95EE43E09BBA59E4", "F21D4A4A9C944E65BC8ACD86", "B7BBF2A3F2694A568A61D386", "2A40B90F6E094760B0096543", "6F792111AA1A45F4AC43C88D", "C8F6506B61644952A9BF63A4", "B99E8482EF4D432BB75A7208", "0B98CAAED29147C2A9F41235", "6D8D6B4DBF8A47A58CF29FE9", "EF5EF6D0B9FFD1AB15254023", "E2C396BDDFD731870AF6FB2A", "F43CE0F6B2DAF81CD179CB6F", "CC132EE385DA881BD4DCA57B", "231A0BA3D7C801225FA37FDB", "F3D473087068BB633C8C702A", "1E4875CCA95460AA52AD2B81", "7EAB69413B38295B7CA296AE", "9CAE749D8AB221D102E30A7F", "3751710BBB55533CB443C9FA", "A4591BA92F742F6391030E49", "6821A09FED7BADAC6BECF31A", "9C79D4174BC1754ECEAD57F4", "0A4637851D468329C2083C52", "55DFF6E49F622F0A21413DB5", "B294A681FB145E247CD9A0AB", "013449CA1722DF0C931F9DE5", "D12EE9C1539B3AE08B63FB62", "1ACA29FFE61B4FC75D5CC2B7", "950ADC0DE4A7A40C9EFBF166", "728869EEB87FC0748D62CB24", "567330BB70007C6608EACAE1", "8E63C4558155B5BF4699C97C", "FE8B253CCFE3C9B4270392AB", "3368C67DD7A2BA752FE66836", "08BF3262C4F6D6524BBD7771", "A16F7147050A338621352C50", "84B4F9D8083AB74FCBD760BA", "5649B6F058AAAA1A3A3A2FA2", "C25E1715741B058361CDB1FD", "CA07762B315208F7D4A30C08", "203FB8FDCAC6F57D130FFF02", "07D97EEBA10839D07DCCB342", "1BDD1FF8C48D02CA10DD92FC", "A895CDF026127EFF21ADF4B0", "E69EAE49FED6446A570E8F3F", "CF3884F321A5A3DF418F1BE9", "8A282B24BDB2E894E35D6484", "34A313721E6D194EB335D349", "EF9CEB9137BF4E85B6298570", "8FDD05D1D52DBC3A1FF7783B", "CA49509E1099B7093F6720B6", "4DC3A61A9234CF72E74EC151", "E7BD192DD80EBD06DA8D317A", "3C83719349A289354BE220B7", "2D2D1B341FD336CBD1B9FABF", "BA6EAF8E9B1295BF8AA57033", "2F0B89E52F88B95187D854BC", "BACDA3E9F7E5C157E407B3BD", "26E0779073F124552DDA1FC3", "54EBA5065C7FBFC1F3BE4A2C", "A4F82DE700734CB19363B90F", "74958BD7A65C45B0831CC5D9", "CE32E653113F511ACA12E634", "DA81B746862A067A2E870F6D", "DC7C47BFE2337F926A9A9DCF", "87B596E0142295AFED133314", "7FA1319B5B2C44409E818261", "9FCD56623E462DF84A1F5D33", "1D065D4295BBB5D3EF086608", "7813F348617408CFB44D5045", "C6903FDDE3354D355CF8B003", "64C772F03DELine truncated
"E55D54021BC2D28E672F34F6",
"3ACD269D8F99B7C9B111B453",
"37F38A6A02220B5BCC6A0B4E",
@@ -2096,7 +2101,7 @@ B7E302195F6A9DD0DEDAAE81, "F69A6B3CA6DADD9644B13172", "E28A5CEB274AF11A9D4D64A7"
"DC76E9F0C0006E8F919E0C51" = {
"isa" = "PBXGroup";
"children" = ( "1893D6FB6CB3BF8A429B887C",
8C395B59B89AD94C577095CC, "01B2CD4F57507B2482FA993D", "BDB9AD06DF2962978FC5E007", "D481BB9B31A0A44756A2C642", "B1E09D51DE234384B03D6D01", "CB17E83394A9C5DF26C5FFF1", "C7751857B7E10600A291771F", "FAD4DB6739AE4807ADA3C27B", "91E042FFB6E1419B8931E646", "067A7A84E2E4F118095A8BB3", "9DCB740145E540C996E6692F", "312B00F5A13D4921AE264A2A", "5B5BB817A4524500B7E3CB1E", "53272DD2F81E40B2AF672610", "0F12DBE149CE0CD675AA66F8", "52B95FA5ED31A04909EFE857", "781F14A708182E90BDE108E3", "00B808A7780A251CC29CB06B", "7E6AA63365575C8888A99124", "C445DF085F7C807B908C19CB", "5421B06971D847A1A805F702", "9254269AE4824C5B8AAA4996", "16504192DF96663A78D5DFA8", "27644F1DECBC432E1B2768B8", "D333DD1A438EB4BC0A55464B", "C321FDC49814C39490B20F79", "0F7A6228BA94CC0C12A84F39", "16D176D2DB64F7417D6ACFC8", "530ADB2D5152809BD56B4BED", "5F75B5064C7FDFAC8800C0D3", "F12C3866E3125783A11526D4", "F797210E51F1F0B1CD8FF395", "49569D327A43047408F2DEAE", "5A3424F913D65182707784B8", "51E4344CADBA88EC0446EEA7", "792A514D818919EDF5F34717", "A1F993CAF2D203E517890FD7", "901D1E1FBB7B60F19AD95144", "07DA06A775F9267984E51EEC", "11A4CB4B8DF107985B0CB524", "7B1F352E41BE60388711F023", "9E3128773E24559995067F7F", "14868044C1345013A7F60685", "11EC6918F3B91AEE9FFB49F7", "9D6A737AD809CB34F0980691", "FFC326493D8F4603BD28BB6B", "C6A3EB89A975DDC859E73A36", "8BB8CC2C6D97EC712B6F9399", "EEEDC5273980EA83CBC757C5", "733493F7C9E00346B4010B62", "33C98A5D72682FD6AC0E5F62", "A748DE9CAD2C1300FF48663D", "F57F14F4BFF647EF7FDB64CC", "5BFFA01A19C5FC41EF60EE4A", "1B9725597009D3DE68DF62E3", "F80D3145FD907815FDAF4BA7", "1A6A84C4CFAE563E14CE3FF0", "58F6CDBEF369605DFC3FCA85", "F415937106477DDE7F72A7B8", "14F91CCC9DF1CB8D35001AEE", "EFF84673C3646AA99164A863", "5B72E96E835077666362CF7A", "A39C36931B6A59B325F0FB90", "B64B0E42CAB9E1342A8BD94F", "F0C6E8F2BD38C724C36913D6", "6CE23109A4C2422F878E5C78", "BCCC0E3132CFE859BA8542F6", "BB100B517FD5ADB833B0B9C0", "9426E9B4DB9CAF1E6EAFA927", "EF7750B1163369DD13DD5CE1", "A7B7BA8AEF5A062CF3C843DF", "F6B4DAA016C1911A09758E63", "5143771599404245B3DEA52E", "760BA2B4DE5F2E924A84BF1D", "C2646126B83489FB52DC1D6E", "14AE753173354D3EB5864563", "F82EC7B41E234EADA1CF84D1", "A3C1EA3C22CE43C8892A802C", "BA967E7658F745E1BC0ED7F2", "4F0596325DE3470A80EFE4EA", "3BDB3184317E405C82B06486", "5866911856DA41268827A601", "D168EF13EB20422AACCD96E2", "15ABD5DCBAFD4B6DAE418797", "BE84A652C2B04396BCBB921A", "455C6D7E1EB546C4B5A75AAF", "D70CBBA8530C6BC9B02AB379", "4B8AEF880E57EE0677BC1153", "F54CF4225FFCED7D7F647951", "67FB937B65ACB9D4278CFA4E", "3598AF219C2977DF6C4A5C2F", "F87E4A23CC0809CEA94F12E6", "E8ACFC9B89CAD012A308C316", "9DB93A677589CE78172A44A7", "4F76A349DB6B5A0F9E6A2C43", "E81B18C39152139A6105B84E", "25A93A2467BFAAED3F191E1B", "5BFC3293E94D0E3351244621", "D8248EBAF73CAB10C7C448FB", "217DC0F34A56DA5C4BB91E77", "A0DF98B8016880CAF0C0CD58", "42D841F636995F06C9332A0C", "31A4FF4E73AF3B5CFC309F60", "749C4BDB6AC37B600911C9C9", "39A991CE28D47963DE7E15F3", "A18B9CFC47DCA8A891571318", "1A65828188431AEC64A2EF1F", "C0CF07236765657B1CF3A441", "6DEBF620342B2A4B3AE5BCB1", "90FBFEB8BEE4D4B5EA4FF8B0", "6679E2C250A647804D193528", "8692D98EA40F7B2EE5EE136F", "3D4B95521A762F5E8B8ABB14", "EBC28D481E37A6D95550ED04", "9749C3A6E351964032384A3D", "79604D0603B58EC1CC2A9DA2", "91B7567AB5800567DAC343CD", "AFE25089ECEE6A77C768C432", "B4051C9774DFB5E15D886F79", "FB41D37D8F4F766B6F337A30", "5D4CCAE92059989714989D6B", "0F7F71696BF73C2A0921178C", "C05CBCBB0DDDF3E9B71ED4AB", "6E861FD0CA44590764FE438B", "C99C3267AC413B97551BD1EF", "472AC2CCB232639BB577696C", "A02293D0378FF4DA75C39EB5", "18267AA57F2798E15C7DEA3C", "4E1B73C4B6AD14CC00967423", "EDC3E15D86A8D4874AD0C180", "2711817C64CE46C182C5A8E9", "E5ADAD330B664E2BBC535C6A", "C6249A99265F026C199FD295", "5E52CBA4F430EC64E65E4239", "1AAB13C7AEC9576FCE909B30", "ACAA7FB0B84ABBE3CC50469D", "FC1ACF21BD5C46FC8CF22B60", "F147DB0A0B7B363C0181BBC4", "CE053132399860C266BA4115", "36D1A8AB53B6003A6A4B68D1", "45A42226A532DA306D381520", "29CCFF9C7E6B33DDB3DDA617", "EF0BA4677314B7DCCE726359", "68ABF5E4DB7DD34B8CC7EBA4", "2C765C18C64E564F954A7173", "9B68DF21D14BBFC0C977A0A8", "4C0DBA3B44DA84392AA3796A", "80C6105AD9495A0EB1F4A58C", "9F3C15DE610B4BFABF101002", "9F3C15DE610B4BFABF101003", "9F3C15DE610B4BFABF101001", "7339FE1A16674B2588333001", "3AE8BC7E4A8F296EB0B7AEFD", "2ECB4508563F3873B436B9EE", "277E06BEAA4F5310C0718CF2", "796FD8945B70098E2E2C7B92",
8C395B59B89AD94C577095CC, "01B2CD4F57507B2482FA993D", "BDB9AD06DF2962978FC5E007", "87E2AF0BA86F733A89C4948C", "D481BB9B31A0A44756A2C642", "B1E09D51DE234384B03D6D01", "CB17E83394A9C5DF26C5FFF1", "66DDF50B2F00881C339F9F00", "C7751857B7E10600A291771F", "FAD4DB6739AE4807ADA3C27B", "91E042FFB6E1419B8931E646", "067A7A84E2E4F118095A8BB3", "9DCB740145E540C996E6692F", "312B00F5A13D4921AE264A2A", "5B5BB817A4524500B7E3CB1E", "53272DD2F81E40B2AF672610", "0F12DBE149CE0CD675AA66F8", "52B95FA5ED31A04909EFE857", "781F14A708182E90BDE108E3", "00B808A7780A251CC29CB06B", "7E6AA63365575C8888A99124", "C445DF085F7C807B908C19CB", "5421B06971D847A1A805F702", "9254269AE4824C5B8AAA4996", "16504192DF96663A78D5DFA8", "27644F1DECBC432E1B2768B8", "D333DD1A438EB4BC0A55464B", "C321FDC49814C39490B20F79", "0F7A6228BA94CC0C12A84F39", "16D176D2DB64F7417D6ACFC8", "530ADB2D5152809BD56B4BED", "5F75B5064C7FDFAC8800C0D3", "F12C3866E3125783A11526D4", "F797210E51F1F0B1CD8FF395", "49569D327A43047408F2DEAE", "5A3424F913D65182707784B8", "51E4344CADBA88EC0446EEA7", "792A514D818919EDF5F34717", "A1F993CAF2D203E517890FD7", "901D1E1FBB7B60F19AD95144", "07DA06A775F9267984E51EEC", "11A4CB4B8DF107985B0CB524", "7B1F352E41BE60388711F023", "9E3128773E24559995067F7F", "14868044C1345013A7F60685", "11EC6918F3B91AEE9FFB49F7", "9D6A737AD809CB34F0980691", "FFC326493D8F4603BD28BB6B", "C6A3EB89A975DDC859E73A36", "8BB8CC2C6D97EC712B6F9399", "EEEDC5273980EA83CBC757C5", "733493F7C9E00346B4010B62", "33C98A5D72682FD6AC0E5F62", "A748DE9CAD2C1300FF48663D", "F57F14F4BFF647EF7FDB64CC", "5BFFA01A19C5FC41EF60EE4A", "1B9725597009D3DE68DF62E3", "F80D3145FD907815FDAF4BA7", "1A6A84C4CFAE563E14CE3FF0", "58F6CDBEF369605DFC3FCA85", "F415937106477DDE7F72A7B8", "14F91CCC9DF1CB8D35001AEE", "EFF84673C3646AA99164A863", "5B72E96E835077666362CF7A", "A39C36931B6A59B325F0FB90", "B64B0E42CAB9E1342A8BD94F", "F0C6E8F2BD38C724C36913D6", "6CE23109A4C2422F878E5C78", "BCCC0E3132CFE859BA8542F6", "BB100B517FD5ADB833B0B9C0", "9426E9B4DB9CAF1E6EAFA927", "EF7750B1163369DD13DD5CE1", "A7B7BA8AEF5A062CF3C843DF", "F6B4DAA016C1911A09758E63", "5143771599404245B3DEA52E", "760BA2B4DE5F2E924A84BF1D", "C2646126B83489FB52DC1D6E", "14AE753173354D3EB5864563", "F82EC7B41E234EADA1CF84D1", "A3C1EA3C22CE43C8892A802C", "BA967E7658F745E1BC0ED7F2", "4F0596325DE3470A80EFE4EA", "3BDB3184317E405C82B06486", "5866911856DA41268827A601", "D168EF13EB20422AACCD96E2", "15ABD5DCBAFD4B6DAE418797", "BE84A652C2B04396BCBB921A", "455C6D7E1EB546C4B5A75AAF", "D70CBBA8530C6BC9B02AB379", "4B8AEF880E57EE0677BC1153", "F54CF4225FFCED7D7F647951", "67FB937B65ACB9D4278CFA4E", "3598AF219C2977DF6C4A5C2F", "F87E4A23CC0809CEA94F12E6", "E8ACFC9B89CAD012A308C316", "9DB93A677589CE78172A44A7", "4F76A349DB6B5A0F9E6A2C43", "E81B18C39152139A6105B84E", "25A93A2467BFAAED3F191E1B", "5BFC3293E94D0E3351244621", "D8248EBAF73CAB10C7C448FB", "217DC0F34A56DA5C4BB91E77", "A0DF98B8016880CAF0C0CD58", "42D841F636995F06C9332A0C", "31A4FF4E73AF3B5CFC309F60", "749C4BDB6AC37B600911C9C9", "39A991CE28D47963DE7E15F3", "A18B9CFC47DCA8A891571318", "1A65828188431AEC64A2EF1F", "C0CF07236765657B1CF3A441", "6DEBF620342B2A4B3AE5BCB1", "90FBFEB8BEE4D4B5EA4FF8B0", "6679E2C250A647804D193528", "8692D98EA40F7B2EE5EE136F", "3D4B95521A762F5E8B8ABB14", "EBC28D481E37A6D95550ED04", "9749C3A6E351964032384A3D", "79604D0603B58EC1CC2A9DA2", "91B7567AB5800567DAC343CD", "AFE25089ECEE6A77C768C432", "B4051C9774DFB5E15D886F79", "FB41D37D8F4F766B6F337A30", "5D4CCAE92059989714989D6B", "0F7F71696BF73C2A0921178C", "C05CBCBB0DDDF3E9B71ED4AB", "6E861FD0CA44590764FE438B", "C99C3267AC413B97551BD1EF", "472AC2CCB232639BB577696C", "A02293D0378FF4DA75C39EB5", "18267AA57F2798E15C7DEA3C", "4E1B73C4B6AD14CC00967423", "EDC3E15D86A8D4874AD0C180", "2711817C64CE46C182C5A8E9", "E5ADAD330B664E2BBC535C6A", "C6249A99265F026C199FD295", "5E52CBA4F430EC64E65E4239", "1AAB13C7AEC9576FCE909B30", "ACAA7FB0B84ABBE3CC50469D", "FC1ACF21BD5C46FC8CF22B60", "F147DB0A0B7B363C0181BBC4", "CE053132399860C266BA4115", "36D1A8AB53B6003A6A4B68D1", "45A42226A532DA306D381520", "29CCFF9C7E6B33DDB3DDA617", "EF0BA4677314B7DCCE726359", "68ABF5E4DB7DD34B8CC7EBA4", "2C765C18C64E564F954A7173", "9B68DF21D14BBFC0C977A0A8", "4C0DBA3B44DA84392AA3796A", "80C6105AD9495A0EB1F4A58C", "9F3C15DE610B4BFABF101002", "9F3C15DE610B4BFABF101003", "9F3C15DE610B4BFABF101001", "7339FE1A16674B2588333001", "3AE8BC7E4A8F296EB0B7AEFD", "2ECB4508563F3873B436B9EE", "277E06BEAA4F5310C0718CF2", "796FD8945B70098E2E2C7B92",
"445AFB9A10CBBAE48539A39F",
"6BD293692BB0058E467291CC",
"C015745C6395762B28454414",
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme LastUpgradeVersion="1600" version="1.3">
<BuildAction parallelizeBuildables="YES" buildImplicitDependencies="YES"><BuildActionEntries><BuildActionEntry buildForTesting="YES" buildForRunning="YES" buildForProfiling="YES" buildForArchiving="YES" buildForAnalyzing="YES"><BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="DFD299825CB67449ECA89656" BuildableName="VCC Plus OSS.app" BlueprintName="VCCMac" ReferencedContainer="container:VCC.xcodeproj"/></BuildActionEntry></BuildActionEntries></BuildAction>
<TestAction buildConfiguration="Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.IDEFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv="YES"><Testables><TestableReference skipped="NO" parallelizable="NO"><BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="430E514662AEA1D2F10F5EBC" BuildableName="VCCCoreTests.xctest" BlueprintName="VCCCoreTests" ReferencedContainer="container:VCC.xcodeproj"/></TestableReference></Testables></TestAction>
<LaunchAction buildConfiguration="Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.IDEFoundation.Launcher.LLDB" launchStyle="0" useCustomWorkingDirectory="NO" ignoresPersistentStateOnLaunch="NO" debugDocumentVersioning="YES" debugServiceExtension="internal" allowLocationSimulation="YES"><BuildableProductRunnable runnableDebuggingMode="0"><BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="DFD299825CB67449ECA89656" BuildableName="VCC Plus OSS.app" BlueprintName="VCCMac" ReferencedContainer="container:VCC.xcodeproj"/></BuildableProductRunnable></LaunchAction>
<TestAction buildConfiguration="Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv="YES"><Testables><TestableReference skipped="NO" parallelizable="NO"><BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="430E514662AEA1D2F10F5EBC" BuildableName="VCCCoreTests.xctest" BlueprintName="VCCCoreTests" ReferencedContainer="container:VCC.xcodeproj"/></TestableReference></Testables></TestAction>
<LaunchAction buildConfiguration="Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle="0" useCustomWorkingDirectory="NO" ignoresPersistentStateOnLaunch="NO" debugDocumentVersioning="YES" debugServiceExtension="internal" allowLocationSimulation="YES"><BuildableProductRunnable runnableDebuggingMode="0"><BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="DFD299825CB67449ECA89656" BuildableName="VCC Plus OSS.app" BlueprintName="VCCMac" ReferencedContainer="container:VCC.xcodeproj"/></BuildableProductRunnable></LaunchAction>
<ProfileAction buildConfiguration="Release" shouldUseLaunchSchemeArgsEnv="YES" savedToolIdentifier="" useCustomWorkingDirectory="NO" debugDocumentVersioning="YES"><BuildableProductRunnable runnableDebuggingMode="0"><BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="DFD299825CB67449ECA89656" BuildableName="VCC Plus OSS.app" BlueprintName="VCCMac" ReferencedContainer="container:VCC.xcodeproj"/></BuildableProductRunnable></ProfileAction>
<AnalyzeAction buildConfiguration="Debug"/><ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES"/>
</Scheme>
@@ -7,14 +7,14 @@
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction buildConfiguration="UITesting" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.IDEFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv="YES">
<TestAction buildConfiguration="UITesting" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv="YES">
<Testables>
<TestableReference skipped="NO" parallelizable="NO">
<BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="05FBA9C2CB41DF69785786F1" BuildableName="VCCUITests.xctest" BlueprintName="VCCUITests" ReferencedContainer="container:VCC.xcodeproj"/>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction buildConfiguration="UITesting" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.IDEFoundation.Launcher.LLDB" launchStyle="0" useCustomWorkingDirectory="NO" ignoresPersistentStateOnLaunch="YES" debugDocumentVersioning="YES" debugServiceExtension="internal" allowLocationSimulation="YES">
<LaunchAction buildConfiguration="UITesting" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle="0" useCustomWorkingDirectory="NO" ignoresPersistentStateOnLaunch="YES" debugDocumentVersioning="YES" debugServiceExtension="internal" allowLocationSimulation="YES">
<BuildableProductRunnable runnableDebuggingMode="0">
<BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="DFD299825CB67449ECA89656" BuildableName="VCC Plus OSS.app" BlueprintName="VCCMac" ReferencedContainer="container:VCC.xcodeproj"/>
</BuildableProductRunnable>