test(pykotor): area layout deserialize errors and object roundtrip#236
Draft
cursor[bot] wants to merge 1 commit into
Draft
test(pykotor): area layout deserialize errors and object roundtrip#236cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Co-authored-by: Boden <th3w1zard1@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds regression tests for recently merged headless area layout and JSON I/O: invalid saved data, impossible tile extension, and placed objects.
Type of Change
Package(s) Affected
Risky behavior now covered
extend_tile_from_wall/_best_adjacent_wall_hook: When the target tile template has no wall hook matching the active wall’s template id, layout extension must fail with a clearValueErrorinstead of silently misplacing geometry.area_layout_from_dict: MissingkitIDin the kits map and invalid floortemplateIDoverrides must raise predictableValueErrors (bad hand-edited or merged layout JSON).AreaRoom.add_objectdata must round-trip througharea_layout_to_dict/area_layout_from_dictwith kit id, template id, and position preserved.Test files added/updated
Libraries/PyKotor/tests/test_area_layout.py— extended_layout_test_kit()with an OBJECT template for round-trip coverage; new tests for hook mismatch, missing kit, bad floor override, and object serialization.Why these tests materially reduce regression risk
Indoor / module-design tooling depends on deterministic layout state and safe deserialization. Silent mis-linking of tiles or accepting corrupt JSON would corrupt walkmeshes and MDL placement downstream (
area_layout_to_merged_bwm,area_layout_model_placements). These tests lock in explicit failure modes and prove the object list survives save/load, which was not previously asserted.Testing
Test Results
Also:
uv run ruff check tests/test_area_layout.pyanduv run ruff format tests/test_area_layout.py.Checklist
Related Issues
Regression coverage automation (cron); no specific issue.
Additional Notes
Tests are fully deterministic (synthetic
TileKitfixtures, no disk or network).uv syncat workspace root can fail on unpublished optional deps; tests were run fromLibraries/PyKotorwithuv sync --extra devper package README patterns.AgentDecompile status: Skipped - test-only change, no game-engine or binary behavior :(