test: unit tests for tools/gen_gdk_runtime_classes.py (TEST-GEN-GDK-RUNTIME, carry of #340) #3083

Merged
MoonEyes merged 4 commits from upstream-pr/3083 into main 2026-12-02 12:15:34 +00:00
MoonEyes commented 2026-12-02 10:29:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T10:29:00Z.


Claimed in the coordination issue as: TEST-GEN-GDK-RUNTIME (the original author's item ID, claimed at https://github.com/ProjectLeonida/mandy/issues/14#issuecomment-7140050149)

What and why

Carry of #340 (kotekompotek), unchanged since 2026-11-25. Branch = main + the author's head (commit cab0e9a59 kept) + conflict resolution + my commit.

The PR adds unit tests for tools/gen_gdk_runtime_classes.py (parse_layout, parse_docs, check, revision, main). Since then main gained a tests/test_gen_gdk_runtime_classes.py with the atomic-write tests, which is what the review by aslan2142 asked to resolve. The merge resolution keeps all three atomic-write tests and their POSIX resource guard unchanged, and adds the author's test classes to the same file (shared imports, REPO constant used for both the script path and the tools import path).

Review point fixed in a separate commit: the in-process gen.main tests printed the tool's progress line and its "no COM folder" error into the test output (raised by Oliwettoo and aslan2142). stdout and stderr are now redirected around those two calls.

Not changed here: the missing ID in the original title and the missing claim comment (CONTRIBUTING, raised by Oliwettoo and QemmHD). This carry uses the author's claimed ID, TEST, above.

Tested

Windows 11, no GPU, no game files, on main a917c54d6 plus this branch (e7e75ac62).

  • python -I tests/test_gen_gdk_runtime_classes.py: Ran 9 tests, OK (skipped=2). The two skips are the POSIX-only RLIMIT_FSIZE write-failure tests, as on main. No tool output is printed any more.
  • python -I tests/test_ci_registration.py: Ran 18 tests, OK.
  • python -I tests/test_text_write_line_endings.py: Ran 3 tests, OK.
  • Red: the PR changes only a test file, so I made a temporary mutation in tools/gen_gdk_runtime_classes.py (the end-of-list break in parse_layout replaced by pass, and a changed "has no page" message in check) and reran the file: FAILED (failures=2, skipped=2), namely TestParseLayout.test_parses_methods_and_unknown_slots and TestParseDocsAndCheck.test_parses_classes_and_interfaces_and_detects_missing_links. The mutation was reverted with git checkout; the working tree is clean.
  • python -I scripts/check_no_game_data.py tests/test_gen_gdk_runtime_classes.py: clean (exit 0).

Not run: the full suite, CI.

GPUs tested: n/a (unit tests only)

AI-assisted: yes. Models: Claude Opus 5.5 in Claude Code (carry, conflict resolution, fixes, tests); separate read-only reviewer agent: Claude Opus 5.5.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: tests only, no translator rule.)

Supersedes #340 once merged; the original stays open until a maintainer decides.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5604585866 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3083). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T10:29:00Z. --- Claimed in the coordination issue as: TEST-GEN-GDK-RUNTIME (the original author's item ID, claimed at https://github.com/ProjectLeonida/mandy/issues/14#issuecomment-7140050149) ### What and why Carry of #340 (kotekompotek), unchanged since 2026-11-25. Branch = main + the author's head (commit `cab0e9a59` kept) + conflict resolution + my commit. The PR adds unit tests for `tools/gen_gdk_runtime_classes.py` (`parse_layout`, `parse_docs`, `check`, `revision`, `main`). Since then `main` gained a `tests/test_gen_gdk_runtime_classes.py` with the atomic-write tests, which is what the review by aslan2142 asked to resolve. The merge resolution keeps all three atomic-write tests and their POSIX `resource` guard unchanged, and adds the author's test classes to the same file (shared imports, `REPO` constant used for both the script path and the `tools` import path). Review point fixed in a separate commit: the in-process `gen.main` tests printed the tool's progress line and its "no COM folder" error into the test output (raised by Oliwettoo and aslan2142). stdout and stderr are now redirected around those two calls. Not changed here: the missing ID in the original title and the missing claim comment (CONTRIBUTING, raised by Oliwettoo and QemmHD). This carry uses the author's claimed ID, TEST, above. ### Tested Windows 11, no GPU, no game files, on main `a917c54d6` plus this branch (`e7e75ac62`). - `python -I tests/test_gen_gdk_runtime_classes.py`: `Ran 9 tests`, `OK (skipped=2)`. The two skips are the POSIX-only `RLIMIT_FSIZE` write-failure tests, as on `main`. No tool output is printed any more. - `python -I tests/test_ci_registration.py`: `Ran 18 tests`, `OK`. - `python -I tests/test_text_write_line_endings.py`: `Ran 3 tests`, `OK`. - Red: the PR changes only a test file, so I made a temporary mutation in `tools/gen_gdk_runtime_classes.py` (the end-of-list `break` in `parse_layout` replaced by `pass`, and a changed "has no page" message in `check`) and reran the file: `FAILED (failures=2, skipped=2)`, namely `TestParseLayout.test_parses_methods_and_unknown_slots` and `TestParseDocsAndCheck.test_parses_classes_and_interfaces_and_detects_missing_links`. The mutation was reverted with `git checkout`; the working tree is clean. - `python -I scripts/check_no_game_data.py tests/test_gen_gdk_runtime_classes.py`: clean (exit 0). Not run: the full suite, CI. GPUs tested: n/a (unit tests only) AI-assisted: yes. Models: Claude Opus 5.5 in Claude Code (carry, conflict resolution, fixes, tests); separate read-only reviewer agent: Claude Opus 5.5. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (Not applicable: tests only, no translator rule.) Supersedes #340 once merged; the original stays open until a maintainer decides. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
enlight3d commented 2026-12-02 12:02:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T12:02:26Z.


RUN (independent run on Windows, #3083 head b83249219, merged locally into main 9b4d71899 with git merge --no-ff, no conflicts. CI on the head: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.)

  • History: #340's head cab0e9a59 (kotekompotek) is an ancestor of the head through the merge 16f30af4f, under its author's name.
  • Merge resolution: the merged tests/test_gen_gdk_runtime_classes.py keeps main's three atomic-write tests and their POSIX resource guard. It adds the author's six tests: TestParseLayout (2), TestParseDocsAndCheck (2) and TestBuildAndMain (2). Against main, the diff only adds lines, apart from the module docstring and the SCRIPT line, which now uses the shared REPO constant.
  • python -I tests/test_gen_gdk_runtime_classes.py -v: main 3 tests OK (2 skipped, "needs POSIX resource limits (RLIMIT_FSIZE)"); merge 9 tests OK (the same 2 skipped). These match the body. The run prints no tool output (no progress line, no "cannot read the docs"), as the follow-up commit says.
  • python -m pytest on test_gdk_runtime_calls, test_gen_gdk_classes_out_dir, test_gen_gdk_runtime_classes, test_ci_registration and test_text_write_line_endings: main 48 passed / 2 skipped; merge 54 passed / 2 skipped.
  • No red on main is possible: this pull request changes only a test file, and with main's tool its 9 tests pass. The red comes from mutations of tools/gen_gdk_runtime_classes.py, each run with the whole test file and restored afterwards (git status clean). All 7 are killed:
    • The body's two: break → pass at the end of the Layout: list (test_parses_methods_and_unknown_slots), and a changed "which has no page" message (test_parses_classes_and_interfaces_and_detects_missing_links).
    • Class and interface ids no longer lowercased: killed.
    • A base of IUnknown reported as "IUnknown" instead of null: killed.
    • The "inherits a missing page" check removed: killed.
    • main() returning 2 instead of 1 when the docs cannot be read: killed (test_main_writes_json_and_handles_missing_docs).
    • An *unknown* layout entry kept as text instead of null: killed.
    • main's own three tests let the layout, lowercase-id and inheritance mutations through (3 OK each). So the parsing coverage is new.

Not covered here: Linux and macOS (the two RLIMIT_FSIZE tests are POSIX only and run in CI), and a real xgameruntime-docs clone (synthetic pages only).

Verdict: PASS. The six carried tests pass on the merge, they catch every parser and CLI mutation tried, which main's tests do not, the run is quiet, and the author's commit is kept.

Machine: Windows 11 Pro 26300 (NTFS), i9-13900K, 64 GB, CPython 3.13.12 (CI uses 3.12); unit tests only, no GPU or game files used.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7344756099 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3083#issuecomment-7344756099). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-12-02T12:02:26Z. --- RUN (independent run on Windows, #3083 head b83249219, merged locally into `main` 9b4d71899 with `git merge --no-ff`, no conflicts. CI on the head: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.) - History: #340's head cab0e9a59 (kotekompotek) is an ancestor of the head through the merge 16f30af4f, under its author's name. - Merge resolution: the merged `tests/test_gen_gdk_runtime_classes.py` keeps `main`'s three atomic-write tests and their POSIX `resource` guard. It adds the author's six tests: `TestParseLayout` (2), `TestParseDocsAndCheck` (2) and `TestBuildAndMain` (2). Against `main`, the diff only adds lines, apart from the module docstring and the `SCRIPT` line, which now uses the shared `REPO` constant. - `python -I tests/test_gen_gdk_runtime_classes.py -v`: main 3 tests OK (2 skipped, "needs POSIX resource limits (RLIMIT_FSIZE)"); merge 9 tests OK (the same 2 skipped). These match the body. The run prints no tool output (no progress line, no "cannot read the docs"), as the follow-up commit says. - `python -m pytest` on `test_gdk_runtime_calls`, `test_gen_gdk_classes_out_dir`, `test_gen_gdk_runtime_classes`, `test_ci_registration` and `test_text_write_line_endings`: main 48 passed / 2 skipped; merge 54 passed / 2 skipped. - No red on `main` is possible: this pull request changes only a test file, and with `main`'s tool its 9 tests pass. The red comes from mutations of `tools/gen_gdk_runtime_classes.py`, each run with the whole test file and restored afterwards (`git status` clean). All 7 are killed: - The body's two: `break` → `pass` at the end of the `Layout:` list (`test_parses_methods_and_unknown_slots`), and a changed "which has no page" message (`test_parses_classes_and_interfaces_and_detects_missing_links`). - Class and interface ids no longer lowercased: killed. - A base of `IUnknown` reported as "IUnknown" instead of null: killed. - The "inherits a missing page" check removed: killed. - `main()` returning 2 instead of 1 when the docs cannot be read: killed (`test_main_writes_json_and_handles_missing_docs`). - An `*unknown*` layout entry kept as text instead of null: killed. - `main`'s own three tests let the layout, lowercase-id and inheritance mutations through (3 OK each). So the parsing coverage is new. Not covered here: Linux and macOS (the two `RLIMIT_FSIZE` tests are POSIX only and run in CI), and a real xgameruntime-docs clone (synthetic pages only). Verdict: PASS. The six carried tests pass on the merge, they catch every parser and CLI mutation tried, which `main`'s tests do not, the run is quiet, and the author's commit is kept. Machine: Windows 11 Pro 26300 (NTFS), i9-13900K, 64 GB, CPython 3.13.12 (CI uses 3.12); unit tests only, no GPU or game files used.
MoonEyes commented 2026-12-02 12:03:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:03:42Z.


Merging. Head b83249219 merges cleanly with main 9b4d71899 and does not force a rebase of #2566. Independent check on head b83249219: enlight3d's red/green on main + this head (tests only, 3 -> 9 tests, related suite 48 -> 54; 7 of 7 tool mutations killed, where main's 3 tests let the parser ones through), comment 7344756099; kotekompotek's commit from #340 is kept; CI 5/5 green incl. no-game-data; no open review or question. Merged by MoonEyes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7344785815 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3083#issuecomment-7344785815). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:03:42Z. --- Merging. Head `b83249219` merges cleanly with `main` `9b4d71899` and does not force a rebase of #2566. Independent check on head b83249219: enlight3d's red/green on main + this head (tests only, 3 -> 9 tests, related suite 48 -> 54; 7 of 7 tool mutations killed, where main's 3 tests let the parser ones through), comment 7344756099; kotekompotek's commit from #340 is kept; CI 5/5 green incl. no-game-data; no open review or question. Merged by MoonEyes. AI-assisted (Claude Code).
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!3083
No description provided.