ped_assemble: harden output guards, atomic JSON reports, and input/skeleton validation (PED-ASSEMBLE-VALIDATION-AND-IO-HARDENING) #1520
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!1520
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/ped-assemble-hardening"
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
Summary
Hardens
tools/ped_assemble.pyacross output overwrite/collision safety, atomic JSON report publishing, binary glTF container bounds, skeleton hierarchy/IBM integrity, tolerance validation, and malformed JSON/manifest error handling:_check_output_paths): checks-o/--outand--jsonacrossassemble,cull-overlap, andinspect-seamsagainst existing directories, each other, direct inputs, and transitively loaded manifest parts / external PNG texture files usingreport_paths.same_report_path._write_json_report,build_assembled_glb): stages JSON reports in a sibling temp file withnewline="\n",allow_nan=False,file_mode.published_mode, andreplace_retry.replace(preserving pre-existing files on error and cleaning up temp files), and enforcesallow_nan=Falseinbuild_assembled_glb.read_glb_parts): rejectstotal_len < 20, chunk headers whosepos + chunk_len > total_len, unconsumed trailing bytes withintotal_len, and out-of-range triangle vertex indices._validate_skeleton,_pack_f32_vec,_pack_u16_vec4,build_assembled_glb): rejects self-parent and multi-joint parent cycles, out-of-range orboolparents, unsupportedskeleton.coord_space, non-16-floatinverse_bind_matrixentries ony-upskeletons, non-finite values, and float32-overflowing attributes/IBMs withPedAssembleErrorinstead of silent corruption or rawOverflowError.standing_offset, non-negative finite tolerances (--waist-tol,--nipple-tol,--genital-tol,--plane-tol,--vertex-tol,--weld-tol,--tol,--overlap-tol), andnormal_cos_minin[-1, 1]in bothbuild_parser()and core API functions.load_parts_from_path,_read_png_spec,_parse_material_dict,_part_from_dict,_skeleton_from_dict,main): detects cyclic JSON manifests, validatesbase64:payloads and material fields (base_color_factor,alpha_mode, finite factors), validates JSON part/triangle bounds, and catchesOSError/glb_writer.GlbErrorinmain()for clean exit-2ERROR:reporting.Coordination
PED-ASSEMBLE-VALIDATION-AND-IO-HARDENING(https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151612040)Testing
python3 -I tests/test_ped_assemble.py -v— 22/22 OK (including 6 new regression tests inValidationAndIoHardeningTests)python3 -I tests/test_ped_assemble_malformed_glb.py— 8/8 OKpython3 -I tests/test_ped_assemble_sparse_glb.py— 7/7 OKpython3 -I tests/test_ped_extra_uvs.py— 7/7 OKpython3 -I tests/test_ped_glb_material_defaults.py— 6/6 OKpython3 -I tests/test_ped_json_textures.py— 4/4 OKpython3 -I tests/test_ped_snorm.py— 5/5 OKpython3 -I tests/test_json_bom_inputs.py— 10/10 OKpython3 -I tests/test_text_write_line_endings.py— 3/3 OKpython3 -I scripts/check_no_game_data.py tools/ped_assemble.py tests/test_ped_assemble.py— cleanpython3 -m compileall -q tools/ped_assemble.py tests/test_ped_assemble.py— cleanmain:tools/ped_assemble.py: 6/6 tests inValidationAndIoHardeningTestsfail (FAILED (failures=5, errors=1)).Checklist
[KEEP]
tools/ped_assemble.py+582/-103,tests/test_ped_assemble.py+387) bundling several concerns: output-path guards, atomic JSON reports, GLB bounds, skeleton validation, tolerance validation, and manifest cycle handling. It is hard to review as one unit; splitting could help, though it is claimed as a single item in the coordination issue.change-scope,no-game-data) and no independent tester has reported yet.Independent verification (native Windows, Python 3.11.9 — stdlib-only, representative): diff vs merge-base reviewed; output guards, atomic JSON, GLB chunk/skeleton/CLI validation all present; tests 22/22+8/8+7/7+7/7+6/6+4/4+5/5+10/10+3/3 and mutation check reproduces claimed FAILED(5,1). compileall + check_no_game_data clean. AI-assisted verification.
Red/green:
pytest tests/test_ped_assemble.pyfails on main (6 failed, 16 passed, 3 subtests passed) and passes on head 6366c36d5d46 merged with main (22 passed, 11 subtests passed).Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)