awc_cue_labels: reject excessively nested JSON (AWC-CUE-JSON-DEPTH) #1186

Merged
Taffyyy-ops merged 2 commits from upstream-pr/1186 into main 2026-11-29 00:54:44 +00:00
Taffyyy-ops commented 2026-11-24 19:49:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-24T19:49:56Z.


Claimed in the coordination issue as: AWC-CUE-JSON-DEPTH

What and why

A deeply nested invalid cue sheet raises RecursionError during JSON decoding and prints a traceback. Convert it to a concise ValueError so the CLI exits cleanly without publishing a label directory.

Tested

  • python -I tests/test_awc_cue_json_depth.py: 2 passed, synthetic inputs only.
  • python -I tests/test_awc_cue_labels.py: 2 passed.
  • python -I scripts/check_no_game_data.py; git diff --check: passed.
  • Windows 11, Python standard library. GPU not required.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5479216417 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1186). Originally posted by [Taffyyy-ops](https://github.com/Taffyyy-ops) on 2026-11-24T19:49:56Z. --- Claimed in the coordination issue as: AWC-CUE-JSON-DEPTH ### What and why A deeply nested invalid cue sheet raises RecursionError during JSON decoding and prints a traceback. Convert it to a concise ValueError so the CLI exits cleanly without publishing a label directory. ### Tested - python -I tests/test_awc_cue_json_depth.py: 2 passed, synthetic inputs only. - python -I tests/test_awc_cue_labels.py: 2 passed. - python -I scripts/check_no_game_data.py; git diff --check: passed. - Windows 11, Python standard library. GPU not required. AI-assisted: yes.
Deedlyy commented 2026-11-24 20:09:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:09:08Z.


Recommendation: [MERGE]

Reasoning: awc_cue_labels turns a RecursionError from deeply nested cue-sheet JSON into a clean ValueError, so the CLI exits without publishing a partial label directory. Tiny tool fix with a test. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 2/10

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7143113221 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1186#issuecomment-7143113221). Originally posted by [Deedlyy](https://github.com/Deedlyy) on 2026-11-24T20:09:08Z. --- **Recommendation:** [MERGE] **Reasoning:** `awc_cue_labels` turns a `RecursionError` from deeply nested cue-sheet JSON into a clean `ValueError`, so the CLI exits without publishing a partial label directory. Tiny tool fix with a test. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 2/10
Taffyyy-ops commented 2026-11-25 10:43:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-25T10:43:03Z.


@Deedlyy Thanks for the [MERGE] review!

  • Identified why ests/test_awc_cue_json_depth.py failed on Linux and macOS CI (stdlib-tests-linux / macos-python, run 45474369073): CPython's C _json scanner parses 3,000 nested [ tokens without raising RecursionError on platforms with a larger C stack than Windows.
  • Pushed commit 6722fc8c6 adding an explicit string/escape-aware _check_json_depth(text, max_depth=64) pre-check in ools/awc_cue_labels.py (while keeping the RecursionError fallback) and expanding ests/test_awc_cue_json_depth.py to test both deep object/array nesting and bracket/escaped-quote characters inside string literals.
  • Re-verified locally (AI-assisted, synthetic only): ests/test_awc_cue_json_depth.py (3/3 OK), ests/test_awc_cue_labels.py (2/2 OK), ests/test_tool_stdout_encoding.py (4/4 OK), ests/test_text_write_line_endings.py (3/3 OK), scripts/check_no_game_data.py (�), and git diff --check (�).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7160077525 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1186#issuecomment-7160077525). Originally posted by [Taffyyy-ops](https://github.com/Taffyyy-ops) on 2026-11-25T10:43:03Z. --- @Deedlyy Thanks for the [MERGE] review! - Identified why ests/test_awc_cue_json_depth.py failed on Linux and macOS CI (stdlib-tests-linux / macos-python, run 45474369073): CPython's C _json scanner parses 3,000 nested [ tokens without raising RecursionError on platforms with a larger C stack than Windows. - Pushed commit `6722fc8c6` adding an explicit string/escape-aware _check_json_depth(text, max_depth=64) pre-check in ools/awc_cue_labels.py (while keeping the RecursionError fallback) and expanding ests/test_awc_cue_json_depth.py to test both deep object/array nesting and bracket/escaped-quote characters inside string literals. - Re-verified locally (AI-assisted, synthetic only): ests/test_awc_cue_json_depth.py (3/3 OK), ests/test_awc_cue_labels.py (2/2 OK), ests/test_tool_stdout_encoding.py (4/4 OK), ests/test_text_write_line_endings.py (3/3 OK), scripts/check_no_game_data.py (�), and git diff --check (�).
zmasi commented 2026-11-28 23:49:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:49:08Z.


#1186 | head 6722fc8c64 (merged cleanly with main a9e247cd69) | python -I tests/test_awc_cue_json_depth.py -v + python -I tests/test_awc_cue_labels.py -v | red on main: FAILED (failures=2) (RecursionError traceback on 3000-deep [ array and JSONDecodeError instead of the depth guard on 100-deep { object) | green on PR+main: 3 ran, OK (test_awc_cue_json_depth.py) and 2 ran, OK (test_awc_cue_labels.py) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited 6722fc8c64 (tools/awc_cue_labels.py and tests/test_awc_cue_json_depth.py) merged cleanly onto main (a9e247cd69) on Windows 11 — first Windows verification report on this PR. Confirmed _check_json_depth() rejects nesting above MAX_JSON_DEPTH = 64 before json.loads() runs (avoiding CPython's shallower C stack limit on Windows x64), ignores brackets inside JSON string literals with escaped quotes/backslashes, leaves the output directory uncreated on failure, and passes scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247683731 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1186#issuecomment-7247683731). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T23:49:08Z. --- #1186 | head 6722fc8c64474181bc6474c5d28523f46acf014d (merged cleanly with main a9e247cd69) | `python -I tests/test_awc_cue_json_depth.py -v` + `python -I tests/test_awc_cue_labels.py -v` | red on main: `FAILED (failures=2)` (`RecursionError` traceback on 3000-deep `[` array and `JSONDecodeError` instead of the depth guard on 100-deep `{` object) | green on PR+main: `3 ran, OK` (`test_awc_cue_json_depth.py`) and `2 ran, OK` (`test_awc_cue_labels.py`) | Windows 11 (`10.0.26200.9974`), Python 3.12.10 | AI-assisted: yes Audited `6722fc8c64` (`tools/awc_cue_labels.py` and `tests/test_awc_cue_json_depth.py`) merged cleanly onto `main` (`a9e247cd69`) on Windows 11 — first Windows verification report on this PR. Confirmed `_check_json_depth()` rejects nesting above `MAX_JSON_DEPTH = 64` before `json.loads()` runs (avoiding CPython's shallower C stack limit on Windows x64), ignores brackets inside JSON string literals with escaped quotes/backslashes, leaves the output directory uncreated on failure, and passes `scripts/check_no_game_data.py`.
enlight3d commented 2026-11-29 00:44:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:44:23Z.


RUN for #1186 (red/green, synthetic inputs only, no build, no game, GPU not used)

Heads tested

  • PR head: 6722fc8c64
  • main: 829530dbd0 (origin/main at the time of the run)
  • Merged test: PR head merged into that main with git merge --no-edit --no-ff (local only, merge was clean, nothing pushed)

Commands (one process per file, from the repo root, CPython 3.13.12 with -I)

python -I tests/test_awc_cue_json_depth.py
python -I tests/test_awc_cue_labels.py

Red: tests kept, the PR's change to tools/ reverted to the merge base. behavioural: with tools/awc_cue_labels.py reverted, 2 of 3 tests fail (failures=2); the CLI dies with a RecursionError traceback instead of the concise "nesting is too deep" error and exit status the PR adds.
Green at PR head: yes (tests/test_awc_cue_json_depth.py: 3 passed; tests/test_awc_cue_labels.py: 2 passed)
Green merged into main: yes, same files all pass on the merged tree (counts as above)
Plain main (other covering tests, without the PR): pass, so nothing pre-existing fails and nothing breaks once merged.
Kind of red: behavioural (test fails for the reason the PR fixes).

Machine: Windows 11 Pro 10.0.26300, CPython 3.13.12; GPU not used.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248318207 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1186#issuecomment-7248318207). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T00:44:23Z. --- RUN for #1186 (red/green, synthetic inputs only, no build, no game, GPU not used) Heads tested - PR head: 6722fc8c64474181bc6474c5d28523f46acf014d - main: 829530dbd0196aa817dbec74aaafc79407b94b57 (origin/main at the time of the run) - Merged test: PR head merged into that main with `git merge --no-edit --no-ff` (local only, merge was clean, nothing pushed) Commands (one process per file, from the repo root, CPython 3.13.12 with -I) ``` python -I tests/test_awc_cue_json_depth.py python -I tests/test_awc_cue_labels.py ``` Red: tests kept, the PR's change to tools/ reverted to the merge base. behavioural: with tools/awc_cue_labels.py reverted, 2 of 3 tests fail (failures=2); the CLI dies with a RecursionError traceback instead of the concise "nesting is too deep" error and exit status the PR adds. Green at PR head: yes (tests/test_awc_cue_json_depth.py: 3 passed; tests/test_awc_cue_labels.py: 2 passed) Green merged into main: yes, same files all pass on the merged tree (counts as above) Plain main (other covering tests, without the PR): pass, so nothing pre-existing fails and nothing breaks once merged. Kind of red: behavioural (test fails for the reason the PR fixes). Machine: Windows 11 Pro 10.0.26300, CPython 3.13.12; GPU not used.
MoonEyes commented 2026-11-29 00:54:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T00:54:46Z.


Merged after enlight3d's red/green check (check) (RTX 3090, driver 621.40, Windows 11) and a local re-check here. Merged after local re-verification: this PR merged onto main 7100865c4 without conflict, and its test file(s) (tests/test_awc_cue_json_depth.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248436861 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1186#issuecomment-7248436861). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T00:54:46Z. --- Merged after **enlight3d**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/1186#issuecomment-7248318207)) (RTX 3090, driver 621.40, Windows 11) and a local re-check here. Merged after local re-verification: this PR merged onto `main` 7100865c4 without conflict, and its test file(s) (`tests/test_awc_cue_json_depth.py`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
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!1186
No description provided.