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

+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)