Skip to content

Launcher: DeviceStore owns devices, teams, the install target and the shell copy flow (#387) - #471

Merged
v0lumehi merged 1 commit into
v0lumehi/dependency-storefrom
v0lumehi/device-store
Nov 2, 2026
Merged

v0lumehi merged 1 commit into
v0lumehi/dependency-storefrom
v0lumehi/device-store

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #469 (stack #459), retarget to main after the ones below merge.

Part of #387, step 7 (devices).

Fix or feature

  • Fix
  • Feature

Not from outside. A maintainer step of the plan in #387.

What and why

BuildModel still owned the paired devices, the signing teams, the install target and the copy flow of the shared app. This PR moves them into DeviceStore in NXModel, as AppUpdateStore, RepoStore, EngineSyncStore and DependencyStore did. Behavior does not change.

What moved into DeviceStore (126 lines):

  • the devices, the teams and checked, and refresh() (devicectl and the keychain, off the main actor, returns the Task)
  • the chosen install device and team, saved in the defaults
  • the copy flow: the question before the game data goes over (shellCopy, answerCopy), the wait for a cable (shellWaiting, cancelWait), and the blocking bridge the install calls from its queue (askCopy, setWaiting, waitCancelled)
  • xcrun as an injected value, and the two listings as closures with the real ones as default

What moved into NXCore:

  • ShellCopyPlan, ShellCopyDecision and ShellConnection (ShellInstall.Connection stays as an alias), DeviceControl (devicectl for the save transfer) and LockedFlag

Processes. DeviceTools.run, DeviceControl, AppSignature and ShellInstaller.run were direct Process users. They start their tools through ProcessRunner now. I extended the runner, with a fake and tests:

  • ProcessLaunch.timeout ends a captured run that outlasts it (SIGTERM, SIGKILL 2 s later) and ProcessResult.timedOut says so
  • ProcessLaunch.input is written to standard input of a captured run
  • one new primitive, streamLines: merged output as whole lines (empty ones too, a last line without a newline included), a callback when the process has started (Stop reads it), an optional process group that ProcessGroups tracks

The loose test hooks are gone. BuildModel.xcrunPath and volumesRoot are lets that BuildModel.init(xcrun:volumesRoot:) takes, and the store gets xcrun from it. teamsProvider is DeviceStore.readTeams. volumesRoot is read by the failure classifier and not by a device tool, so it stays on the model.

Views: the Builds page's install target and the copy card observe DeviceStore.

What stays in BuildModel and goes to the build store, because it belongs to the build run: installedOn and installedAppPath, installsDirectly (reads the build target), shellRetry and the retry of the game data, installShell (feeds the build's stages and failure), the reinstall, the re-sign and openOnDevice. installDevice, signingTeam and deviceName(_:) are forwarders to the store, because the build code reads them. This is in frontend/ARCHITECTURE.md too.

SourceSizeTests: ContentView.swift went from 2073 to 2049 lines, its limit is lowered.

Checked

  • Tests: cd frontend && swift test three times, all green. 846 tests in total (NXModelTests 96, NXCoreTests 113, NX2AppleTests 637 with 17 skipped), the step before had 816. No test failed in any run. The frontend-qt tests pass (214, 14 skipped).
  • New tests: DeviceStoreTests (15, without SwiftUI), DeviceToolsRunnerTests (9, a fake runner, plus one real run against a stand-in xcrun that hangs), ProcessRunnerTests (6 more: timeout, input, whole lines, status, group).
  • Visual QA: not applicable, no view changed.
  • Run on a device or Mac: not run. No fresh app build was launched and devicectl was not run against a device. The install paths are covered by the existing ShellInstallTests, which run ShellInstaller and the model against a stand-in xcrun through the real runner.

Screenshots

None, no visible change.

Scope

  • No engine file (dm/, scripts/, docs/, ref/) is added to the repository
  • No engine change, so nothing goes to seedds/nxnative
  • No launcher view changes, so no screenshots are needed
  • No keys, game files or data extracted from a game in the change or the attachments

@v0lumehi v0lumehi added this to the v1.0.2 milestone Nov 2, 2026
@v0lumehi v0lumehi added enhancement New feature or request launcher The NX2Apple launcher app mac Mac labels Nov 2, 2026
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 2, 2026
@v0lumehi
v0lumehi added this pull request to stack #459 November 2, 2026 01:38
@v0lumehi
v0lumehi force-pushed the v0lumehi/device-store branch from 44edbed to cde6b89 Compare November 2, 2026 12:47
…a DeviceStore (#387)

DeviceStore (NXModel) owns the paired devices, the signing teams, the chosen device and team and the copy flow of the shared app. DeviceTools, AppSignature, DeviceControl and ShellInstaller start their tools through ProcessRunner, which got a timeout, an input and one primitive, streamLines. xcrunPath and volumesRoot are injected through BuildModel.init. Behavior does not change.
@v0lumehi
v0lumehi force-pushed the v0lumehi/device-store branch from 9b44cd1 to 348040f Compare November 2, 2026 16:00
@v0lumehi
v0lumehi merged commit d9ae970 into main Nov 2, 2026
14 checks passed
@v0lumehi
v0lumehi deleted the v0lumehi/device-store branch November 2, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request launcher The NX2Apple launcher app mac Mac

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant