gen_d3d12_stubs: preserve multiline comment breaks, reject empty paths, and write atomically (GEN-D3D12-STUBS-COMMENTS-AND-IO) #1583

Open
github-bot wants to merge 1 commit from github-bot/gh-1583 into main AGit
Owner

@⁠IlyassRS3 on GitHub · 2026-11-25 05:08 UTC · original
IlyassRS3:fix/gen-d3d12-stubs-comments-and-io → main · +178 −14 · 2 files · 1 commits · open

Item: GEN-D3D12-STUBS-COMMENTS-AND-IO (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch tools/gen_d3d12_stubs.py).

Summary

  • Preserve line breaks when stripping multiline /* ... */ block comments in parse_interfaces(), preventing adjacent declarations or preprocessor directives after */ from merging into a single malformed method signature.
  • Reject empty or whitespace-only --out, --report, and --header arguments instead of silently ignoring "", falling back to INCLUDE on --header "", or creating whitespace-named files in cwd.
  • Make write_if_changed() read with newline="" (so stale CRLF files are rewritten to LF) and stage writes atomically via file_mode.published_mode + replace_retry.replace (preserving existing files on failure and keeping direct writes for non-regular targets), with strict JSON (allow_nan=False).
  • Catch OSError when reading --header or --source files in main(argv=None) and return a clean one-line ERROR: with exit code 2 instead of a raw traceback.

Verification

  • python3 -W error -I tests/test_gen_d3d12_stubs.py -v: 49 passed, 1 skipped (Windows-only case-fold test).
  • python3 -I tests/test_text_write_line_endings.py: 3/3 passed.
  • python3 -I scripts/check_no_game_data.py tools/gen_d3d12_stubs.py tests/test_gen_d3d12_stubs.py: passed.
  • python3 -m compileall -q tools/gen_d3d12_stubs.py tests/test_gen_d3d12_stubs.py: passed.
  • Mutation check (running the new test suite against unpatched main:tools/gen_d3d12_stubs.py): failures=9, errors=1 across all 5 new regression tests.

AI-assisted: yes
GPUs tested: none (CPU-only Python build tool; synthetic headers only, no game data)

**@⁠IlyassRS3** on GitHub · 2026-11-25 05:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1583) `IlyassRS3:fix/gen-d3d12-stubs-comments-and-io` → `main` · +178 −14 · 2 files · 1 commits · open Item: `GEN-D3D12-STUBS-COMMENTS-AND-IO` (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch `tools/gen_d3d12_stubs.py`). ### Summary - Preserve line breaks when stripping multiline `/* ... */` block comments in `parse_interfaces()`, preventing adjacent declarations or preprocessor directives after `*/` from merging into a single malformed method signature. - Reject empty or whitespace-only `--out`, `--report`, and `--header` arguments instead of silently ignoring `""`, falling back to `INCLUDE` on `--header ""`, or creating whitespace-named files in `cwd`. - Make `write_if_changed()` read with `newline=""` (so stale CRLF files are rewritten to LF) and stage writes atomically via `file_mode.published_mode` + `replace_retry.replace` (preserving existing files on failure and keeping direct writes for non-regular targets), with strict JSON (`allow_nan=False`). - Catch `OSError` when reading `--header` or `--source` files in `main(argv=None)` and return a clean one-line `ERROR:` with exit code 2 instead of a raw traceback. ### Verification - `python3 -W error -I tests/test_gen_d3d12_stubs.py -v`: 49 passed, 1 skipped (Windows-only case-fold test). - `python3 -I tests/test_text_write_line_endings.py`: 3/3 passed. - `python3 -I scripts/check_no_game_data.py tools/gen_d3d12_stubs.py tests/test_gen_d3d12_stubs.py`: passed. - `python3 -m compileall -q tools/gen_d3d12_stubs.py tests/test_gen_d3d12_stubs.py`: passed. - Mutation check (running the new test suite against unpatched `main:tools/gen_d3d12_stubs.py`): `failures=9, errors=1` across all 5 new regression tests. AI-assisted: yes GPUs tested: none (CPU-only Python build tool; synthetic headers only, no game data)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:57:14 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 05:08 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-25 05:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1583#pullrequestreview-6052151418) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1583/head:github-bot/gh-1583'
git switch 'github-bot/gh-1583'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1583'
git switch 'github-bot/gh-1583'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1583'
git switch 'github-bot/gh-1583'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1583'
git switch 'main'
git merge --squash 'github-bot/gh-1583'
git switch 'main'
git merge --ff-only 'github-bot/gh-1583'
git switch 'main'
git merge 'github-bot/gh-1583'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.