Skip to content

Move the build log into a BuildLog store (#387) - #456

Merged
v0lumehi merged 1 commit into
mainfrom
v0lumehi/build-log-store
Nov 2, 2026
Merged

v0lumehi merged 1 commit into
mainfrom
v0lumehi/build-log-store

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Fix or feature

  • Fix
  • Feature

This is a refactor with no change in behavior, so neither box fits. Part of #387, step 3.

What and why

Step 3 of #387: BuildLog comes out of BuildModel. logTail was @Published on the model that every launcher view observes, so each chunk the build script wrote invalidated the whole launcher, game cards included.

  • New BuildLog in the NXModel target. It is an @MainActor ObservableObject that owns the log text, the tail trimming (past 12000 characters it keeps the last 9000) and the line buffer. feed() splits a chunk into lines and holds back a partial last line. flush(), append() and clear() do the rest.
  • BuildModel holds it in a let log and does not publish it. logTail stays on it as a plain computed property over log.text, for the failure classifier, the diagnostics report, the onboarding driver and the tests. Nothing observes it.
  • New BuildLogView in NXLauncher. It is the only view that observes BuildLog. The scroll text and the scroll to the end moved there unchanged.
  • BuildModel is not @MainActor yet, so it reaches the log through BuildLog.onMain, which is MainActor.assumeIsolated for macOS 13. All callers already run on the main queue. It goes when BuildModel becomes @MainActor.
  • ingest() is no longer private, so the performance test can feed lines the way the pipe does.
  • ContentView.swift shrinks from 3749 to 3730 lines and SourceSizeTests is lowered. frontend/ARCHITECTURE.md says where things stand.
  • Behavior is the same, including one old quirk: "\r\n" is one Character in Swift, so it never matches "\n" and a CRLF line is not split. The script writes plain "\n", so I left it.

This is a step of the split. Each step is its own PR. @LNPANDY, this one changes how the launcher is built, not how it works or looks.

Checked

  • Tests: cd frontend && swift test, 707 tests, 0 failures, 17 skipped as before. The first full run had 2 failures. Both were my own new testCarriageReturnsAreDropped, which expected "\r\n" to split (see the quirk above). I fixed the test. Two full runs after that were clean, so I saw no flaky test. After merging main I ran the new tests, SourceSizeTests, LauncherPerformanceTests and the build failure tests again, 55 tests, 0 failures.
  • New BuildLogTests run without SwiftUI: append, tail trimming, line buffering across chunk boundaries, flush, clear, and that only a change of the text publishes.
  • LauncherPerformanceTests has a new step, "1000 log lines in a build". It feeds 1000 lines through ingest(), one per run loop turn, while the library is shown. Its budget is 0 game cards. Result on my Mac, three runs: 0 cards, 0 fonts, 0 Info.plist reads, busy 118, 164 and 136 ms (budget 1500). I did not run the step against the old code, so I did not see it fail there.
  • Visual QA: the existing capture tests pass.
  • Run on a device or Mac: not run by hand. I did not start the app, so I did not watch a build fill the log. The tests cover the store and the view hosting.

Screenshots

None, no visible change.

Scope

  • No engine file (dm/, scripts/, docs/, ref/) is added to the repository
  • No change to the engine or a game profile
  • A change to a launcher view has before and after screenshots above: not needed, nothing visible changes
  • No keys, game files or data extracted from a game in the change or the attachments

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 launcher The NX2Apple launcher app mac Mac

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant