fix(dev): dev.py ab compares the builder's handles as set or not, so a Windows A/B writes its measurements #3252
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!3252
Loadingβ¦
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/ab-builder-handles"
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
On Windows,
dev.py abnever wrote a Measurements section for an A/B. It finished every run, then ended with exit status 3 ("the sides differed") and nomeasurements.md.The cause: each run's
vk: switches setlog line includesLONGSHOT_BUILDER_PIPESandLONGSHOT_CRASH_BLOCK. These are handles the builder gives each game process: its pipes (build_core::sandbox_windows) and its crash block (build_core::crash_block, read byhost/hos_crash_record.c). They get new numbers in every process, so two runs of the same side differ in them (A10x2b4, A20x2bc), anddifferencesreported that as a setup difference. On Linux the builder's descriptors (LONGSHOT_PADS_FD,LONGSHOT_FILES_FD) can do the same.How to see it on
main: run anydev.py abon Windows. The output ends withno write-up: switches LONGSHOT_BUILDER_PIPES: A2 has '0x2bc', A1 '0x2b4'; switches LONGSHOT_CRASH_BLOCK: ...and exit status 3.The fix: these handles are now compared only as set or not set, the way
HOS_CONTROL's per-run socket name already is. A run the builder gave no crash block or no pipes still counts as different. Every other switch is still compared by value, includingHOS_SANDBOX, which also belongs to the builder but is a setting.--allowmeans what it did before.The list (
ab.BUILDER_HANDLES) comes from the source rule, not from guessing: every name inbuild_core::env_own'sOWN(the variables only the builder may set) whosegpu/vk/switches.defrow says "Set by the builder". A new check holds the list to that rule, so a new handle added to the builder cannot bring the refusal back, and a setting cannot slip into the list.Read first:
BUILDER_HANDLESandON_OR_OFFinscripts/devtools/ab.py, then the three new tests intests/test_dev_ab.py.Found in MagicBeanDev/Longshot#3248, where BeanBot's L1 Market A/B was written up by hand, and in MagicBeanDev/Longshot#3242 (cloth). The same refusal was also hit in MagicBeanDev/Longshot#3099, MagicBeanDev/Longshot#3118, MagicBeanDev/Longshot#3142, MagicBeanDev/Longshot#3251, MagicBeanDev/Longshot#2957 and MagicBeanDev/Longshot#2523.
Testing
Tested: Windows 11. This is a development tool; the game's code is not changed, so there was no new game run. Instead, the real run folder of PR 3248's Market A/B (six runs, RTX 5080,
%LOCALAPPDATA%\longshot-dev\runs\ab\20261205-081422-change-market) was summarised again with this branch'sab.summariseandab.measurements, each run's switches read again from its own logged line. Onmainthat folder gives 6 problems (allLONGSHOT_BUILDER_PIPES/LONGSHOT_CRASH_BLOCK) and no verdict. Here it gives no problems and the same verdict and table that 3248's hand-made Measurements show: +3.2 % fps (median 115.1 against 111.6), within the runs' spread.Tests (
tests/test_dev_ab.py, game-free):Facts.test_builder_handles_compared_as_set_or_not: two runs whose switches lines differ only in the handle values do not differ. A handle present in one run and missing in the other, a differentHOS_FPS_MAX, or a differentHOS_SANDBOXeach still count as one difference.CommandPath.test_windows_runs_write_their_measurements:cmd_abover six runs (run_onestubbed, logs shaped like 3248's) writesmeasurements.mdand returns 0. With one run'sHOS_FPS_MAXchanged, it writes none and returns 3, withswitches HOS_FPS_MAXas the only problem.Facts.test_builder_handles_from_source:ab.BUILDER_HANDLESequalsenv_own.rsOWNβ© the "Set by the builder" rows ofswitches.def,HOS_SANDBOXis not in it, and the handles are compared as set or not.The first two fail on
main(the test commit alone: exit 3, and the handle differences listed). All three pass here. With the fix's key line undone (ON_OR_OFF = ("HOS_CONTROL",)) all three fail again.tests/test_dev_ab.pyalso passes on Linux (WSL Ubuntu 24.04,python3 -I -B tests/test_dev_ab.py, 43 tests).mise run lintpasses.mise run test(Windows 11, llvm-mingw, Rust 1.99.1 gnullvm, 12 at once), run as--exactlists in parts: 843 of 844 checks pass.test_lifterfails, only in two parts known to fail onmainand fixed in MagicBeanDev/Longshot#3248: host-sys's clippy (large_const_arrays,settings_abi.rs) and api'sa_walked_reshade_folder_counts_a_change_once_two_walks_agree. Not run, because they fail onmain(also fixed in 3248) and this change touches none of them: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. This change touches no Rust and no C or C++.Still to test: None.
Measurements
Nothing to measure: a development tool's comparison of logged switches. The game and its frame times are unchanged. The re-summarised A/B above shows the write-up it now produces. No switch is added or changed: the five names in
ab.BUILDER_HANDLESare existing rows ofgpu/vk/switches.defthat the builder sets. This PR only names them, so there is no default to ship.Risks
dev.py abalone changes. The only thing it no longer catches is two runs given different handle numbers by the builder, which carry no setting. A run the builder started without one of them still counts as different. Reverting is enough. Players notice nothing.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. (tests/test_dev_ab.pyreadsab.py: three tests added, none changed)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
Possibly related, for context:
@review
Recommendation: Approve. The fix prevents per-process handle numbers from rejecting otherwise comparable A/B runs while retaining checks for missing handles and actual settings. The reported tests and re-summary support the fix; CI is still running. Nothing blocking is left. Recommend approval; not approved on the forge.
Developers can get a Measurements write-up from Windows A/B runs despite changing builder handle numbers. The change is small and keeps the existing comparison for settings.
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes. The author reports that re-summarising six Windows runs changed the result from six handle-related differences and no verdict to no differences and a write-up matching the manually produced result. This is not a game performance change.
Other systems: The same comparison applies to Linux builder descriptors. It changes only A/B report validation, not game execution, rendering, saves, audio or input.
Switches: None added, changed or removed. Existing builder handle values are compared by presence in A/B validation; HOS_SANDBOX remains compared by value.
Reviewed:
af7343f79bagainst7bc53f8413: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the diff, commits, changed code and tests, and the relevant builder ownership and Windows pipe paths. Skimmed the surrounding developer documentation, standards and switch definitions. docs/review-checklist.md and the adjacent Tooling checkout were absent. Some long command output was truncated, so portions of unchanged code in ab.py and test_dev_ab.py were only skimmed.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no tests or project code were run. The author reports game-free tests on Windows and Linux and a Windows re-summary; CI has not finished.
Overlaps and merge order: None found in the supplied review context.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.