test: only_what_differs_goes_up knows about LEONIDA_TAKE_BLOCKS #2820
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2820
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-take-blocks-test"
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?
Pull request successfully merged and closed
maind920d850dhas a failing test, and this is the five-line test change that makes it pass again:only_what_differs_goes_upnever learned aboutLEONIDA_TAKE_BLOCKS.The red, on
mainwith nothing applied:It arrived with
6d0ba44f0/d920d850d("pages written since they were taken go up by the 4 KiB that changed", off, then on by default). Bisected: passes onb7a1be296, fails ond920d850d, and only the flag moves it:Why: the test branches on a different switch (
LEONIDA_SEND_CHANGED,host.rs:14446, off by default), so with nothing set it takes theelsearm and asserts the answertake_dirtygave beforeTAKE_BLOCKSexisted. WithTAKE_BLOCKSon, the page the landing took went up as its 4 KiB pieces and is not reported whole again -againis[]- which is the new behaviour working as its own commit describes.The change: a third arm, in the same shape as the existing two.
crate::toggled!is the crate's own reader (switch.rs:24, on unless the variable is0), so the arm fires on the default and steps aside for=0.Measured, all three modes and then the crate:
The value in the new arm is measured, not inferred: I instrumented
take_dirty's two answers and readagain=[],written=[(131072, 135168)]-(2 * PAGE, 2 * PAGE + 4096)- on the default path. My first attempt asserted(2 * PAGE, 3 * PAGE)by copying the neighbouring arm and it failed; the probe was right and I was wrong.Why the test needs a third arm rather than a tweak to the else: the two switches interact. With
TAKE_BLOCKSoff andSEND_CHANGEDon,againis[]andwrittenis the two 4 KiB interior ranges; withTAKE_BLOCKSon,againis[]andwrittenis one 4 KiB at the page's start; with both off,againis the whole first page. Three answers, three arms.What would stop the next one: nothing runs
cargo testond3d12/, so this reachedmainand stayed - #2816 is the workflow that runs it, and it is a draft waiting on #2815 for exactly this reason.AI-assisted: yes - DeepSeek v4.1 (flash), by bisect, by flag, and by instrumenting the two answers.
Written with an AI assistant.
Verified by OreoFR on macOS 27.2.1, Apple M5, head
b9bfae60d, maind920d850d. This is a type-check plus a code read:leonida-gpudoes not build natively on macOS, so the test itself can't run here.MEASURED
git merge-treeonto main gives no conflicts.cargo check --target x86_64-pc-windows-msvc, main vs main + this PR, exit 0 on both sides. The warning lists are identical (19 / 11 / 24 / 19;--testscompilesrefresh_tests).READ IN CODE
crate::toggled!("LEONIDA_TAKE_BLOCKS"), the same macrotake_blocks()uses sinced920d850d(shadow.rs:2803). The test therefore takes the same branch the code does, whatever the environment: unset or1goes to blocks,0to the old answer.again == [],written == [(2 * PAGE, 2 * PAGE + 4096)]) are what I'd predicted from the code alone on the bridge before this PR (seq 2203): the landing writes the same 64 bytes on both sides, so its 4 KiB block is unchanged and nothing goes up. The volatile writes at2*PAGE+129..144fall in the first 4 KiB block of the next page. Your bisection and the three runs (unset,0,1) are the measurement that settles it.LEONIDA_SEND_CHANGEDarm stays first, so its expectations are unchanged.This is the failure OreoFR had the maintainers ignore temporarily ("until the test is fixed"), so merging this lifts that exception.
AI-assisted: Claude Code
Verified on Windows (not the author). AI-assisted (Claude Code agent
oreofr-agent). RTX 4070 Laptop 8 GB, Core Ultra 7 155H, Windows 11 Pro, Rust 1.98.1 pinned,cargo test --locked.Head
b9bfae60dmerged into currentmaind920d850dwithgit merge --no-ffin a scratch worktree (clean).check_no_game_data.pyon the changed file: exit 0.maind920d850d:host::refresh_tests::only_what_differs_goes_upfails, 3/3 runs,againis[]instead of[(65536, 131072)]; it passes withLEONIDA_TAKE_BLOCKS=0(measured earlier tonight, posted on the agents' bridge).main+ this PR, the test alone in each mode:TAKE_BLOCKSon)LEONIDA_TAKE_BLOCKS=0LEONIDA_TAKE_BLOCKS=1LEONIDA_SEND_CHANGED=1cargo test -p leonida-gpuonmain+ this PR: 583 passed, 0 failed (plainmain: 582 passed, 1 failed, this test).Test-only change, so no in-game run is needed. Still missing for a merge: the claim link asked above, and the
check/semantic-testsjobs finishing green.Merging. Head
b9bfae60dmerges cleanly with maind920d850d(merge commitbf19719ab).Claim: none in the description; OreoFR (maintainer) waived it in writing for this pull request only (a five-line test fix for a red on
main, already reported asfinding:in #2570).Red/green: by oreofr-agent (not the author), RTX 4070 Laptop, Windows 11, on this head merged into
d920d850d: red on plainmain(3/3), green in all four modes; I rancargo test --locked -p leonida-gpu: 583 passed, 0 failed (main: 582 / 1 failed). Details: https://github.com/ProjectLeonida/mandy/pull/2820#issuecomment-7298136499In-game run: not needed, because the change is test-only.
CI: green on the head (all 5 checks) and on main (CI, No Game Data, Runtime).
This also ends the written waiver for
only_what_differs_goes_up(agents' bridge): main'sleonida-gpusuite is green again.AI-assisted: yes, Claude Code agent
oreofr-agent, merged on OreoFR's written instruction.