Skip to content

Simulator management for Stewed: simctl seam, Xcode resolution, version parsing - #29

Draft
leogdion wants to merge 14 commits into
mainfrom
simulator
Draft

leogdion wants to merge 14 commits into
mainfrom
simulator

Conversation

@leogdion

Copy link
Copy Markdown
Member

Brings the simulator branch, developed inside Stewed as a git subrepo, into main. Mirror issues: #27, #28.

What's in it

  • simctl commands: runtime list -j, list -j, runtime delete, delete, boot, shutdown, erase, each with typed throws (SimCtlError, with Failure, exit code, verbatim stderr and a Reason), and recorded simctl fixtures for the tests.
  • A simctl seam: the SimCtlCommands / SimCtlDeletionCommands protocols and the LiveSimCtlCommands actor, running on swift-subprocess, with a per-call developer directory.
  • Version and build parsing: VersionNumber, BuildNumber, VersionedBuild.
  • Xcode discovery and resolution: XcodeInstallation, XcodeSnapshot, XcodeLocating / XcodeLocator and XcodeResolution (pinned, xcode-select, or the newest installed).
  • Snapshot helpers: SimctlSnapshot, hardware names, runtime display names, DirectorySizeMeasurer, and public memberwise inits for SimulatorList and Runtime.
  • DocC catalog.

From brightdigit/Stewed#123, brightdigit/Stewed#150 and earlier Stewed alpha.1 work.

Before merging

  • CI green
  • Tag (suggested 1.1.0-beta.4)

