mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #1866] tools/compute_heap_layout_census: validate fspx user_sgprs, strip BOM logs, extract testable main #1876
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1876
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1866
Author: @kirigayakazima
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/compute-heap-layout-safety📝 Commits (1)
a51fba9Harden compute_heap_layout_census BOM, fspx validation, and CLI error handling📊 Changes
2 files changed (+117 additions, -7 deletions)
View changed files
📝
tests/test_compute_heap_layout_census.py(+87 -0)📝
tools/compute_heap_layout_census.py(+30 -7)📄 Description
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.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.