fix(builder): the builder's pads and controller lines are in the game's log #3249
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3249
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/builder-pads-lines-in-game-log"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
While the game plays, the builder reads the controllers for it (SDL3's pads, the Switch 2 Pro's driver) and says what it
sees in
pads:andswitch2:lines. None of those lines was ever written anywhere:longshot-builder's log sink(
build_core::report::console::init) let through only its own crate's lines andlongshot::console's, so everytracingline ofbuild_corewas dropped. The sandbox page still told testers to read "pads:lines in the builder'slog" and "
switch2:lines in the builder's log". A player with a controller problem had nothing from the builder tosend.
On
main: start any game run (mise run dev -- smoke, or the Launcher) and search the game'slongshot_log.txtforpads:: nothing, not even on a PC with noSDL3.dllwhere the builder warns that it serves no pads (the five latestsmoke runs on this PC, other branches on
main's builder: 0pads:lines each).With this PR,
console::initadds a second sink forconsole::PLAY's targets (build_core::pads,build_core::switch2,build_core::gamecube). It writes them aslongshot: <line>to the builder's standard error,with
--output jsontoo (the Launcher's mode, where the program's other lines are JSON events on stdout). During a playthe builder's standard error is already the relay into
longshot_log.txt(build_core::game_log::StderrTee, whichredacts the home folder). So those lines now land in the log a player sends, and in the Launcher's stderr file beside
it.
build_core's other lines stay out, so builds and other commands print nothing new. The threepads:lines saidoutside
pads.rs(the Windows and Linux sandboxes' pads connection, the Steam Deck's sensors) now takepads::TARGET.One line is new:
pads: SDL3's gamepads started: the builder reads the game's controllers. Before, only a failure saidanything, so a log could not tell "the builder reads the pads" from "this log has none of the builder's lines"; it is
also the line a run with no controller shows. The pads' state is now said in every game run's log, not once a
builder's life (BeanBot's L1: a game the builder starts again gets a new
longshot_log.txt, and SDL3 is already up):the run's pads session says once whether SDL3's gamepads started or could not (
pads::Session::serve), and the padsconnection's greeting says when SDL3 is missing (
pads::greeted, on the Windows and Linux greetings). A reconnect withina run says it again.
The
gamecube:lines of #3245 (the GameCube adapter's driver,build_core::gamecube, not onmainyet) reach the same log once it merges: that PR writes them witheprintln!(aschannel.rs'scontrol:lines are), which the relay already copies.PLAYnamesbuild_core::gamecubetoo, so atracingline added there later is not lost the same way; this PR does not touchgamecube.rs.Read first:
builder/crates/build-core/src/report/console.rs(PLAY,init, the test), thenpads.rs'sgreetedand
Session::serve.Testing
Tested: Windows 11 Pro 10.0.26300, RTX 5080. Again on head
48cc9ecf7(after L1):rt, thensmoke: PASS, and thelog has
longshot: pads: SDL3's gamepads started: ...(line 401 of 2126), now said by the run's pads session.mise run dev -- rt, thenmise run dev -- smokefrom this branch (headless, thekokiri-startsave, no controller plugged in): PASS, in play,900 frames, the menu opened. The run's
longshot_log.txthas the builder's line among the game's (line 400 of 2131):report::console::tests::the_pads_and_controller_lines_reach_the_games_log(new, game-free,build-core): a child ofthe test program, set up as a builder is while the game plays (its sink, its standard error relayed into a
longshot_log.txt), says lines with the pads', the Switch 2 driver's and the GameCube driver's targets and one otherbuild_coreline, in text and with--output json. Fails onmain@7bc53f841("pads: a line of the pads" in the game's log (json false): "longshot: the program's own line\n": the relay works, the pads line is dropped);passes here, on Windows (gnullvm) and Linux (WSL Ubuntu 24.04).
pads::tests::every_run_s_log_says_whether_the_builder_serves_its_pads(new with L1, game-free): two pads connectionsover the same devices, as two runs of one builder are; each run's lines say SDL3's gamepads started, or SDL3 is
missing, or once (however often the game asks) that they could not start. Fails on
e8eb592c0(run 1: []),passes here on Windows (gnullvm) and Linux (WSL).
cargo test -p build-core: 203 passed. The checks that readthe changed files and run on Windows (
test_builder_pads_route,test_deck_imu,test_headset_no_process_note,test_sandbox_profile,test_sandbox_save_folders): pass.cargo clippy -p build-core -p longshot-builder --tests: no new warnings (theunused import: note_linesinsandbox_windows.rs:384is onmainalready).cargo fmt --check: clean.cargo check -p build-core --testsonLinux (WSL): clean.
mise run test(Windows, 12 at once; the names in chunks of 150, since one command line of every name is cut atabout 8 KB): 843 passed, 1 failed:
test_lifter, only in parts that fail onmain7bc53f841too (host-sys clippylarge_const_arrays; apia_walked_reshade_folder_counts_a_change_once_two_walks_agree). Not run, fail onmainand untouched here:
test_present_geometry_trace,test_present_image_free,test_present_held_image,test_present_acquire_ahead,test_dlssg,test_no_map_reload,test_sync_watch_event,test_turf_budget,test_ui_renderer,test_no_game_title.cargo test --no-fail-fastofbuild-coreand every crate that depends on it (test-changed's list, through thequeue): all pass but three tests that fail on
main7bc53f841too: api'sa_walked_reshade_folder_counts_a_change_once_two_walks_agree, modtool'sthe_menu_passes_its_tests, build-driver'sthe_repository_s_lock_and_the_table_agree(the compiler stamp after #3120; its fix is in#3248).
Still to test:
longshot_log.txthaslongshot: pads: SDL3's gamepads started: ...again (by hand).--output json): the game'slongshot_log.txthas thebuilder's
longshot: pads:lines for it (by hand).longshot: switch2:lines inlongshot_log.txt(by hand, a tester with the pad).longshot: pads: the Steam Deck's IMU mode ...when its mode can't be read(
@Beanstalkon a Deck, or by hand).Measurements
Verdict: the builder's
pads:lines are in the game's log; nothing else changes. No speed to measure: a few lines arun on the builder's standard error, written as the game's own lines already are; no switch.
Setup: Windows 11 Pro 10.0.26300, RTX 5080;
mise run dev -- smoke(headless,kokiri-start);build-core's new test.7bc53f84148cc9ecf7the_pads_and_controller_lines_reach_the_games_logpads:linepads:lines in a smoke run'slongshot_log.txtlongshot: pads: SDL3's gamepads started: ...Risks
A few more lines in
longshot_log.txt(and on a terminal that starts the game): one at the pads' start, one percontroller event the drivers already logged. A driver that logged in a loop would now fill the log, capped at 64 MiB as
the game's own lines are; none of the three does today. Revert is enough. Nothing changes for saves, settings or caches.
build_core'ssandbox:lines (the plan's time, "the game did not start confined by the builder") are still droppedby the same filter: left for a follow-up, not part of this fix.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11 Pro 10.0.26300, RTX 5080: mise run dev -- rt, then mise run dev -- smoke (headless, kokiri-start save, no controller plugged in): PASS, in play, 900 frames, the menu opened. The run's longshot_log.txt has the builder's line 'longshot: pads: SDL3's gamepads started: the builder reads the game's controllers' among the game's lines (line 400); the five latest smoke logs from main's builder have no pads: line.
@review
Recommendation: Approve. The reported smoke run and game-free test show that pad diagnostics now reach the log, but the controller-specific and Deck cases listed for testing remain untested. A restarted game can also lose the new startup diagnostic from its current log. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The builder writes pad and controller diagnostics to stderr in both text and JSON modes, allowing the existing relay to include them in the game log. This improves controller troubleshooting at the cost of additional log output; the once-per-process startup message is missing from subsequent game logs after a restart.
Should fix (1): not blocking, but worth doing before merging.
builder/crates/build-core/src/pads.rs:1359: The startup diagnostic is emitted only once per builder process, but each game restart gets a new log. (more on the line) Do: Report the cached SDL availability and startup result once for each game run, and cover a second run in the test.Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)
@fixcan do L1.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes. The reported Windows smoke run has one pads startup line where five earlier main-branch smoke logs had none; the new relay test is reported to fail on the base and pass on Windows and Linux. Actual controller-specific paths remain to be checked.
Other systems: The filter also applies to the packager's shared console initializer, but its normal work does not use the controller targets. Windows Switch 2 and Linux Deck diagnostic paths have not been exercised in the reported runs. The change does not alter controller state, rendering, saves, or settings.
Switches: None added, changed, or removed.
Reviewed:
e8eb592c01against7bc53f8413: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the complete diff, commits, console.rs, and the relevant logging, pad initialization, restart, and platform call paths. Skimmed the remaining changed Rust files, sandbox documentation, and source-reading test references; the larger changed Rust files were not read in full. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).Checked and fine:
Testing: No code or tests were run during review. The author reports a Windows smoke run and Windows and Linux game-free test passes; CI is still running.
Overlaps and merge order: PR #3245 adds GameCube driver diagnostics; its eprintln output uses the existing relay, and this change anticipates its tracing target. No merge order is required for this change.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -1354,1 +1357,3 @@if !ok {if ok {// (once a builder's life: a player's log says the builder reads the controllers for the game)tracing::info!("pads: SDL3's gamepads started: the builder reads the game's controllers");L1 (should fix): The startup diagnostic is emitted only once per builder process, but each game restart gets a new log.
When: When a game requests a restart, the builder rotates the first run's log and starts another game in the same process. The shared SDL instance is already initialized, so this line is not emitted into the new longshot_log.txt; with no controller events, that log again cannot distinguish working pad service from missing diagnostics.
Do: Report the cached SDL availability and startup result once for each game run, and cover a second run in the test.
L1, fixed in
fea13443e(test) and48cc9ecf7(fix): the pads' state is now said in every game run's log, not once a builder's life. The run's pads session says once whether SDL3's gamepads started or could not (pads::Session::serve), and the pads connection's greeting says when SDL3 is missing (pads::greeted, on both the Windows and Linux greetings).Sdlno longer says either itself. The new testpads::tests::every_run_s_log_says_whether_the_builder_serves_its_padsruns two pads connections over the same devices, as two runs of one builder are, and checks each run's lines for all three states (and that a failed start is said once however often the game asks). It fails one8eb592c0(run 1: []) and passes here on Windows and Linux. Smoke again on48cc9ecf7: PASS,longshot: pads: SDL3's gamepads started: ...at line 401. A real restart's second log is under Still to test (by hand).L2: the Switch 2 Pro, Deck and Launcher runs stay under Still to test; they need hardware this PC doesn't have.
@review
Recommendation: Approve. The code is ready: only testing is left. The startup diagnostic now follows each pads session, including after a game restart. The Switch 2 Pro and Steam Deck diagnostic paths still need hardware runs. Recommend approval; not approved on the forge.
Controller diagnostics are routed into the game log, making controller problems easier to investigate. The change adds a few log lines per run and leaves other build-core diagnostics filtered out.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
Since the last review (on
e8eb592c01)Resolved: L1 (The startup diagnostic is emitted only once per builder process, but each game restart get…)
Still open: L2 (The reported run exercises the startup message without a controller, while the actual Swit…)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the startup path: the reported Windows smoke run contains one pads startup line, versus zero in five main-branch smoke logs. The reported automated relay test also passes on Windows and Linux; the hardware-specific paths remain untested.
Other systems: The sink covers pads, Switch 2 and future GameCube tracing targets in both text and JSON modes. Windows and Linux use separate greeting paths; the reported tests cover the shared connection logic, but Switch 2 Pro and Steam Deck hardware runs remain outstanding.
Switches: None added, changed or removed.
Reviewed:
48cc9ecf7bagainst7bc53f8413: Read AGENTS.md, CONTRIBUTING.md, the full pull request diff, the changes since the previous review, and console.rs. Inspected pads.rs and the changed Windows and Linux sandbox paths; the large file outputs were truncated, so not all changed code files were read in full. Reviewed the supplied comments, testing claims and CI status.; nothing run (a code review).Checked and fine:
Testing: The author reports Windows smoke and Windows/Linux game-free tests passing. A real restart, Launcher with a controller, Switch 2 Pro and Steam Deck runs remain listed as untested; no tests were run in this review.
Overlaps and merge order: PR #3245 adds GameCube adapter diagnostics; its existing stderr output is already relayed, and this change also allows future tracing output from its target.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.