Merging

  • Use "Create a merge commit", not squash. Stewed vendors this package with git subrepo, and its .gitrepo points at commits on simulator; a merge commit keeps them reachable from main and the tag.
  • Tag after merging; Stewed then switches from the vendored copy to this tag (brightdigit/Stewed#108, SPEC §3.4 exit rule).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

leogdion and others added 12 commits November 25, 2026 07:05
…shelCloud rework (#67, #68, #69, #70)

- #70 SimulatorServices: delete, boot, shutdown, and erase subcommands
- #68 Kit: status derivation, Select Superseded rule, and the 14 worked examples
- #67 Main window shell on mock data: window, sidebar, toolbar, status bar, restoration
- #69 BushelCloud: rework PR #38 (SDKVersion) onto v1.0.0-alpha.3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, #78, #84, #96)

- #74 Makefile setup/xcode/run targets, Local.xcconfig, build settings and asset catalog
- #84 Live RuntimeStore and simctl seam
- #76 Port verified gotchas into project memory
- #78 Offline banner and refresh on activation
- Add the Icon Composer app icon and pot-red accent colour
- #96 Stop the offline banner clipping the main window

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rows, Build workflow, beta via dispatch, release notes (#102)

- Add a Developer ID archive, notarize and upload workflow (#40)
- #102 Reorganize packages, fix code smells, and use SimulatorServices models
- Add make install and a throwaway keychain for archives
- Build workflow: public builds from main, internal builds from PRs into main or v*, beta or stable by production_release dispatch; About shows "1.0.0 beta N"
- Release notes: release-notes skill, first notes for v1.0.0-beta.1, Build checks
- Record the alpha.1 history rewrite and the subrepo parent follow-up in project memory

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…helpers move upstream (#123) (#131)

* SimulatorServices: version parsing, Xcode discovery types and simctl helpers (#123)

Moved from Stewed's StewedKit and StewedServices, now public with doc
comments:

- Versions: BuildNumber (+isDeviceTrain), VersionNumber,
  MajorMinorVersion, VersionedBuild, Int(asciiDigits:) and the internal
  UInt8 ASCII helpers.
- Xcode discovery value types: XcodeInstallation (+version.plist then
  Info.plist reading), XcodeSnapshot, [XcodeInstallation].normalized and
  installation(forDeveloperDirectory:), URL.asDirectory, XcodeToolOutput,
  XcodeDiscoveryError and the XcodeLocating protocol (without resolve).
- simctl helpers: SimctlSnapshot (images + list, imagesNeedingMeasurement
  filtered on reportedSizeBytes only), hardwareNames,
  RuntimeID.displayName and DirectorySizeMeasurer (macOS only).

Their Swift Testing suites move into SimulatorServicesTests, with the
Xcode 27.2 (27B48) discovery recording and the Xcode 27.2 (27B52)
runtime list under Tests/SimulatorServicesTests/Resources/. New tests
cover the snapshot core, hardwareNames and RuntimeID.displayName.

Stewed builds against these in the next commit; this commit alone leaves
duplicate type names in StewedKit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo5Jn64FbCcEPKQoUdp

* Use SimulatorServices' version, Xcode discovery and simctl types (#123)

StewedKit and StewedServices drop the code that moved to the
SimulatorServices subrepo and import it from there. What stays in
Stewed is policy built on top:

- BuildNumber.matchesBetaPattern (SPEC §3.3 last resort).
- XcodeLocating.resolve/resolution (XcodeLocating+Resolve.swift),
  XcodeResolution, XcodePreference, XcodeGateState, and XcodeLocator with
  its FSEvents watcher (Mutex needs macOS 15).
- SimctlSnapshot+Rows: runtimeRows, simulatorRows, and
  listedImagesNeedingMeasurement, which keeps the store measuring only
  images on listed platforms now that upstream filters on
  reportedSizeBytes alone.
- DirectorySizeMeasurer conforms to RuntimeSizeMeasuring by extension.
- SimulatorRow uses RuntimeID.displayName.

StewedUI depends on SimulatorServices for XcodeInstallation. The Xcode
discovery fixtures moved upstream except xcode-select-p.stdout, which
XcodeLocatorTests reads; simctl/xcode-27.2-27B52 stays because
HardwareVariantTests and SimulatorRuntimeRecordFixtureTests read it.
SPEC §3.0/§3.4 and the memory files name the new homes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo5Jn64FbCcEPKQoUdp

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…seam move upstream; swift-subprocess and actors (#150)

* SimulatorServices: Xcode resolution, the live Xcode locator, simulator attribution and the simctl command seam move upstream

Moved from Stewed's StewedKit and StewedServices, now public with doc
comments and no references to Stewed's SPEC:

- Xcode resolution: XcodeResolution (+Source), XcodeResolution.resolve,
  XcodeLocating.resolve/resolution and XcodePreference (Automatic or a
  pinned Xcode, stored as its rawValue; the user defaults key stays in
  the app).
- The live locator (macOS only): XcodeLocator (application folders,
  Spotlight, xcode-select), its FSEvents watcher (FSEventsPathWatch(er),
  PathWatch(ing), WatchedPaths), XcodeSnapshotUpdates and the tool
  runner (XcodeToolRunning, XcodeToolRunner, XcodeToolProcess).
  XcodeLocator() is public; the injectable init stays internal for
  tests. The FSEvents queue is com.brightdigit.SimulatorServices.*.
- SimulatorAttribution, now generic over RuntimeIdentifiable runtimes
  and simulators; RuntimeImage conforms (and is Identifiable by its
  identifier).
- The simctl command seam: SimCtlDeletionCommands, SimCtlCommands and
  LiveSimCtlCommands (macOS only), with UUID ids.

The package supports macOS 13, but Synchronization.Mutex needs macOS 15
and Swift Testing can't run suites marked @available. So the moved code
locks with a new internal Locked<State> over OSAllocatedUnfairLock,
with Mutex's withLock shape, instead of carrying availability.

Their Swift Testing suites move into SimulatorServicesTests/Xcode and
/Simulators (93 tests in 18 suites pass, plus the 87 XCTest tests).
XcodeLocatorLiveTests is still opt-in with
STEWED_XCODE_INTEGRATION_TESTS=1. Recorded output comes from the
existing Resources/xcode/xcode-27.2-27B48 fixtures.

Stewed builds against these in the next commit; this commit alone leaves
duplicate type names in Stewed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Use SimulatorServices' Xcode resolution, locator, attribution and simctl seam

StewedKit and StewedServices drop the code that moved to the
SimulatorServices subrepo and use it from there. What stays in Stewed
is policy:

- XcodePreference.storageKey ("Settings.xcode") as a StewedKit
  extension, with its own test; XcodeGateState; XcodePreferenceStore.
- RuntimeRow and SimulatorRow conform to RuntimeIdentifiable, so the
  generic SimulatorAttribution(runtimes:simulators:) takes the rows; no
  typealias is needed. Its row-level test (with the Sequence helpers)
  stays in StewedKitTests.
- The seam is renamed to the upstream names: RuntimeDeletionCommands ->
  SimCtlDeletionCommands, SimctlCommands -> SimCtlCommands,
  LiveSimctlCommands -> LiveSimCtlCommands. RuntimeDeletionPlan/Run,
  MockDeletionCommands, FakeSimctl and MockXcodeLocator stay.
- Files naming these types import SimulatorServices.
- docs/fixtures/xcode/ is gone: its last file, xcode-select-p.stdout,
  was byte-identical to SimulatorServices' copy and nothing in Stewed
  reads it any more.

SPEC §3.0/§3.4 and the memories name the new homes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* SimulatorServices: run commands with swift-subprocess; actors instead of locks

Every command SimulatorServices runs (xcrun, simctl, xcode-select,
mdfind) goes through swift-subprocess 1.0.x instead of Foundation's
Process:

- One internal seam, CommandRunning: a Command (executable, arguments,
  environment or nil to inherit) runs to a CommandOutput (stdout,
  stderr, .exited/.signaled) or throws CommandError. The live
  SubprocessCommandRunner reads stdout and stderr together (the old
  code read all of stdout first, so a full stderr pipe could stall
  it), caps them at 64 MB / 1 MB, and terminates the child when the
  calling task is cancelled.
- SimCtl maps the output onto the unchanged public ProcessError /
  UncaughtSignal, so Subcommand.recover and SimCtlError.Failure work
  as before. A cancelled call throws the new
  SimCtlError.cancelled(arguments:).
- XcodeToolRunner is a thin adapter over the same runner;
  XcodeToolProcess and the whole Process/ machinery (semaphore,
  completion promise, file-handle set) are gone.

Locks become actors:

- XcodeSnapshotUpdates parks its continuation inside actor isolation,
  so "pending change, else wait" is atomic; FSEvents signals hop in.
- FSEventsPathWatch is an actor whose executor is its own
  DispatchSerialQueue (where FSEvents calls back), with an isolated
  deinit; no more @unchecked Sendable.
- LiveSimCtlCommands is an actor; SimCtlCommands.useDeveloperDirectory
  and RuntimeStoreProtocol.useDeveloperDirectory are async, awaited in
  the main window's .task before the reload.
- The Locked wrapper is deleted; only test doubles with synchronous
  accessors use Mutex.

SimulatorServices requires macOS 15.4 (isolated deinit). New
SubprocessCommandRunnerTests run harmless system tools (echo, sh, env,
sleep), including cancellation. Memory and agent-notes record the
directives (subprocess over Process, actors over locks, lowest macOS
needed up to 26).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo1oYrHSsZnJ3e5bz7b

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…search notes (#160)

* Research notes: automated screenshots and beta distribution

docs/research/automated-screenshots.md compares XCUITest, fastlane snapshot,
ImageRenderer/snapshot testing and screencapture for website screenshots.
docs/research/beta-distribution.md is the beta.1 gap analysis (also #158).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* SwoopKit: standard BrightDigit package scaffolding and DocC

CI (pull_request only), CodeQL, lint/format configs, mise, Scripts, Makefile,
README, CLAUDE.md and a DocC catalog built by Scripts/docc.sh without
swift-docc-plugin. No Codecov. Doc comments and test lint fixes only; no API
or behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* SwoopCloudKit: standard package scaffolding, DocC and Linux CI

Same scaffolding as SwoopKit, macOS-only Apple lanes plus an Ubuntu lane for
the non-CloudKit code (CloudKit stays behind #if canImport(CloudKit)).
setup-swoopkit swaps ../SwoopKit for the simulator branch in CI. DocC catalog
with reading and caching articles. Tools 6.4, MIT headers, lint fixes and a
partition helper split out; no API or behaviour change. No Codecov.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* DocC catalogs for StewedKit, StewedApp and StewedTools modules

Landing pages for StewedKit, StewedMocks, StewedUI, StewedServices,
StewedFeatures, StewedApp and ReleaseDataSnapshotExport, with articles on
matching and status, deleting runtimes, the command model and the delete
flow. Six cross-module symbol links become code voice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Agent notes and memory: no Codecov, required renames, screenshots

Directives: no Codecov; upstream repo renames before a release merges into
main; SwoopCloudKit stays Linux-buildable. Memory: package scaffolding and
screenshot decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Agent notes: keep code in the Swift packages

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* SwoopMistKit, SimulatorServices: drop Codecov

Remove the Codecov upload steps, codecov.yml and the badges. SwoopMistKit
keeps its swift-coverage-action steps that enforce minimum-coverage: 70;
SimulatorServices' coverage steps only fed Codecov, so they go too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…g (#159) (#164)

* StewedMocks: real-data presets, statuses from StewedKit (#159)

Rebuild StewedMocks as a preset system whose statuses come from
StewedKit's real matching instead of being set by hand.

- SimulatorServices: public memberwise inits for SimulatorList and
  Runtime, so a SimctlSnapshot can be built in Swift.
- Presets in the chained style (.v27_2, .iOS.v27_0Beta5, .iPhone.pro18):
  MockXcode, MockBuild (runtime and SDK builds), MockRuntime (size and
  kind/state/deletable overrides), MockDevice, MockOSVersion,
  MockSimulator, MockAge, MockFetch. Data from Apple's simulator index,
  xcodereleases (via the release-data snapshot) and the simctl fixtures.
- MockScenarioData(xcode:runtimes:simulators:fetched:) installs the
  Xcode's runtimes and default simulators; modify { Editor } edits them.
  Availability, statuses, pills and release info are worked out with
  RuntimeReleaseMatcher and SimctlSnapshot rows against one shared
  catalog of every MockXcode.
- Scenarios rebuilt on the model, plus a draft `marketing` scenario.
- MockRuntimeStore recomputes statuses after a delete.
- Remove MockRuntimes, MockRuntimes+Devices and MockFixture's row
  builders; keep MockFixture.date, RuntimeImage.mock, Device.mock and
  UUID.named.
- New StewedMocksTests: preset integrity, defaults and device ranges,
  modify/update/removal, derived availability, every status, recompute
  after delete.

StewedApp: migrate to the new mocks; scenario Xcode in mock mode.

- Launch/LaunchXcode: in mock mode, one shared MockXcodeLocator with the
  scenario's Xcode at /Applications/Xcode.app, used by XcodeGate and
  SettingsView; otherwise the live XcodeLocator.
- Previews use MockRuntime presets and add Marketing previews.
- Tests move from MockRuntimes to presets and scenario lookups, with
  expected strings from the real data (builds, paths, sizes, counts).
  Where the worked-out status differs from the old hand-set one, the
  worked-out one wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo4GsDAtfojs6WmggXk

* Memory: mock scenario data rebuilt on real-data presets (#159)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo4GsDAtfojs6WmggXk

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The manifest needs swift-tools-version 6.4, but every lane ran Swift
5.9-6.0 or Xcode 15/16. Port SwoopKit's workflow (configure job, full
matrix for PRs into main/semver) with current pins: swift:6.4 release
images, the xcode-27 image with Xcode_27.2 and device names it ships,
lint on ubuntu-24.04 (SwiftLint needs libxml2.so.2), and CodeQL with
--disable-sandbox. Add check-unsafe-flags and cleanup-caches.

Lint tools move from Mint to mise (swift-format 604, SwiftLint 0.65.1,
periphery). lint.sh and header.sh come from SwoopKit; header.sh keeps
existing copyright years. opening_brace and
optional_data_string_conversion are disabled as in SwoopKit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…adges

docc.sh builds from a symbol graph without swift-docc-plugin. One
swift:6.4 devcontainer replaces the 5.9/6.0 ones. README drops the
CodeFactor, codebeat, Code Climate and Hound badges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same convention as SwoopKit: AGENTS.md and .agents/ are real files,
CLAUDE.md and .claude are symlinks. Seeds agent notes with directives
from Stewed and a memory on the Stewed subrepo re-sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DeviceTests.testSimCtlList failed on Xcode 27.2 with 30 unknown device
types (iPhone 17/18 family, iPhone Air, iPhone Duo, M5 iPad Pro, M3/M4
iPad Air, iPad A16, iPad mini A20 Pro, Apple TV 4K 4th generation,
Apple Watch Series 11/12, Ultra 3/4, SE 3, Apple Vision Pro 4K). Case
names follow the existing raw-value rule. RawAvailableOptions is a
data table, so type_body_length is disabled around it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Formatting from the new tool versions, doc comments for public
LiveSimCtlCommands and XcodeLocator members, wrapped long lines,
member reordering, and SimCtl's run helpers and an XcodeLocatorTests
helper moved to their own files. Public API is unchanged; parameter
order on public inits is kept with scoped disables. DocC links to
internal or renamed symbols are fixed so make docs passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leogdion and others added 2 commits November 25, 2026 07:23
.copy("Resources") put a top-level Resources folder in the test
bundle, which codesign rejects on the iOS-family simulators ("bundle
format unrecognized"). Copy Resources/simctl and Resources/xcode
instead; the fixtures stay at the same paths on disk, so Stewed's
fixture-copy check is unaffected.

MockSimCtlProcess used Mutex, which needs iOS 18 / watchOS 11 / tvOS 18
/ visionOS 2, above the package minimums; it now uses NSLock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under xcodebuild test on the xcode-27 runner, both integration tests
failed with CancellationError from Subprocess.run: the test process
carries DYLD_*, __XPC_DYLD_*, XCTest* and XCInjectBundle* variables,
and every child inherited them. SubprocessCommandRunner now strips
them from both inherited and explicit environments.

Adds a repo memory on how xcodebuild and SwiftPM test runs differ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant