sandbox_scene: protect the placement input from output aliases #2442

Merged
kirigayakazima merged 1 commit from upstream-pr/2442 into main 2026-11-28 19:42:09 +00:00
kirigayakazima commented 2026-11-27 10:16:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-27T10:16:54Z.


Claimed in the coordination issue as: SANDBOX-SCENE-ENTITIES-ALIAS

What and why

The entities JSONL is consumed before the scene is opened for writing. An output path naming that input, including a hard link with another extension, silently replaced the placements with an LSB1 file. Check both paths with the repository’s shared identity helper before building. The CLI regression verifies exit status 2 and preserves the source bytes for both spellings.

Tested

Windows, Python 3.14.7, synthetic fixtures.

  • python -I tests/test_sandbox_scene.py
  • python -I tests/test_sandbox_scene_build.py
  • Changed-path game-data scan and git diff --check passed.
  • Shared main baseline: 6,374 translator semantic tests passed across 500 files. The combined five-topic checkout passed 172 focused tests.

GPUs tested: N/A (CPU-only).

AI-assisted: Yes.

Checklist

  • Based on current main and merges cleanly with the tested base.
  • One topic.
  • No game data, keys or decryption.
  • Translator contract table: N/A.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5524928016 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2442). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-27T10:16:54Z. --- Claimed in the coordination issue as: [SANDBOX-SCENE-ENTITIES-ALIAS](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7215561737) ### What and why The entities JSONL is consumed before the scene is opened for writing. An output path naming that input, including a hard link with another extension, silently replaced the placements with an LSB1 file. Check both paths with the repository’s shared identity helper before building. The CLI regression verifies exit status 2 and preserves the source bytes for both spellings. ### Tested Windows, Python 3.14.7, synthetic fixtures. - `python -I tests/test_sandbox_scene.py` - `python -I tests/test_sandbox_scene_build.py` - Changed-path game-data scan and `git diff --check` passed. - Shared main baseline: 6,374 translator semantic tests passed across 500 files. The combined five-topic checkout passed 172 focused tests. GPUs tested: N/A (CPU-only). AI-assisted: Yes. ### Checklist - [x] Based on current main and merges cleanly with the tested base. - [x] One topic. - [x] No game data, keys or decryption. - Translator contract table: N/A.
zmasi commented 2026-11-28 07:35:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T07:35:42Z.


#2442 | head 096fce1d45 (merged cleanly with main 09c153948) | python -I tests/test_sandbox_scene.py | red on main: FAILED (failures=2) (test_scene_output_cannot_replace_placements: AssertionError: 0 != 2 on direct --entities path and hardlink alias) | green on PR+main: 13 tests OK (-k test_scene_output_cannot_replace_placements: 1 test OK) | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited main() in tools/sandbox_scene.py (same_report_path(args.out, args.entities) guard before opening output), and verified both PR + main (09c153948) and combined sibling merges main + #2443 + #2442 and main + #2444 + #2443 + #2442 (0 conflicts; 14 tests OK in tests/test_sandbox_scene.py, 9 tests OK in tests/test_sandbox_scene_build.py). Also passed tests/test_report_paths.py (24 OK, skipped=1), tests/test_text_write_line_endings.py (3 OK), tests/test_runner_calls_all_tests.py (3 OK), and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7236040189 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2442#issuecomment-7236040189). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T07:35:42Z. --- #2442 | head 096fce1d45ec49420a61a03987f3b45e2dc06cab (merged cleanly with main 09c153948) | `python -I tests/test_sandbox_scene.py` | red on main: `FAILED (failures=2)` (`test_scene_output_cannot_replace_placements`: `AssertionError: 0 != 2` on direct `--entities` path and hardlink alias) | green on PR+main: `13 tests OK` (`-k test_scene_output_cannot_replace_placements`: `1 test OK`) | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `main()` in `tools/sandbox_scene.py` (`same_report_path(args.out, args.entities)` guard before opening output), and verified both `PR + main` (`09c153948`) and combined sibling merges `main + #2443 + #2442` and `main + #2444 + #2443 + #2442` (`0` conflicts; `14 tests OK` in `tests/test_sandbox_scene.py`, `9 tests OK` in `tests/test_sandbox_scene_build.py`). Also passed `tests/test_report_paths.py` (`24 OK, skipped=1`), `tests/test_text_write_line_endings.py` (`3 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), and `scripts/check_no_game_data.py`.
MoonEyes commented 2026-11-28 19:42:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T19:42:06Z.


Red/green: tests/test_sandbox_scene.py fails 2 subtests on main (--out equal to or hard-linked to --entities overwrites the placements) and passes with the PR (cloud run on main 7daa4a4, re-run on Windows against main 8b318bd).
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 7daa4a4a5 in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7244741005 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2442#issuecomment-7244741005). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T19:42:06Z. --- Red/green: tests/test_sandbox_scene.py fails 2 subtests on main (--out equal to or hard-linked to --entities overwrites the placements) and passes with the PR (cloud run on main 7daa4a4, re-run on Windows against main 8b318bd). Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 7daa4a4a5 in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2442
No description provided.