runtime: pin commit headroom rounding and request cap in host_commit_check #1817
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1824"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T19:18:04Z.
Change
tests/host_commit_check.pydid not pin two behaviors oftools/host_commit.py:snapshot_from_pagescomputesavailable_mibfrom the free bytes, so a partialMiB of headroom floors to the real value. Every existing case had MiB-aligned
limit and use, or floored both sides to the same answer, so reporting
limit_mib - used_mibinstead (which can overstate headroom by up to 1 MiB) wasnot detected.
require_commit_budgetaccepts requests up to and including 1048576 MiB. Theexisting invalid request
(1 << 20) | 1used a 3 MiB snapshot, so it was refusedby the headroom check even when the range check was moved or made exclusive.
Mutation probe (single-point edits to
tools/host_commit.py, reverted after each run):available_mib = limit_bytes // MIB - used_bytes // MIBminimum_mib >= 1 << 20minimum_mib > 1 << 21<-><=page_sizeguardlimit_pagesguardmax(limit - used, 0)->abs(limit - used)< 0->< -1CommitLimit->CommitPeakisinstance(..., int)testused_mibrounded upavailable_mibasminimum_mibavailable_mib < minimum_mibinstead of bytesfloor(b / MiB) < miffb < m * MiB)The new cases read:
limit_mib=1, used_mib=0, available_mib=0, available_bytes=786432, and a 1 MiBrequest is refused with "headroom 0 MiB is below the requested 1 MiB".
(1 << 20) + 1MiB headroom, a 1048576 MiB request isaccepted and a 1048577 MiB request is refused by the range check ("between 0 and
1048576"), not by the headroom check.
Verification
Based on origin/main
813045b3. Windows 11 Pro 26300.9974, Python 3.12.10.Each mutant in the table was applied alone and
python -B tests/host_commit_check.pyre-run; "killed" means a non-zero exit.
Evidence and follow-up
No new fixture: the cases use synthetic page counts. The live PSAPI smoke test is
unchanged.
pe_run_package.pyalso range-checks--min-commit-mibbefore callingrequire_commit_budget; these cases pin the function's own check, which othercallers rely on.
The tool is not changed.
Checklist
AI-assisted (Claude Code).