// The page walk (lane threadload, 16 Oct 2026): launched with // `-page-walk /messages/,/people/person/,…` the app opens each route // in turn, back to Home between, `-page-walk-rounds` times (default 5), so // `PageClock` logs each open from the push — the timing a tap gives, with no // system "Open in…?" between, which a deep link from outside raises. // `scripts/perf/pages.py run` launches it on a simulator over a synthetic // household and reads the clock's lines. import CottonKit import Foundation import OSLog @MainActor enum PageWalk { private static var arguments: [String] { ProcessInfo.processInfo.arguments } private static let log = Logger(subsystem: "com.cottondb.page", category: "open") /// The routes asked for, or none. static var routes: [Route] { guard let at = arguments.firstIndex(of: "-page-walk"), at + 1 < arguments.count else { return [] } return arguments[at + 1].split(separator: ",").compactMap { Route.parse(String($0)) } } static var rounds: Int { guard let at = arguments.firstIndex(of: "-page-walk-rounds"), at + 1 < arguments.count else { return 5 } return Int(arguments[at + 1]) ?? 5 } /// Opens each route, `rounds` times, from Home; logs `walk: done` at the end. static func run(_ navigator: Navigator, settle: Duration = .seconds(3)) async { let routes = routes guard !routes.isEmpty else { return } try? await Task.sleep(for: .seconds(8)) // the first Home, arranged for _ in 0..