fix(ab): read options after warm-up and ignore unready area rows (#2349) #2443

Open
Cal wants to merge 2 commits from Cal/Longshot:fix/ab-locked-rows into main
First-time contributor

Summary

Fixes #2349.

dev.py ab refused to write up A/B runs (exit 3) at random when the four per-area Simulated turf rows from #2093 (sim_turf_density, sim_turf_fade_start, sim_turf_far_power, sim_turf_minimum_blades) read "Load an area" in one run and the area's numbers in another. run_one() in scripts/devtools/ab.py called option_get right after teleporting, before the warm-up, racing with sim_turf_settings::tick()'s 750 ms stability window.

How to see it on main: run python -I scripts/dev.py ab --scene kokiri-forest (or hyrule-field); if any run reads option_get before sim_turf_settings::ready becomes true, differences() refuses the write-up with options sim_turf_density: A2 has '150', A1 'Load an area'.

What changed:

  • scripts/devtools/ab.py (run_one): move status and option_get to the end of the warm-up loop (still before start = num(rows[-1], "at_ns")), so options are sampled once the area has settled.
  • scripts/devtools/ab.py (what_ran, differences, UNREADY_ROW_TEXT): record option keys that were locked (fixed: True) with "Load an area" in "unready", and in differences() compare all ready runs for each option key against the first ready run ready[0]. Hardware-locked rows (e.g. upscaler: "Off") and disagreements among ready runs still fail differences().
  • tests/test_dev_ab.py: add test_unready_area_rows_not_compared (covers unready first run, unready second run, disagreement among ready runs when the first is unready, and hardware-locked upscaler still differing) and assert in test_run_does_not_read_live_log that option_get runs after settled().

Testing

Tested:

  • Game-free unit test (tests/test_dev_ab.py, Windows 11):
    • On main with test commit alone (c9d73c50): failed with AssertionError: Lists differ: ["options sim_turf_density: A2 has '150', A1 'Load an area'", ...] and AssertionError: False is not true : option_get read before warm-up settled.
    • On this PR @ bdf95122 (rebased onto main @ 8aa5ab87): Ran 35 tests in 7.955s — OK (run with -X utf8 on Windows).
    • tests/byte_compile_tracked.py: pass.
  • In-game run (Windows 11, NVIDIA GeForce RTX 4060, driver 621.24, nightly-763-0e32bc10):
    • Ran python -I -X utf8 scripts/dev.py ab --env HOS_COLLECT_WIDE=0 --set RX_VK_PRECOMPILE=0 --separate --runs 1 --seconds 10 --warmup 10 --scene kokiri-forest --runtime <nightly-763-0e32bc10>.
    • Both game runs (A1: 395 frames, 39.6 fps; B1: 536 frames, 53.7 fps) booted, teleported to KokiriForest_Child, warmed up 10 s, sampled option_get after warm-up, measured 10 s, and stopped cleanly.
    • results.json recorded unready: [] and identical settled values in both runs: sim_turf_fade_start: '8.0', sim_turf_density: '150', sim_turf_minimum_blades: '16', sim_turf_far_power: '1.00' (zero options sim_turf_* differences). (dev.py ab itself exited 1 on an unrelated Windows HOS_CONTROL per-run pipe-name difference.)

Still to test:

  • Linux (mise run test and mise run lint): run the full suite and linter on Linux CI (expecting all checks green, by hand or once CI workflows are approved on this PR).

Measurements

Verdict: eliminates random sim_turf_* A/B refusals; tooling-only change to scripts/devtools/ab.py and tests/test_dev_ab.py (not built into the game), so no game performance, memory, or build-time impact.

Before: main @ 8aa5ab87 After: this PR @ bdf95122
tests/test_dev_ab.py 2 failed (test_unready_area_rows_not_compared, test_run_does_not_read_live_log) 35 passed, 0 failed (7.955s)
dev.py ab --scene kokiri-forest (sim_turf_* rows, RTX 4060 / Windows 11) random exit 3 (A1 'Load an area' vs A2 '150') unready: [], identical settled values in A1 and B1

Risks

  • Low risk: only affects scripts/devtools/ab.py (developer A/B harness). Reverting the commit restores the previous behavior; nothing changes for players (saves, longshot_options.ini, caches, or game binaries are untouched).
  • UNREADY_ROW_TEXT = "Load an area" matches gpu/vk/menu/sim_turf_settings.h:379; if that string were reworded, the fallback would stop matching, though post-warmup option_get sampling would still cover normal runs.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). — not run locally on Windows; waiting for Linux CI approval/run
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary Fixes #2349. `dev.py ab` refused to write up A/B runs (exit 3) at random when the four per-area Simulated turf rows from #2093 (`sim_turf_density`, `sim_turf_fade_start`, `sim_turf_far_power`, `sim_turf_minimum_blades`) read `"Load an area"` in one run and the area's numbers in another. `run_one()` in `scripts/devtools/ab.py` called `option_get` right after teleporting, before the warm-up, racing with `sim_turf_settings::tick()`'s 750 ms stability window. **How to see it on `main`:** run `python -I scripts/dev.py ab --scene kokiri-forest` (or `hyrule-field`); if any run reads `option_get` before `sim_turf_settings::ready` becomes true, `differences()` refuses the write-up with `options sim_turf_density: A2 has '150', A1 'Load an area'`. **What changed:** - `scripts/devtools/ab.py` (`run_one`): move `status` and `option_get` to the end of the `warm-up` loop (still before `start = num(rows[-1], "at_ns")`), so options are sampled once the area has settled. - `scripts/devtools/ab.py` (`what_ran`, `differences`, `UNREADY_ROW_TEXT`): record option keys that were locked (`fixed: True`) with `"Load an area"` in `"unready"`, and in `differences()` compare all ready runs for each option key against the first ready run `ready[0]`. Hardware-locked rows (e.g. `upscaler: "Off"`) and disagreements among ready runs still fail `differences()`. - `tests/test_dev_ab.py`: add `test_unready_area_rows_not_compared` (covers unready first run, unready second run, disagreement among ready runs when the first is unready, and hardware-locked `upscaler` still differing) and assert in `test_run_does_not_read_live_log` that `option_get` runs after `settled()`. ## Testing **Tested:** - **Game-free unit test (`tests/test_dev_ab.py`, Windows 11):** - On `main` with test commit alone (`c9d73c50`): failed with `AssertionError: Lists differ: ["options sim_turf_density: A2 has '150', A1 'Load an area'", ...]` and `AssertionError: False is not true : option_get read before warm-up settled`. - On `this PR @ bdf95122` (rebased onto `main @ 8aa5ab87`): `Ran 35 tests in 7.955s — OK` (run with `-X utf8` on Windows). - `tests/byte_compile_tracked.py`: pass. - **In-game run (Windows 11, NVIDIA GeForce RTX 4060, driver 621.24, `nightly-763-0e32bc10`):** - Ran `python -I -X utf8 scripts/dev.py ab --env HOS_COLLECT_WIDE=0 --set RX_VK_PRECOMPILE=0 --separate --runs 1 --seconds 10 --warmup 10 --scene kokiri-forest --runtime <nightly-763-0e32bc10>`. - Both game runs (`A1`: 395 frames, 39.6 fps; `B1`: 536 frames, 53.7 fps) booted, teleported to `KokiriForest_Child`, warmed up 10 s, sampled `option_get` after warm-up, measured 10 s, and stopped cleanly. - `results.json` recorded `unready: []` and identical settled values in both runs: `sim_turf_fade_start: '8.0'`, `sim_turf_density: '150'`, `sim_turf_minimum_blades: '16'`, `sim_turf_far_power: '1.00'` (zero `options sim_turf_*` differences). (`dev.py ab` itself exited 1 on an unrelated Windows `HOS_CONTROL` per-run pipe-name difference.) **Still to test:** - Linux (`mise run test` and `mise run lint`): run the full suite and linter on Linux CI (expecting all checks green, by hand or once CI workflows are approved on this PR). ## Measurements **Verdict:** eliminates random `sim_turf_*` A/B refusals; tooling-only change to `scripts/devtools/ab.py` and `tests/test_dev_ab.py` (not built into the game), so no game performance, memory, or build-time impact. | | Before: main @ 8aa5ab87 | After: this PR @ bdf95122 | |---|---|---| | `tests/test_dev_ab.py` | 2 failed (`test_unready_area_rows_not_compared`, `test_run_does_not_read_live_log`) | 35 passed, 0 failed (`7.955s`) | | `dev.py ab --scene kokiri-forest` (`sim_turf_*` rows, RTX 4060 / Windows 11) | random exit 3 (`A1 'Load an area'` vs `A2 '150'`) | `unready: []`, identical settled values in `A1` and `B1` | ## Risks - Low risk: only affects `scripts/devtools/ab.py` (developer A/B harness). Reverting the commit restores the previous behavior; nothing changes for players (saves, `longshot_options.ini`, caches, or game binaries are untouched). - `UNREADY_ROW_TEXT = "Load an area"` matches `gpu/vk/menu/sim_turf_settings.h:379`; if that string were reworded, the fallback would stop matching, though post-warmup `option_get` sampling would still cover normal runs. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). — *not run locally on Windows; waiting for Linux CI approval/run* - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
fix(ab): read options after warm-up and ignore unready area rows (#2349)
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
577bd5cca0
Cal force-pushed fix/ab-locked-rows from 577bd5cca0
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to bdf951222a
Some checks failed
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Failing after 5s
2026-11-24 07:06:11 +00:00
Compare
Author
First-time contributor

Rebased onto current main (8aa5ab87), added Assisted-by trailers to both commits (c9d73c50, bdf95122), noted the unrelated Windows HOS_CONTROL pipe-name refusal during the local in-game run, and unticked mise run test until Linux CI runs.

Rebased onto current main (8aa5ab87), added Assisted-by trailers to both commits (c9d73c50, bdf95122), noted the unrelated Windows HOS_CONTROL pipe-name refusal during the local in-game run, and unticked mise run test until Linux CI runs.
Cal changed title from fix(ab): read options after warm-up and ignore unready area rows (#2349) to WIP: fix(ab): read options after warm-up and ignore unready area rows (#2349) 2026-11-24 07:19:47 +00:00
Cal changed title from WIP: fix(ab): read options after warm-up and ignore unready area rows (#2349) to fix(ab): read options after warm-up and ignore unready area rows (#2349) 2026-11-24 07:26:00 +00:00
Some checks failed
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Failing after 5s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/ab-locked-rows:Cal-fix/ab-locked-rows'
git switch 'Cal-fix/ab-locked-rows'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2443
No description provided.