Repository navigation
Move the repository out of BuildModel into a RepoStore (#387) - #466
Merged
Merged
Conversation
Merged
3 of 6 tasks
v0lumehi
force-pushed
the
v0lumehi/repo-store
branch
from
November 2, 2026 12:47
724ccbc to
b296227
Compare
RepoStore (NXModel) owns the repository path, its status line, the update check, the pull, the automatic update and the adoption of a ZIP copy. RepoLayout and the file-system part of EngineLayout move to NXCore. Settings, the library's activity line and the launcher observe the store. RepoLocation is the narrow protocol for other stores.
v0lumehi
force-pushed
the
v0lumehi/repo-store
branch
from
November 2, 2026 16:00
69612fe to
8b2248f
Compare
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 #462 (stack #459), retarget to main after the ones below merge.
Part of #387, step 7 (repository).
Fix or feature
It is a step of the plan @LNPANDY and I agreed in #387. No change of behavior.
What and why
BuildModelstill owned the repository: the path, the status line, the update check, the pull, the automatic update and the adoption of a ZIP copy. This PR moves them intoRepoStoreinNXModel, the second store afterAppUpdateStore, and follows the pattern infrontend/ARCHITECTURE.md.RepoStoreis@MainActor, owns its@Publishedstate (path,busy,status,behind,autoUpdate,autoPulled,autoAdopted) and takesGitCheckout,LocalizerandUserDefaultsthroughinit. What reaches back into the model are four closures: whether a build runs, whether this is a release app, the build log, anddidMove(the engine sync after a clone, a pull or an adoption).Task, so a test awaits it. The git work blocks, so it runs off the main actor.RepoLocationis the narrow protocol (path,isRepo,isGit) for stores that only need to know where the repository is. No store uses it yet.NXCoregets what the store needs:RepoLayout(is it a repository, the tools a build needs, which checkout to use at start) and the file-system part ofEngineLayout(marker,root,isCheckout,hasEngineTool). The stale check and the sync stay in the app target.BuildModel.BuildModellost its repository state and 230 lines.ContentView.swiftis 2265 lines (was 2494), and its limit inSourceSizeTestsis lowered.LauncherView.swiftis 967, as before.What stays in
BuildModeland whyrepoPath,repoOKandrepoIsGitare forwarders to the store. The build code (start, archive, install, diagnostics, the engine switch of the release app) reads the path, and it is not a store yet.BuildModelforwards the store'sobjectWillChangeto its own.canBuildand the build views read the repository through the model, so they redraw as before. Both go with the build store.syncEngineand its state read the path andpythonPath. They go to the engine sync store.BuildModelis not@MainActor, so it reaches the store throughMainActor.assumeIsolated, as it does forAppUpdateStore.All of this is in
frontend/ARCHITECTURE.md.Checked
cd frontend && swift test, four full runs (three by hand, one by the pre-push hook), each 640 tests, 17 skipped as before, 0 failures. No flaky test seen. The new tests ofRepoStoreTestsrun with a fakeGitCheckout, without SwiftUI.RepoFlowFakeTestsmoved there.RepoAutoUpdateTestsandRepoToolsTestsstill run the real git against local repositories, through the model.Screenshots
None, no visible change.
Scope
dm/,scripts/,docs/,ref/) is added to the repository: a change there is a patch inpatches/(a commit inengine/, thentools/engine.py export, andtools/engine.py checkpasses), with itsUpstream-Statusforwarded seedds/nxnative#..., orpendinguntil that PR is open