Repository navigation
Add ProcessRunner and GitCheckout services to NXCore (#387, step 5) - #460
Merged
Merged
Conversation
4 of 6 tasks
v0lumehi
force-pushed
the
v0lumehi/process-runner
branch
from
November 2, 2026 12:47
8addb5a to
061a558
Compare
ProcessRunner is the place that starts a process: capture, stream and start (with a process group). ProcessGroups moves the group tracking out of BuildModel. GitCheckout holds clone, fetch, pull, behind count, the automatic pull and the adoption of a ZIP copy, GitRules the pure decisions. BuildModel takes both in its initializer. Toolchain, Diagnostics, OlderTools, Uninstall and the update staging take a runner or a checkout as a parameter.
v0lumehi
force-pushed
the
v0lumehi/process-runner
branch
from
November 2, 2026 14:28
061a558 to
1d58f23
Compare
5 of 6 tasks
3 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #458 (which is stacked on #456), retarget to main after they merge.
Part of #387, step 5.
Fix or feature
This is a refactor with no change in behavior, so neither box fits.
What and why
Step 5 of #387: the first two services. They start processes and touch the file system, have no
@Publishedstate, and each is a protocol with one real implementation, so a test passes in a fake. They live inNXCore(Foundation only,packageaccess).ProcessRunneris the place that starts a build process. Three primitives:capture(run to the end, keep stdout and stderr, optionally merged),stream(hand out lines) andstart(return at once, output chunks and exit status in callbacks, optionally as leader of a process group).runQuiet,runOK,runCapturedandoutputare helpers over them.SystemProcessRunneris the real one.ProcessGroupsis the group tracking that was inBuildModel(inOwnGroup,track,untrack,endGroup,endAll,buildProcessesAlive) and the SIGTERM handler. ThewillTerminatenotification is AppKit's, soBuildModelstill registers it and callsProcessGroups.endAll().GitCheckouthas clone, fetch plus behind count, pull, the automatic pull (main with no tracked changes only) and the adoption of a ZIP copy.SystemGitCheckoutis the real one.GitRulesholds the decisions that need no git (autoPullAllowed,zipCopyBranch,zipAdoption). The git binary lookup and the git environment moved there.BuildModeltakes aProcessRunnerand aGitCheckoutininit, with the real ones as defaults. Clone, check, pull, auto pull, adoption, the build run, the tools of a stage, the archive step,openOnDevice, the nsz install and the engine sync go through them.BuildModel.runQuiet,runCaptured,gitBinary,gitEnv,inOwnGroup,track,untrackandendGroupare gone.Toolchain(runOK,pythonVersion,dotnetRoot,developerDir,firstOutputLine,makeVenv),Diagnostics,OlderTools,Uninstall.gitOrigin,EngineLayout.runSync, the update staging (ditto) and the Xcode probe inLiveOnboardingDrivertake a runner or a checkout as a parameter. The default is the real one, so no call site changed.runOKleft its pipes unread),xcode-select -pgets an empty stdin, and a stage's pipe handler is no longer cleared by hand on exit, becausePipeReaderdetaches itself at end of output.ProcessRunnerTests(real runner against small system tools, the helpers and fourToolchainfunctions over a fake) andGitCheckoutTests(the git commands of every flow over a fake, plus the pure decisions) inNXCoreTests. NewRepoFlowFakeTestsdrives theBuildModelrepository flows with a fakeGitCheckout. The pure-decision tests moved out ofRepoAutoUpdateTestsandRepoToolsTestsintoGitCheckoutTests. The others use the new names.ContentView.swiftshrinks from 2943 to 2763 lines.SourceSizeTestsis lowered.frontend/ARCHITECTURE.mdsays where things stand.What stays
These still start a
Processthemselves and move with the step that owns them.AppSignature(codesign) andAppUpdate(ditto, xattr): step 6, with theAppUpdateStore. Release parsing stays inAppUpdate.swiftas asked.DeviceTools.run(devicectl with a timeout and input) andSaveTransfer: the device store.ShellInstaller.run(a blocking read with start and end callbacks): the build store.BuildModelstill hands itProcessGroupsthrough its callbacks.EngineUpdater(ditto): the engine store.LiveOnboardingDriverand the game start inLiveConsoleDriver.BuildModel.xcrunPathandvolumesRoot.ShellInstallerandDeviceToolsrun those tools themselves and the tests point them at a script, so they move with the device store.teamsProvider,chooseKeys,revealFolderandopenAppare not process hooks and stay.detectDepsSyncand its static helpers keep callingToolchainwith the real runner.@LNPANDY, this one changes how the launcher is built, not how it works or looks.
Checked
cd frontend && swift testin full, 746 tests (69 inNXCoreTests, 677 inNX2AppleTests, 17 skipped as before). Four runs in total (three by hand and the pre-push hook run), all with 0 failures. The first run after I wrote the new tests had two failures of my own tests,GitCheckoutTests.testAFailedFetchStopsTheAdoptionAndRemovesTheGitFolderItMade(a temp folder name contained "checkout") andProcessRunnerTests.testTheDirectoryIsTheOneGiven(/varagainst/private/var). Both are fixed. I ranpython3 tools/engine.py syncfirst, so the tests that readengine/pass.RepoAutoUpdateTests,RepoToolsTests) and the process group test.Screenshots
None, no visible change.
Scope
dm/,scripts/,docs/,ref/) is added to the repository