tools/compute_heap_layout_census: validate fspx user_sgprs, strip BOM logs, extract testable main #1866
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1866"
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 ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-25T13:41:19Z.
Claimed in the coordination issue as: COMPUTE-HEAP-LAYOUT-BOM-FSPX-AND-DISPATCH-LOG-SAFETY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164101436)
What and why
encoding="utf-8-sig", errors="replace"incaptured_layouts()(tools/compute_heap_layout_census.py) so UTF-8 BOM headers do not corrupt line 1.launch.exists()+ uncheckedjson.loads(launch.read_bytes())inprogram_loads()withlaunch.is_file(), explicitutf-8-sigdecoding, path-attributedValueErrordiagnostics for invalid UTF-8 / JSON /RecursionError/ non-object roots, and stricttype(raw_user) is int and raw_user >= 0checking foruser_sgprs(rejectingbool,str, and negative integers).main(argv=None) -> intcatching(OSError, ValueError, KeyError, TypeError, RecursionError)to printERROR: <exc>tostderrand return2, withsys.stdout.reconfigure(errors="replace")under__main__.tests/test_compute_heap_layout_census.pywith tests for BOMfspx/<name>.jsonfallback, directory at launch path, invalid UTF-8/JSON/type/range inputs, and BOM dispatch logs throughmain().Tested
python -I tests/test_compute_heap_layout_census.py -v->Ran 5 tests in 0.102s(OK).upstream/main5e95fa2fwith updated test file copied into detached worktree):Ran 5 tests in 0.106s(FAILED (failures=3, errors=4)).python -I tests/test_ci_registration.py(Ran 16 tests in 4.618s,OK),python -I tests/test_text_write_line_endings.py(Ran 3 tests in 12.681s,OK),python -I scripts/check_no_game_data.py(exit 0),python -I -m compileall -q(exit 0),git diff --check(exit 0).GPUs tested: n/a (synthetic containers, listings, dispatch logs, and CLI error validation)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T14:05:41Z.
Tested
a51fba921on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), againstmain71a769d7d(Python census tool; no GPU):tests/test_compute_heap_layout_census.py: 5 passed, 5 subtests passed at this head.main: 7 failed, 3 passed — the BOM-tolerant dispatch-log reading,launch.exists()/json.loadschecks and the FSPX user-SGPR validation are new.AI-assisted; synthetic fixtures only, no game data.
Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-25T15:32:10Z.
Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.
python -m pytest -q tests/test_compute_heap_layout_census.py:(AI-assisted test run; output checked by hand.)
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T20:16:17Z.
Red/green: On main test_compute_heap_layout_census.py has 3 failures and 4 errors (BOM logs and invalid fspx user_sgprs not handled, no testable main), and with the PR all 5 tests pass on Windows 11 at OreoFR's (RTX 4070).
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main
c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:55:24Z.
Verified by OreoFR
3408969a7+ PR head4faebe249python -I tests/test_compute_heap_layout_census.pyAI-assisted (Claude Code, Claude Opus 5.5).