Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

Onboarding legibility: explicit Done states, elapsed/expected timing, db-driven slow-step hints (#31)

Gauthier Piarrette72d86980d5cb
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 4081692..15394f7 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -17,6 +17,19 @@ final class AppState {
var stage = ""
var logLines: [String] = []
var showLog = false
+ // Onboarding legibility (#31): a first-time user should never have to guess whether
+ // something is working, finished, or stuck.
+ var stageHint = "" // recipe-declared "slow step, this is normal" text
+ var busyStartedAt: Date? // drives the "running for N min" row
+ var busyExpected: String? // human duration ("usually 20–40 minutes")
+ var lastOutputAt: Date? // liveness: when the task last produced output
+ var doneState: DoneState? // explicit success panel with an optional next step
+ struct DoneState {
+ var title: String
+ var ctaTitle: String?
+ var cta: (() -> Void)?
+ }
+ var requestCreateBottle = false // engine-done CTA → ContentView opens the sheet
// Onboarding
var rosettaInstalled = true
@@ -84,35 +97,28 @@ final class AppState {
private func appendLog(_ line: String) {
logLines.append(line)
if logLines.count > 400 { logLines.removeFirst(logLines.count - 400) }
- if let s = Self.stage(for: line) { stage = s }
- }
-
- /// Turns raw Wine/recipe output into a human stage line.
- static func stage(for line: String) -> String? {
- if let m = line.firstMatch(of: #/\[(?<r>[a-z0-9-]+)\] step (?<a>\d+)/(?<b>\d+)/#) {
- return "Step \(m.a) of \(m.b)"
+ lastOutputAt = Date()
+ if let s = ProgressParser.stage(for: line) {
+ stage = s
+ if s.hasPrefix("Step ") { stageHint = "" } // a new step retires the old hint
}
- if line.contains("Downloading update (") {
- if let m = line.firstMatch(of: #/\((?<x>[\d,]+) of (?<y>[\d,]+) KB\)/#) {
- return "Steam is updating itself — \(m.x) of \(m.y) KB"
- }
- return "Steam is updating itself"
- }
- if line.contains("Extracting package") { return "Extracting the Steam client — this takes a few minutes" }
- if line.contains("Installing update") { return "Installing the Steam client update" }
- if line.contains("Update complete") { return "Steam update complete — launching" }
- if line.hasPrefix("downloaded ") { return "Downloaded \(line.dropFirst(11))" }
- if line.contains("wineboot") && line.contains("start") { return "Preparing the Windows environment" }
- return nil
+ // Recipe slow-hints ("[dotnet48] hint: takes 20-40 min…") ride the same log stream.
+ if let h = ProgressParser.hint(for: line) { stageHint = h }
}
- private func runBusy(_ title: String, showLogSheet: Bool = true, cleanup: (() -> Void)? = nil, _ work: @escaping () async throws -> Void) {
- busy = true; busyTitle = title; stage = ""; logLines = []; showLog = showLogSheet
+ private func runBusy(_ title: String, expected: String? = nil, showLogSheet: Bool = true,
+ done: DoneState? = nil, cleanup: (() -> Void)? = nil,
+ _ work: @escaping () async throws -> Void) {
+ busy = true; busyTitle = title; stage = ""; stageHint = ""; logLines = []; showLog = showLogSheet
+ busyStartedAt = Date(); busyExpected = expected; lastOutputAt = nil; doneState = nil
Task {
// On failure, dismiss the log sheet ourselves: SwiftUI defers the error alert
// until the sheet closes, so a stuck sheet showed "Done" over a failed install
// and hid the alert until the user clicked Close (issues #27/#28).
- do { try await work() } catch { showLog = false; errorMessage = "\(error)" }
+ do {
+ try await work()
+ doneState = done ?? DoneState(title: L("Done"), ctaTitle: nil, cta: nil)
+ } catch { showLog = false; errorMessage = "\(error)" }
cleanup?()
busy = false
refresh()
@@ -125,7 +131,10 @@ final class AppState {
guard let manifestURL = Self.bundledManifest else {
errorMessage = "No engine manifest found. Reinstall Highball."; return
}
- runBusy("Installing engine — about 500 MB of verified downloads") { [self] in
+ runBusy("Installing engine — about 500 MB of verified downloads",
+ expected: L("usually 5–15 minutes"),
+ done: DoneState(title: L("Engine ready"), ctaTitle: L("Create your first bottle"),
+ cta: { [weak self] in self?.requestCreateBottle = true })) { [self] in
let manifest = try EngineManifest.load(from: manifestURL)
var accepted: Set<String> = []
if acceptGPTK { accepted.insert("apple-gptk-license-2023-08-17") }
@@ -151,7 +160,8 @@ final class AppState {
func createBottle(name: String, recipeID: String?) {
guard let engine = engines.first else { return }
- runBusy("Creating bottle '\(name)' — first boot takes about 90 seconds") { [self] in
+ runBusy("Creating bottle '\(name)' — first boot takes about 90 seconds",
+ done: DoneState(title: String(format: L("Bottle '%@' is ready"), name), ctaTitle: nil, cta: nil)) { [self] in
let bottle = try await bottleStore.create(name: name, engine: engine)
await MainActor.run { self.appendLog("bottle created") }
if let recipeID, let recipe = Self.recipe(recipeID) {
@@ -165,7 +175,8 @@ final class AppState {
func applyRecipe(_ id: String, to bottle: Bottle) {
guard let engine = engine(for: bottle), let recipe = Self.recipe(id) else { return }
- runBusy("Installing \(recipe.title)") { [self] in
+ runBusy("Installing \(recipe.title)",
+ done: DoneState(title: String(format: L("%@ installed"), recipe.title), ctaTitle: nil, cta: nil)) { [self] in
var runner = RecipeRunner(paths: paths, engine: engine, bottle: bottle)
let notes = try await runner.apply(recipe) { line in Task { @MainActor in self.appendLog(line) } }
for n in notes { await MainActor.run { self.appendLog("note: \(n)") } }
@@ -190,7 +201,15 @@ final class AppState {
return
}
launchingPins.insert(pin.id)
- runBusy("Running \(pin.name)", showLogSheet: false, cleanup: { [weak self] in self?.launchingPins.remove(pin.id) }) { [self] in
+ // Steam's very first launch bootstraps its client for 15–25 minutes and looks frozen the
+ // whole time (#31, #9). Detect it (no CEF dir yet) and show the progress sheet with honest
+ // expectations instead of launching silently into what reads as a hang.
+ let steamFirstBoot = isSteamUI(pin) && !FileManager.default.fileExists(
+ atPath: bottle.driveC.appending(path: "Program Files (x86)/Steam/bin/cef").path)
+ runBusy(steamFirstBoot ? L("Starting Steam for the first time — it downloads and unpacks its own client") : "Running \(pin.name)",
+ expected: steamFirstBoot ? L("usually 15–25 minutes; long quiet stretches are normal") : nil,
+ showLogSheet: steamFirstBoot,
+ cleanup: { [weak self] in self?.launchingPins.remove(pin.id) }) { [self] in
let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)
var extra = [String: String]()
if isSteamUI(pin), bottle.settings.sync != SyncMode.none {
diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swift
index 93f6420..d3e7cd7 100644
--- a/Sources/HighballApp/HighballApp.swift
+++ b/Sources/HighballApp/HighballApp.swift
@@ -184,6 +184,9 @@ struct ContentView: View {
}
}
.sheet(isPresented: $showCreate) { CreateBottleSheet() }
+ .onChange(of: state.requestCreateBottle) { _, wants in
+ if wants { showCreate = true; state.requestCreateBottle = false }
+ }
.confirmationDialog("Delete bottle \"\(pendingDelete ?? "")\"? This removes its Windows drive and everything installed in it.",
isPresented: .init(get: { pendingDelete != nil }, set: { if !$0 { pendingDelete = nil } }),
titleVisibility: .visible) {
@@ -255,8 +258,12 @@ struct LogSheet: View {
var body: some View {
VStack(alignment: .leading, spacing: 8) {
HStack {
- if state.busy { ProgressView().controlSize(.small) }
- Text(state.busy ? state.busyTitle : L("Done")).font(.headline)
+ if state.busy {
+ ProgressView().controlSize(.small)
+ } else if state.doneState != nil {
+ Image(systemName: "checkmark.circle.fill").foregroundStyle(.green)
+ }
+ Text(state.busy ? state.busyTitle : (state.doneState?.title ?? L("Done"))).font(.headline)
Spacer()
Button(state.busy ? "Hide" : "Close") { dismiss() }
}
@@ -265,6 +272,33 @@ struct LogSheet: View {
.font(.callout)
.foregroundStyle(.secondary)
}
+ // Recipe-declared expectation for the current step ("takes 20–40 min, looks idle").
+ // Shown while the step runs, so nobody has to guess whether it froze (#31).
+ if state.busy, !state.stageHint.isEmpty {
+ Label(state.stageHint, systemImage: "hourglass")
+ .font(.callout)
+ .foregroundStyle(.orange)
+ }
+ if state.busy, let started = state.busyStartedAt {
+ TimelineView(.periodic(from: .now, by: 15)) { ctx in
+ let mins = Int(ctx.date.timeIntervalSince(started) / 60)
+ let elapsed = mins < 1 ? L("just started") : String(format: L("running for %d min"), mins)
+ let liveness: String = {
+ guard let last = state.lastOutputAt else { return "" }
+ let quiet = ctx.date.timeIntervalSince(last)
+ if quiet < 90 { return " · " + L("active") }
+ // Quiet is expected during hinted-slow steps; the hint already explains it.
+ return state.stageHint.isEmpty ? " · " + L("quiet — can be normal, see Details") : ""
+ }()
+ Text(elapsed + (state.busyExpected.map { " · " + $0 } ?? "") + liveness)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+ }
+ if !state.busy, let done = state.doneState, let ctaTitle = done.ctaTitle {
+ Button(ctaTitle) { dismiss(); done.cta?() }
+ .buttonStyle(.borderedProminent)
+ }
DisclosureGroup(L("Details")) {
ScrollViewReader { proxy in
ScrollView {
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index e89c6b9..7344569 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -119,6 +119,20 @@ enum L10n {
"Une bouteille est un environnement Windows isolé. Le premier démarrage prend environ 90 secondes ; l’installation de Steam ajoute un téléchargement et une longue mise à jour initiale.",
"Create": "Créer",
"Done": "Terminé",
+ // Onboarding legibility (#31)
+ "Engine ready": "Moteur prêt",
+ "Create your first bottle": "Créez votre première bouteille",
+ "Bottle '%@' is ready": "La bouteille « %@ » est prête",
+ "%@ installed": "%@ installé",
+ "usually 5–15 minutes": "généralement 5 à 15 minutes",
+ "Starting Steam for the first time — it downloads and unpacks its own client":
+ "Premier démarrage de Steam — il télécharge et décompresse son propre client",
+ "usually 15–25 minutes; long quiet stretches are normal":
+ "généralement 15 à 25 minutes ; de longues périodes sans activité sont normales",
+ "just started": "vient de démarrer",
+ "running for %d min": "en cours depuis %d min",
+ "active": "actif",
+ "quiet — can be normal, see Details": "silencieux — peut être normal, voir Détails",
"Hide": "Masquer",
"Close": "Fermer",
"Details": "Détails",
diff --git a/Sources/HighballKit/ProgressParser.swift b/Sources/HighballKit/ProgressParser.swift
new file mode 100644
index 0000000..ab70216
--- /dev/null
+++ b/Sources/HighballKit/ProgressParser.swift
@@ -0,0 +1,34 @@
+import Foundation
+
+/// Turns raw Wine/recipe/Steam output lines into human progress ("Step 2 of 3 — Battle.net-Setup")
+/// and surfaces recipe slow-hints. Pure string logic, kept in the Kit so it is testable and shared;
+/// the app feeds it every log line (#31: nobody should have to read raw Wine output to know
+/// whether an install is working, finished, or stuck).
+public enum ProgressParser {
+ /// Human stage line for a raw output line, or nil if the line carries no stage information.
+ public static func stage(for line: String) -> String? {
+ if let m = line.firstMatch(of: #/\[(?<r>[a-z0-9-]+)\] step (?<a>\d+)/(?<b>\d+)(?: — (?<d>.+))?/#) {
+ if let d = m.d { return "Step \(m.a) of \(m.b) — \(d)" }
+ return "Step \(m.a) of \(m.b)"
+ }
+ if line.contains("Downloading update (") {
+ if let m = line.firstMatch(of: #/\((?<x>[\d,]+) of (?<y>[\d,]+) KB\)/#) {
+ return "Steam is updating itself — \(m.x) of \(m.y) KB"
+ }
+ return "Steam is updating itself"
+ }
+ if line.contains("Extracting package") { return "Extracting the Steam client — this takes a few minutes" }
+ if line.contains("Installing update") { return "Installing the Steam client update" }
+ if line.contains("Update complete") { return "Steam update complete — launching" }
+ if line.hasPrefix("downloaded ") { return "Downloaded \(line.dropFirst(11))" }
+ if line.contains("wineboot") && line.contains("start") { return "Preparing the Windows environment" }
+ return nil
+ }
+
+ /// The slow-expectation text from a recipe hint line ("[dotnet48] hint: takes 20–40 min…"),
+ /// or nil for any other line.
+ public static func hint(for line: String) -> String? {
+ guard line.hasPrefix("["), let r = line.range(of: "] hint: ") else { return nil }
+ return String(line[r.upperBound...])
+ }
+}
diff --git a/Sources/HighballKit/Recipe.swift b/Sources/HighballKit/Recipe.swift
index 61f6560..62ae53f 100644
--- a/Sources/HighballKit/Recipe.swift
+++ b/Sources/HighballKit/Recipe.swift
@@ -7,11 +7,13 @@ public struct Recipe: Codable, Sendable, Identifiable {
public enum Step: Codable, Sendable {
/// Download a file (verified if sha256 given) and run it inside the bottle.
- case installer(url: URL, sha256: String?, arguments: [String], label: String)
+ /// `slow` is a user-facing expectation for long steps ("takes 20-40 min, can look idle");
+ /// the app shows it while the step runs so nobody has to guess whether it froze (#31).
+ case installer(url: URL, sha256: String?, arguments: [String], label: String, slow: String?)
/// `wine reg add`.
case registry(key: String, name: String, type: String, data: String)
- /// Run winetricks verbs (unattended).
- case winetricks(verbs: [String])
+ /// Run winetricks verbs (unattended). `slow` as on `installer`.
+ case winetricks(verbs: [String], slow: String?)
/// Set a persistent environment variable on the bottle.
case environment(name: String, value: String)
/// Set the bottle's renderer.
@@ -25,7 +27,7 @@ public struct Recipe: Codable, Sendable, Identifiable {
/// Free-text instruction the UI surfaces to the user after install.
case note(String)
- private enum CodingKeys: String, CodingKey { case type, url, sha256, arguments, label, key, name, value, valueType, data, verbs, renderer, sync, path, contents, pin, text }
+ private enum CodingKeys: String, CodingKey { case type, url, sha256, arguments, label, slow, key, name, value, valueType, data, verbs, renderer, sync, path, contents, pin, text }
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
@@ -34,11 +36,13 @@ public struct Recipe: Codable, Sendable, Identifiable {
self = .installer(url: try c.decode(URL.self, forKey: .url),
sha256: try c.decodeIfPresent(String.self, forKey: .sha256),
arguments: try c.decodeIfPresent([String].self, forKey: .arguments) ?? [],
- label: try c.decodeIfPresent(String.self, forKey: .label) ?? "installer")
+ label: try c.decodeIfPresent(String.self, forKey: .label) ?? "installer",
+ slow: try c.decodeIfPresent(String.self, forKey: .slow))
case "registry":
self = .registry(key: try c.decode(String.self, forKey: .key), name: try c.decode(String.self, forKey: .name),
type: try c.decodeIfPresent(String.self, forKey: .valueType) ?? "REG_DWORD", data: try c.decode(String.self, forKey: .data))
- case "winetricks": self = .winetricks(verbs: try c.decode([String].self, forKey: .verbs))
+ case "winetricks": self = .winetricks(verbs: try c.decode([String].self, forKey: .verbs),
+ slow: try c.decodeIfPresent(String.self, forKey: .slow))
case "environment": self = .environment(name: try c.decode(String.self, forKey: .name), value: try c.decode(String.self, forKey: .value))
case "renderer": self = .renderer(try c.decode(Renderer.self, forKey: .renderer))
case "sync": self = .sync(try c.decode(SyncMode.self, forKey: .sync))
@@ -52,13 +56,16 @@ public struct Recipe: Codable, Sendable, Identifiable {
public func encode(to encoder: Encoder) throws {
var c = encoder.container(keyedBy: CodingKeys.self)
switch self {
- case let .installer(url, sha256, arguments, label):
+ case let .installer(url, sha256, arguments, label, slow):
try c.encode("installer", forKey: .type); try c.encode(url, forKey: .url)
try c.encodeIfPresent(sha256, forKey: .sha256); try c.encode(arguments, forKey: .arguments); try c.encode(label, forKey: .label)
+ try c.encodeIfPresent(slow, forKey: .slow)
case let .registry(key, name, type, data):
try c.encode("registry", forKey: .type); try c.encode(key, forKey: .key); try c.encode(name, forKey: .name)
try c.encode(type, forKey: .valueType); try c.encode(data, forKey: .data)
- case let .winetricks(verbs): try c.encode("winetricks", forKey: .type); try c.encode(verbs, forKey: .verbs)
+ case let .winetricks(verbs, slow):
+ try c.encode("winetricks", forKey: .type); try c.encode(verbs, forKey: .verbs)
+ try c.encodeIfPresent(slow, forKey: .slow)
case let .environment(name, value): try c.encode("environment", forKey: .type); try c.encode(name, forKey: .name); try c.encode(value, forKey: .value)
case let .renderer(r): try c.encode("renderer", forKey: .type); try c.encode(r, forKey: .renderer)
case let .sync(m): try c.encode("sync", forKey: .type); try c.encode(m, forKey: .sync)
@@ -67,6 +74,25 @@ public struct Recipe: Codable, Sendable, Identifiable {
case let .note(t): try c.encode("note", forKey: .type); try c.encode(t, forKey: .text)
}
}
+
+ /// Short human description for progress display ("Step 2 of 3 — Battle.net-Setup").
+ public var progressLabel: String? {
+ switch self {
+ case let .installer(_, _, _, label, _): return label
+ case let .winetricks(verbs, _): return verbs.joined(separator: " ")
+ case .registry: return nil
+ case .environment, .renderer, .sync, .file, .pin, .note: return nil
+ }
+ }
+
+ /// The step's slow-expectation text, if the recipe declared one.
+ public var slowHint: String? {
+ switch self {
+ case let .installer(_, _, _, _, slow): return slow
+ case let .winetricks(_, slow): return slow
+ default: return nil
+ }
+ }
}
public struct KnownIssue: Codable, Sendable {
@@ -135,10 +161,17 @@ public struct RecipeRunner: Sendable {
var notes: [String] = []
if let r = recipe.renderer { bottle.settings.renderer = r }
for (i, step) in recipe.steps.enumerated() {
- log?("[\(recipe.id)] step \(i + 1)/\(recipe.steps.count)")
+ // The app parses these two lines into its progress display (#31): the step line
+ // becomes the stage, the hint line the "this is slow, don't worry" text under it.
+ if let desc = step.progressLabel {
+ log?("[\(recipe.id)] step \(i + 1)/\(recipe.steps.count) — \(desc)")
+ } else {
+ log?("[\(recipe.id)] step \(i + 1)/\(recipe.steps.count)")
+ }
+ if let slow = step.slowHint { log?("[\(recipe.id)] hint: \(slow)") }
let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)
switch step {
- case let .installer(url, sha256, arguments, label):
+ case let .installer(url, sha256, arguments, label, _):
let component = EngineManifest.Component(kind: "installer", url: url, sha256: sha256 ?? "", size: nil, license: nil, optional: nil, acceptance: nil, extract: nil, note: nil, version: nil)
let file: URL
if sha256 != nil {
@@ -154,7 +187,7 @@ public struct RecipeRunner: Sendable {
}
case let .registry(key, name, type, data):
try await runner.regAdd(key: key, name: name, type: type, data: data)
- case let .winetricks(verbs):
+ case let .winetricks(verbs, _):
guard let wt = engine.winetricks else { throw HighballError.missing("winetricks in engine \(engine.id)") }
// WINE_BIN/WINESERVER_BIN/WINE_BINDIR are winetricks' own overrides for setups where
// its binary detection fails; without them dotnet48 and friends abort on this engine
diff --git a/Tests/HighballKitTests/RecipeDBTests.swift b/Tests/HighballKitTests/RecipeDBTests.swift
index ab1dcaf..d52fd39 100644
--- a/Tests/HighballKitTests/RecipeDBTests.swift
+++ b/Tests/HighballKitTests/RecipeDBTests.swift
@@ -28,7 +28,7 @@ final class RecipeDBTests: XCTestCase {
XCTAssertFalse(r.id.isEmpty, f.lastPathComponent)
XCTAssertFalse(r.title.isEmpty, f.lastPathComponent)
for step in r.steps {
- if case let .installer(url, _, _, _) = step {
+ if case let .installer(url, _, _, _, _) = step {
XCTAssertEqual(url.scheme, "https", "\(f.lastPathComponent): installer URLs must be https")
}
}
@@ -103,7 +103,7 @@ final class RecipeDBTests: XCTestCase {
}
let r = try JSONDecoder.highball.decode(Recipe.self, from: Data(contentsOf: f))
let installers = r.steps.compactMap { step -> URL? in
- if case let .installer(url, _, _, _) = step { return url } else { return nil }
+ if case let .installer(url, _, _, _, _) = step { return url } else { return nil }
}
XCTAssertFalse(installers.contains { $0.absoluteString.contains("webinstallers") },
"web installer fails its Windows 7 SP1 check under wine win10 — use the offline setup exe")
diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swift
index fadcf9f..f90444d 100644
--- a/Tests/HighballKitTests/RegressionTests.swift
+++ b/Tests/HighballKitTests/RegressionTests.swift
@@ -255,4 +255,44 @@ extension RegressionTests {
XCTAssertEqual(component.url.scheme, "https", "\(name): https only")
}
}
+
+ // Issue #31: install progress must be legible without reading raw Wine output. The step
+ // line carries the label, the hint line the slow-step expectation, and neither may leak
+ // into the other.
+ func testProgressParserStagesAndHints() {
+ XCTAssertEqual(ProgressParser.stage(for: "[steam] step 2/6"), "Step 2 of 6")
+ XCTAssertEqual(ProgressParser.stage(for: "[dotnet48] step 1/2 — dotnet48"),
+ "Step 1 of 2 — dotnet48")
+ XCTAssertNil(ProgressParser.stage(for: "[dotnet48] hint: takes 20-40 minutes"),
+ "hint lines are not stages")
+ XCTAssertEqual(ProgressParser.hint(for: "[dotnet48] hint: takes 20-40 minutes"),
+ "takes 20-40 minutes")
+ XCTAssertNil(ProgressParser.hint(for: "0024:err:something hint: not a recipe line"),
+ "hints must come from a [recipe] line, not arbitrary output")
+ XCTAssertEqual(ProgressParser.stage(for: "Extracting package foo"),
+ "Extracting the Steam client — this takes a few minutes")
+ XCTAssertNil(ProgressParser.stage(for: "plain wine noise"))
+ }
+
+ // Issue #31: the `slow` field must survive a decode/encode round trip, default to nil for
+ // existing recipes, and surface via slowHint for exactly the step kinds that can be slow.
+ func testRecipeSlowHintDecoding() throws {
+ let json = """
+ {"id":"t","kind":"tweak","title":"T","steps":[
+ {"type":"installer","url":"https://example.com/x.exe","label":"x",
+ "slow":"takes 20-40 minutes and can look idle"},
+ {"type":"winetricks","verbs":["corefonts"]},
+ {"type":"note","text":"done"}
+ ]}
+ """
+ let recipe = try JSONDecoder.highball.decode(Recipe.self, from: Data(json.utf8))
+ XCTAssertEqual(recipe.steps[0].slowHint, "takes 20-40 minutes and can look idle")
+ XCTAssertEqual(recipe.steps[0].progressLabel, "x")
+ XCTAssertNil(recipe.steps[1].slowHint, "absent slow decodes as nil")
+ XCTAssertEqual(recipe.steps[1].progressLabel, "corefonts")
+ XCTAssertNil(recipe.steps[2].slowHint)
+ let reencoded = try JSONEncoder().encode(recipe)
+ let again = try JSONDecoder.highball.decode(Recipe.self, from: reencoded)
+ XCTAssertEqual(again.steps[0].slowHint, "takes 20-40 minutes and can look idle")
+ }
}